2017-10-12 86 views
0

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

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

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

有没有一种方法可以将此测试设置为不平行运行,因此它不会锁定帐户并仍然允许其他人同时运行?

EDIT--我使用SpecRun作为我的测试运行

+0

您可以在场景开始时创建新用户吗? –

+0

幸运的是,密码由我们无法连接的外部资源管理。我想我将不得不创建某种管理员对象,这个对象将持有一个测试,直到帐户准备好使用,但对于看起来很小的问题它有点矫枉过正。 当然,必须有办法将测试标记为不平行? – LiamHarries

回答

0

我设法找到一个解决办法,以我的问题。

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

<TestThreads> 
    <TestThread id="0"> 
     <TestAffinity>@Sequential | [email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="1"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="2"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="3"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="4"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="5"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="6"> 
     <TestAffinity>[email protected]</TestAffinity> 
    </TestThread> 
    <TestThread id="7"> 
     <TestAffinity>[email protected]ntial</TestAffinity> 
    </TestThread> 
    </TestThreads>