Reports are not showing accurate

Hello Friends,

I have multiple test cases called into 1 test cases with few steps. If any of the child test case is failed inside the parent test case, parent test case is showing as Passed in HTML report. Am I missing any setting or how to show this test case as Failed?

Thanks in Advance

Regards
Usekatalon

1 Like

Do you have a “FailureHandling.STOP_ON_FAILURE” option as the last parameter in your “callTestCase” statement?

example:

import com.kms.katalon.core.model.FailureHandling as FailureHandling

WebUI.callTestCase(findTestCase('TestCaseA'), [:], FailureHandling.STOP_ON_FAILURE)

Yes I do have both the above mentioned statements.

have you used any if condition inside your child test case?

yes I am using the if condition in some cases and no condition in some cases i.e. its a normal test case where i validating the text using verifyElementPresent keyword.

Here is the scenario to use the if condition:
we are displaying the data in table grid. hence using the if else condition to validate for no records found and data present or not.

Can someone please help me on this?

What you can try if you want one of your child TestCases to stop the whole test if to surround the called Test Case with a “try / catch” and within the catch block you have something that kills your test. As an example:

try {
    WebUI.callTestCase(findTestCase('...'
} catch (Exception) {
    WebUI.comment("The test is dead")
    WebUI.verifyTextPresent("Martin is king.", false, FailureHandling.STOP_ON_FAILURE)
}

Also, note that the statement callTestCase returns an Object, so you could also play with that, like:

testResult = ""
testResult = WebUI.callTestCase(findTestCase('...'

if (testResult != "Run Okay") {
    WebUI.comment("The test is dead")
    WebUI.verifyTextPresent("Martin is king.", false, FailureHandling.STOP_ON_FAILURE)
}

and the last statement on your child Test Cases is:
return "Run Okay"

There are probably other ways but here are a couple you can try.

Edit: You have to note that your report will show the position where the statement that you used caused the test to stop, like my “Martin is king”, whereas you will have to know that it was a result of the callTestCase that actually did the deed.

Edit2: you can also use a GlobalVariable that has a phrase that you can monitor.

GlobalVariable.gStatus = ""
WebUI.callTestCase(findTestCase('...'

if (GlobalVariable.gStatus != "Good") {

and the last statement on your child Test Cases is:
GlobalVariable.gStatus = "Good"

Thanks Grylion for the answer.

unfortunately none of the option worked out.