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.
@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.
a-ha…
String desc = RunConfiguration.getExecutionSourceDescription()
Now the question is: How to set the context? How to get a test suite description as opposed to a TC description?
We are working on custom reporting functions and we will take this into consideration.
I came up with something even better…
-
Using the Description property in a TC, fill it with a JSON object. You can add any information you think pertinent.
-
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.