0

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

LiamHarries
  • 570
  • 1
  • 5
  • 20
  • Can you create a new user at the begin of the Scenario? – Andreas Willich Oct 12 '17 at 13:57
  • Unfourtunately not, the passwords are managed by an external source which we cannot interface with. I was thinking I will have to create some kind of manager object that will hold a test until the account is ready to use but its a bit overkill for what seems a minor issue. Surely there must be a way to flag a test as non parallel? – LiamHarries Oct 13 '17 at 07:09

1 Answers1

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>
LiamHarries
  • 570
  • 1
  • 5
  • 20