Search code examples
testingautomated-testsspecflowparallel-testingspecrun

SpecFlow Parallel and non Parallel tests


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


Solution

  • 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>