SpecFlow Parallel and non Parallel tests

2019-08-22 12:44发布

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条回答
成全新的幸福
2楼-- · 2019-08-22 12:53

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>
查看更多
登录 后发表回答