The function "testCaseContext.message" only returns one error for a test case

Hello Dears,
Have a good day.

I have discovered an issue in katalon, in which test listener @AfterTestCase parameter (testCaseContext) only returns a single error when using the function testCaseContext.message.
When I print a message only one exception error is displayed in the console:

Message:::Test Cases/x FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Object Object Repository/HomePage/NavigationBar/moreButton not found
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:39)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.doCall(TapKeyword.groovy:79)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.call(TapKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.tap(TapKeyword.groovy:84)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.execute(TapKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tap(MobileBuiltInKeywords.groovy:1476)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tap$0.call(Unknown Source)
	at x.run(x:40)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.common.CommonExecutor.accessTestCaseMainPhase(CommonExecutor.java:65)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:148)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:106)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:187)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1709660672431.run(TempTestSuite1709660672431.groovy:36)
 end of error message

Where the console shows all errors:

2024-03-05 20:45:39.815 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Object Object Repository/WMV/MoreOptionPage/settingsButton not found
com.kms.katalon.core.exception.StepFailedException: Object Object Repository/HomePage/NavigationBar/moreButton not found
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:39)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.doCall(TapKeyword.groovy:79)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.call(TapKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.tap(TapKeyword.groovy:84)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.execute(TapKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tap(MobileBuiltInKeywords.groovy:1476)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tap$0.call(Unknown Source)
	at x.run(x:40)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.common.CommonExecutor.accessTestCaseMainPhase(CommonExecutor.java:65)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:148)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:106)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:187)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1709660672431.run(TempTestSuite1709660672431.groovy:36)


Test Case code
Mobile.startExistingApplication('com.xr.consumer.sit')
String moreButtonSource = "Object Repository/HomePage/NavigationBar/moreButton";
TestObject moreButton = findTestObject(moreButtonSource)
Mobile.tap(moreButton, 5, FailureHandling.CONTINUE_ON_FAILURE)

String settingOptionSource = "Object Repository/WMV/MoreOptionPage/settingsButton";
TestObject settingOption = findTestObject(settingOptionSource)
Mobile.tap(settingOption, 5, FailureHandling.CONTINUE_ON_FAILURE)
Tes Listener AfterTestCase code
@AfterTestCase

def sampleAfterTestCase(TestCaseContext testCaseContext) {
		

    String msg = testCaseContext.getMessage()
    System.out.println("Message:::" + msg + " end of error message");

	 }
1 Like

??? I can find only one error in the text you attached as “the console”. Your explanation does not make sense to me.

Sorry kazurayam, i didn’t add it by mistake.
These are the exceptions that can be displayed to the console when not able to click on item since it’s not existed:

com.kms.katalon.core.exception.StepFailedException: Object Object Repository/HomePage/NavigationBar/moreButton not found
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:39)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.doCall(TapKeyword.groovy:79)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.call(TapKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.tap(TapKeyword.groovy:84)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.execute(TapKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tap(MobileBuiltInKeywords.groovy:1476)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tap$0.call(Unknown Source)
	at x.run(x:31)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1710145272702.run(TempTestCase1710145272702.groovy:25)

2024-03-11 11:21:44.227 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Object Object Repository/WMV/MoreOptionPage/SettingsPage/logoutButton not found
2024-03-11 11:21:44.230 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/x FAILED.

And this is the error message I print it using testcaseContext.message, in which only return one error not both errors mentioned above(just first issue founded by test case):

com.kms.katalon.core.exception.StepFailedException: Object Object Repository/HomePage/NavigationBar/moreButton not found
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:39)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.doCall(TapKeyword.groovy:79)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.call(TapKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.tap(TapKeyword.groovy:84)
	at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.execute(TapKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tap(MobileBuiltInKeywords.groovy:1476)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tap$0.call(Unknown Source)
	at x.run(x:31)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1710145272702.run(TempTestCase1710145272702.groovy:25)

@osamazaza200

Thank you for providing more information.

I tried to reproduce your issue on my side, and YES I could see a similar incident. The string value returned by testCaseContext.message() contains only 1 StackTrace even if the problem TestCase threw 2 Exceptions during a run. The string returned by testCaseContext.message() did not contain the 2nd StackTraces. Yes, you found a fact.

It seems that the TestCase runner skipped the 2nd StackTrace. I have no idea why. I just guess that Katalon Studio is implemented as such.

And, to be honest, I would not mind this behavior much. To have 0 failure or 1+, that is the question for me. I would not need to see 2 or more failures reported by a buggy TestCase at once, as I would only be able to tackle one-by-one at a time.

If I see 2 or more StackTrace messages appended together, I would rather be bothered with a bulky set of lines; I would have to start with trying to find the boundaries and splitting the lines into a series of Exceptions. It would be tiresome. I wouldn’t like it.

Thank your kazurayam for your comment and support,
I see that it’s a defect because most of test cases can include multiple UI items[buttons, labels] and etc, and any deviation for any item will be reported an exception in console, and thus, in our single test case we can have more than one issues.

If you are a paying Enterprise user, then you should raise an official support request to let Katalon acknowledge the defect.

They would not notice your voice burried in this user forum.

@Elly_Tran

Hi,

Thank you so much for letting us know about this issue. Can you please provide us with more details about your version, your device, expected outcome, … I will create a ticket for the team to investigate more and I will update you soon if anything new. Thank you!

Thank you for reaching us !
Device: Lenovo thinkpad
Expected Ressult: as I am tester, i am expected to see all issues when using parameter “testCaseContext.message” for function listener @AfterTestCase

Actual Ressult: when a test case fails, there maybe one one issue existed like button x, y not clickable or founded, and message only show the first error message of test case.

Hello @Elly_Tran,
Is there any progress about the ticket raised ?
Best Regards,

Hi,

Which OS version are you using as well as the Katalon version? Sorry for the late response.

No issues,
Windows 11
Katalon Version: 8.6.8

Hi,

Can you please help update Katalon to a newer version? Thank you