How to add some description to be reflected in the reports

Is there a way to add some description/comments in the TestCases which are inside a TestSuite so that the description/comments can be shown in reports.
I need some details to be shown in reports so that a non-technical person can understand what the TestSuite is performing by reading those details.
If there is a way can someone please explain the workaround for that.

Not sure if this is what you were thinking, but you can use WebUI.comment(). In this case, I want an error message if the code above fails.

} catch (StepFailedException) {
WebUI.comment(“Warning: findTestObject(‘My Page/span_StaffName’) was not present”)

and in the report:

comment: Warning: findTestObject(‘My Page/span_StaffName’) was not present

1 Like

Thanks @helpdesk
Is there a way to get the TestObject dynamically in catch block instead of writing the try-catch block for each and every step in a static way, Because the testsuite had many testcases and it would be difficult to write that for each and every step.
Thanks in advance.

You want to use a built-in keyword WebUI.verifyElementPresent(TestObject, timeout, FailureHandling) and other keywords. They are designed for this need.