0

我正在使用 SpecFlow 来自动化我的 Web 测试并使用并行执行来加速它们。

我遇到的问题是,如果在没有成功登录的情况下运行 3 次,一项检查无效密码被拒绝的测试将锁定用户帐户。

我已经将它们设置为在之后执行成功登录,但是并行运行意味着针对多个目标,它们同时运行并且仍然锁定帐户。

有没有办法可以将这个测试设置为不并行运行,这样它就不会锁定帐户并仍然允许其他人并行运行?

编辑——我使用 SpecRun 作为我的测试运行器

4

1 回答 1

1

我已经设法找到解决我的问题的方法。

通过将以下代码放在我的 srprofile 中,我可以标记我希望按顺序运行的测试,并且它们被迫只在特定线程中运行。

<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>
于 2017-10-17T10:54:58.473 回答