SpecFlow Parallel and non Parallel tests

时光怂恿深爱的人放手 提交于 2019-12-11 15:28:07

问题


I'm using SpecFlow to automate my web tests and using parallel execution to speed them up.

The issue i have is that one test which checks that invalid passwords are rejected will lock the user account if run 3 times without a successful login.

I've set them up to perform a successful login afterwards however running in parallel means against multiple targets they are ran at the same time and still lock the account.

Is there a way I can set just this test to not run in parallel so it doesn't lock the account and still allow the others to run in parallel?

EDIT-- I am using SpecRun as my test runner


回答1:


I have managed to find a workaround to my issue.

By placing the below code in my srprofile I can tag the tests I wish to run sequentially and they are forced to only run in a particular thread.

<TestThreads>
    <TestThread id="0">
      <TestAffinity>@Sequential | !@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="1">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="2">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="3">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="4">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="5">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="6">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
    <TestThread id="7">
      <TestAffinity>!@Sequential</TestAffinity>
    </TestThread>
  </TestThreads>


来源:https://stackoverflow.com/questions/46708083/specflow-parallel-and-non-parallel-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!