Hi
Does anyone know if there is a way to set the status of a testcase to failed even if it passed?
You can force a Test Case to stop with this keyword:
/**
* Debugging helper.
*
*/
static void FORCESTOP(String msg = "") {
WebUI.comment("FORCESTOP..." + msg)
throw new StepErrorException("FORCESTOP" + (msg ? ": " + msg : ""))
}
You can post a failure message and stop the TestCase with this…
/**
* Prints a failure message to the KS log and stops the test.
* @param msg (String) The content of the message.
*/
static void markFailed(String msg) {
KeywordUtil.markFailedAndStop(msg)
throw new StepErrorException(msg)
}
1 Like
You want StepFailedException
, not StepErrorException
.
The code will require an import statement:
import com.kms.katalon.core.exception.StepFailedException
1 Like