Is there a way to document testNG testcases so that the documentation can be automatically generated? I would imagine something like:
@Description("This testcase checks, whether the system is alive")
@Step("Check whether services are running")
@Step("Try to access the system webpage")
...
@Test(groups={"sanity"})
public void checkStatus() {
...
}
I have considered two options: custom annotation processing and writing my own doclet for javadoc. Before I try any of these options, I would like to know, whether there is a standard way of doing it. I would definitely like to reuse current testNG annotations, especially the grouping of the tests.
Last but not least, I would like to mention that I want to use this approach only for system level tests (NOT unit tests), which I quite complex and where it is not so easy to say what the test does just from the test name or its code.
Finally, I figured it out myself. I use javadoc combined with a little bit of annotation processing (just to distinguish the testcase groups). I use a custom doclet, which first builds the list of testcases in the following way:
Then, for each test I retrieve the set of groups:
The rest is just standard doclet processing. In addition, I found out that I can use custom tags directly in javadoc, e.g.