I have a selenium framework in combination with TestNG.
Is it possible to export a list of all test names are their associated descriptions?
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.Sign up to join this community
I did it with a Java annotation processor.
You can write a Java annotation processor that runs every time you compile your project. An annotation processor can:
If you write a processor that registers for
@Test annotations, the compiler will call the processor with information about every
@Test annotation found in the compiled files. If a given
@Test annotation has a description, the description is readily available to the processor, and your processor can write the descriptions (and whatever other information you desire) to an output file.
I wrote my annotation processor for a client, so I'm afraid I can't point you to the source code. And my quick scan of the internet (three minutes) doesn't turn up an obviously good tutorial. Sorry I can't give detailed guidance.
But look up Java annotation processing (in the Java 6+
javax.annotation.processing package, not the older, obsolete 'apt' stuff).
So if you use eclipse to handle your testing they use JUnit by default. If you right click in the "Package Explorer" whitespace you have the option to "Export". This pops a modal that allows you to grab whatever information you need and export it for viewing. Here is a link with some information, but with a few clicks I was able to export my test suite and its descriptions without any problems. Hope this answers your question.