2

我们将 mbunit gallio 与 [TestFixture, Parallelizable] 测试装置和 [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;

    }
4

2 回答 2

0

试试 DependsOn 属性,说“测试用例 1”依赖于“测试用例 2”,测试用例 2 将首先执行,然后测试用例 1 将被执行。

于 2012-12-26T06:59:58.543 回答
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`
}
于 2016-12-21T08:23:04.923 回答