Cannot run test cases in console mode

Hi

I got exception when running test cases in console mode.

The test case id should match. Not sure why this is happening. Any help is appreciated. Thanks

Lloyd

Test Cases/TestRail Reporting/S326_Smoke and Sanity Tests/Details Page/TR18679_Enable Validation Delivery renders correctly FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Call Test Case 'Test Cases/Main Test Cases/S321_Main Page/Details Page/MTC18678_Enable Validation Delivery renders correctly' failed
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:63)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:75)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.execute(CallTestCaseKeyword.groovy:44)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.keyword.BuiltinKeywords.callTestCase(BuiltinKeywords.groovy:310)
at jdk.internal.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at TR18679_Enable Validation Delivery renders correctly.run(TR18679_Enable Validation Delivery renders correctly:20)
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:150)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:106)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:180)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1746730172621.run(TempTestSuite1746730172621.groovy:35)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: com.kms.katalon.core.exception.StepFailedException: Unable to verify object 'Object Repository/Integration Settings Detail Page/input_Connection Options_DeliveryEnabled' is checked
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:117)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:43)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementCheckedKeyword.verifyElementChecked(VerifyElementCheckedKeyword.groovy:92)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementCheckedKeyword.execute(VerifyElementCheckedKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementChecked(WebUiBuiltInKeywords.groovy:1436)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyElementChecked$9.call(Unknown Source)
at MTC18678_Enable Validation Delivery renders correctly.run(MTC18678_Enable Validation Delivery renders correctly:30)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(Sc
1 Like

To resolve the error when running test cases in console mode, follow these structured steps:

1. Fix Element Verification Failure

The error Unable to verify object '.../input_Connection Options_DeliveryEnabled' is checked indicates a failed check on an element’s state. Here’s how to address it:

a. Add Explicit Waits

Ensure the element is present and interactable before checking its state:

WebUI.waitForElementPresent(findTestObject('Object Repository/.../input_Connection Options_DeliveryEnabled'), 30)
WebUI.verifyElementChecked(findTestObject('Object Repository/.../input_Connection Options_DeliveryEnabled'), 10)

b. Verify Element Selector

  1. Open the object in the Object Repository.
  2. Use Spy Web Utility to validate the selector matches the element in the application.
  3. Update the XPath/CSS selector if the UI has changed.

c. Check Element State Programmatically

If the element’s checked state isn’t reflected in the HTML attribute, use JavaScript:

boolean isChecked = WebUI.executeJavaScript("return arguments[0].checked", 
  Arrays.asList(findTestObject('Object Repository/.../input_Connection Options_DeliveryEnabled')))
assert isChecked == true

2. Debug Test Case Dependencies

The error occurs in TR18679_Enable Validation Delivery renders correctly, which calls MTC18678_Enable Validation Delivery renders correctly. Ensure:

  • MTC18678 Runs Successfully Alone: Execute the called test case independently in console mode.
  • Shared Data/State is Reset: If MTC18678 modifies shared data (e.g., cookies, database), reset it before/after execution.

3. Configure Console Mode Properly

a. Use Headless Browser

In console mode, explicitly set headless Chrome:

WebUI.openBrowser('', ChromeDriver, [
  '--headless=new',
  '--disable-gpu'
])

b. Set Correct WebDriver Path

Ensure ChromeDriver matches the Chrome version in your CI/CD environment. Specify the path in Project Settings > Execution > Default > Web UI > Chrome.

4. Review Test Execution Logs

  1. Run tests with verbose logging:
katalon.exe -consoleLog -noSplash -runMode=console ... -logLevel=INFO
  1. Check console.log for:
  • Network errors (e.g., timeouts, 404s).
  • Browser/driver compatibility issues.

5. Update Katalon & Dependencies

  1. Upgrade to the latest Katalon Studio (e.g., v9.10+).
  2. Refresh project dependencies:
  • Delete bin, Libs, and .gradle folders.
  • Restart Katalon and refresh the project.

6. Sample Corrected Test Case

// TR18679_Enable Validation Delivery renders correctly
WebUI.waitForElementPresent(findTestObject('Object Repository/.../input_Connection Options_DeliveryEnabled'), 30)
WebUI.verifyElementChecked(findTestObject('Object Repository/.../input_Connection Options_DeliveryEnabled'), 10)

Key Fixes

  • Waiting for Elements: Prevents race conditions in headless/CI environments.
  • Selector Validation: Ensures UI changes don’t break tests.
  • Isolated Test Execution: Verifies dependencies work independently.