Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
588 views
in Technique[技术] by (71.8m points)

selenium webdriver - Configuring Specflow+ Runner for parallel test execution across different Browsers

I am using Specflow+ Runner for my automation testing using Selenium/Appium grid at the backend and want to test my scripts in parallel across multiple Browsers I have referred to the examples from Specflow examples repository (https://github.com/SpecFlowOSS/SpecFlow.Plus.Examples/tree/master/SeleniumGridWebTest) and using the following Default.srprofile

<?xml version="1.0" encoding="utf-8"?>
<TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
  <Settings projectName="SpecflowTrial" />
  <Execution stopAfterFailures="0" testThreadCount="5" testSchedulingMode="Sequential" retryCount="0" apartmentState="MTA" />
  <Environment testThreadIsolation="Process" />
  <TestAssemblyPaths>
    <TestAssemblyPath>SpecflowTrial.dll</TestAssemblyPath>
  </TestAssemblyPaths>
  <Report>
    <Template name="ReportReportTemplate.cshtml" />
  </Report>
  <Targets>
    <Target name="Browser_Safari">
      <Filter>Browser_Safari</Filter>
      <DeploymentTransformationSteps>
        <EnvironmentVariable variable="Test_Browser" value="Safari" />
      </DeploymentTransformationSteps>
      <Environment testThreadIsolation="Process" />
    </Target>
    <Target name="Browser_Chrome">
      <Filter>Browser_Chrome</Filter>
      <DeploymentTransformationSteps>
        <EnvironmentVariable variable="Test_Browser" value="Chrome" />
      </DeploymentTransformationSteps>
      <Environment testThreadIsolation="Process" />
    </Target>
    <Target name="Browser_Firefox">
      <Filter>Browser_Firefox</Filter>
      <DeploymentTransformationSteps>
        <EnvironmentVariable variable="Test_Browser" value="Firefox" />
      </DeploymentTransformationSteps>
      <Environment testThreadIsolation="Process" />
    </Target>
  </Targets>
  <TestThreads>
    <TestThread id="0">
      <TestAffinity>testpath:Target:Browser_Safari</TestAffinity>
    </TestThread>
    <TestThread id="1">
      <TestAffinity>testpath:Target:Browser_Chrome</TestAffinity>
    </TestThread>
    <TestThread id="2">
      <TestAffinity>testpath:Target:Browser_Firefox</TestAffinity>
    </TestThread>
  </TestThreads>
</TestProfile>

where the filters are applied to tags on the scenarios My problem is that when running all tests in parallel, sometimes the tests are triggered across different browsers and sometimes it is triggered for the same Browsers, in this case, all run on either Chrome, Firefox or Safari. What is the correct configuration that should be used to trigger tests in parallel across different browsers?


Update: The above question was resolved bumping the SpecRun to version 3.6.2

question from:https://stackoverflow.com/questions/65935913/configuring-specflow-runner-for-parallel-test-execution-across-different-browse

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...