I am encountering an issue with the ErrorCollector.getCollector().getCoppiedErrors().get(index) function in Katalon Studio. When I execute this function outside of a test case, it returns null, regardless of the index provided. However, when executed inside a test case, the function works as expected and provides errors based on the index.
I intended to use this function to retrieve all failures that I have captured and include them in a report outside of Katalon’s default reporting system. This approach was suggested due to an earlier defect I reported here, where Katalon suggested that an enterprise subscription would be necessary for support. However, this is a defect rather than a feature request, and I believe it should be addressed through community support.
The issue is critical for my reporting needs, and the current workaround does not resolve the problem effectively.
Steps to Reproduce:
Use the function ErrorCollector.getCollector().getCoppiedErrors().get(index) outside of any test case.
Observe that it returns null.
Use the same function inside a test case.
Observe that it works correctly and returns errors based on the index.
Expected Result:
The function should return errors as expected, whether executed inside or outside of a test case, allowing me to utilize it for comprehensive reporting.
Actual Result:
The function returns null when executed outside of a test case, hindering the intended use for reporting purposes.
Additional Information:
Katalon Studio Version: 9.0.0
OS: Windows 10
I would appreciate your assistance in resolving this issue as it impacts my ability to generate detailed reports. If any additional information or steps are needed, please let me know.
Then, inside a test case, how about copying the errors contained in the ErrorCollector to a GlobalVariable? Once you have copied the list of errors into a GlobalVariable, your reporting system can consume the GlobalVariable later as it wants to.
When I ran the Test Case, I got the following output in the console:
errors.size()=3
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='foo']' not found (Root cause: com.kms.katalon.core.exception.StepFailedException: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='foo']' not found
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
...
This proves that the Test Listener could see 3 Exceptions thrown by the Test Case.