我们正在使用mbunit gallio和[TestFixture,Parallelizable] testfixtures和[Test(Order = X),Parallelizable]测试属性,除了我们应用的X值,无论测试顺序被有效忽略,它都能正常工作,这只是似乎不会影响测试的执行顺序。我们在这里做错了吗,使用[Test(Order)]有什么特别的技巧,还是因为我们使用的是Parallelizable?
示例:
[TestFixture, Parallelizable]
public class SignUpTests : BaseTest
{
[Test(Order = 2), Parallelizable]
public void SignUpProcessShouldBeEndedWithConfirmationPageAndWelcomeEmailSent()
{
blah-blah-blah;
blah-blah-blah;
}
// we expect this test to be executed before SignUpProcessShouldBeEndedWithConfirmationPageAndWelcomeEmailSent()
// but it's not the case
[Test(Order = 1), Parallelizable]
public void SignUpProcessShouldCompleteAndProvisionedServicesStatusUpdated()
{
blah-blah-blah;
blah-blah-blah;
}
答案 0 :(得分:0)
尝试DependsOn属性,说“测试用例1”取决于“测试用例2”,测试用例2将首先执行,之后测试用例1将被执行。
答案 1 :(得分:0)
Include 'MbUnit.Framework.TestSequence(1)' and use ProcessTextFixture instead of TextFixture.
[ProcessTextFixture]
public class TestSequeunce
{
[MbUnit.Framework.TestSequence(1)]
[TEST]
public void TestMethod1()
{
}
[MbUnit.Framework.TestSequence(2)]
[TEST]
public void TestMethod1()
{
}`enter code here`
}