I have created a global variable which saves the test status value and set the following script on the setupTestCase to check the status of the previous test until run
def setupTestCase() {
// Put your code here.
if(GlobalVariable.TestCaseStatus=="FAILED" || GlobalVariable.TestCaseStatus=="ERROR"){
KeywordUtil.markFailedAndStop('ERROR: The previous test fail')
}
}
The test case gets marked as fail but the .testCaseStatus() when the test end keeps throwing a “PASSED” status value!!
testCaseContext.skipThisTestCase() does skip the Test Case successfully. Thanks for the solution.
Immediately after the skipThisTestCase() call, I added the following statements.
def sts = testCaseContext.getTestCaseStatus()
println sts
It displayed the status as PASSED. I wonder even before executing the TC, how the status could become PASSED because sampleBeforeTestCase(…) is supposed to get executed before the Test Case