How to get The Project description in the After Test Suite

TestCaseContext is used to get the testCase status and Test caseId , but there is no method to get the description. As I am creating a custom excel report with Test Case Name, Status and Description.

1 Like

@devalex88 Is there any reason why the description property can’t be added to testCaseContext? Like the OP intimated, it would be very useful for people that produce their own reports.

image

1 Like

a-ha…

String desc = RunConfiguration.getExecutionSourceDescription()

https://api-docs.katalon.com/com/kms/katalon/core/configuration/RunConfiguration.html#getExecutionSourceDescription()

Now the question is: How to set the context? How to get a test suite description as opposed to a TC description?

1 Like

We are working on custom reporting functions and we will take this into consideration.

1 Like

I came up with something even better…

  1. Using the Description property in a TC, fill it with a JSON object. You can add any information you think pertinent.

  2. In beforeTestCase (or similar), read the TestCase.tc file (xml) and parse the JSON description property.

At the time of writing, my Description fields contain something like this:

{
  "bugid": "12345",
  "comments": "blah blah...",
  "tc-before": [
    "Test Cases/Pages/SomePage/Test SomePage", "com.abc.SomePage"
  ],
  "tc-after": [
    "Test Cases/Pages/SomeOtherPage/Test Some Other Page", "com.abc.SomeOtherPage"
  ]
}

I wrote a wrapper for callTestCase called runTC which instantiates the class objects (e.g. com.abc.SomePage) and runs the tc-before and tc-after TCs. The nice thing is it allows chaining (because runTC is recursive).

I have ideas for other properties I can add to the JSON but I need to do a few POCs first.
And of course, rewriting the .tc file is easily achieved “offline” too. I’m considering rewriting them from my bugtracker software.