我想在测试失败时停止在Katalon Studio中执行测试套件。有人可以告诉我,如果我不熟悉此工具,是否可以在Katalon中实现?
展开this answer:
false
的全局变量(您需要在实际运行测试用例/套件之前执行此操作:GlobalVariable.SKIP_REMAINING_TESTS = ''
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
if(GlobalVariable.SKIP_REMAINING_TESTS==true){
testCaseContext.skipThisTestCase()
println "Test Case skipped"
}
}
@AfterTestCase
def sampleAfterTestCase(TestCaseContext testCaseContext) {
if(testCaseContext.testCaseStatus=='FAILED'){
GlobalVariable.SKIP_REMAINING_TESTS = true
}
}
[每次测试之前,@BeforeTestCase
将检查GlobalVariable.SKIP_REMAINING_TESTS
是否为真(默认情况下为false),并且将跳过该测试。在每次测试之后,如果测试用例失败,它将GlobalVariable.SKIP_REMAINING_TESTS
更改为true,并且该测试套件中的所有后续测试用例都将被跳过。