假设我有 10 个测试用例,并且Exception
发生在其中的第二个上。在它发生之后,其余的测试将不会开始。发生后如何继续运行测试Exception
?
问问题
78 次
1 回答
0
在 catch 块中添加其他测试用例。
假设异常将在第二个测试用例中发生,那么您可以在该 catch 块中添加剩余的测试用例。
有时我们需要在获取异常或缓存异常后使用一些功能。
您可以为此使用 Catch 块。
try{
testcase1
testcase2
.
.
.
.
testcase10
}
catch(Exception e)
{
if(testcase1.isExecute()||blaa || blaa)
{
//you have something to check here which testcases have exception or which testcase is executed
run your rest of test cases.
testcase7
.
.
testcase10
}
此代码可能对您有所帮助。这只是逻辑,你需要做的实现..
于 2013-03-01T11:19:07.973 回答