0

下面是我的测试用例,

Public static void SampleTest() 
{
    // Pre conditions for both assert 1 and 2
    if(condition1)
    {
        // Assert 1
    }
    // Pre condition for Assert 2
    // Assert 2
}

一旦满足条件 1 并执行断言 1,我不想执行上述测试用例中的进一步语句。另一方面,如果条件 1 失败,它应该执行断言 2 的前置条件,并应该根据断言 2 发布结果

提前致谢。

4

1 回答 1

1

您可以简单地调用return;after Assert 1

Public static void SampleTest() 
{
    // Pre conditions for both assert 1 and 2
    if(condition1)
    {
        // Assert 1
        return;
    }
    // Pre condition for Assert 2
    // Assert 2
}
于 2014-09-08T12:57:44.843 回答