0

I have a selenium framework in combination with TestNG.

Is it possible to export a list of all test names are their associated descriptions?

5
  • Can you give more information?
    – Sagar007
    May 26, 2015 at 5:34
  • Basically I want a list of all test cases within a project and their associated descriptions.
    – ECiurleo
    May 27, 2015 at 6:59
  • What do you mean by "their description"? How do you determine a test's description?
    – user246
    Mar 3, 2016 at 13:03
  • for example @Test(description = "Verify that page loads") be exported. Would help with the ease to read compared with the test name itself
    – ECiurleo
    Mar 3, 2016 at 16:20
  • I do not understand this part of the question: "Is it possible to export a list of all test names are their description within a project/suite?" Is there a typo in the sentence? If not, can someone explain what the sentence means? Does it supposed to be "Is it possible to export... all test names and their description...?"
    – user246
    May 1, 2016 at 18:52

2 Answers 2

1

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:

  1. Register which annotation types it wants the compiler to tell it about.
  2. Examine each annotation and each annotated element (class, method, ...) to learn detailed information.
  3. Write one or more files, with whatever output you want to write.

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).

0

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.

http://agile.csc.ncsu.edu/SEMaterials/tutorials/import_export/

1
  • I am afraid this does not offer a solution to my question. It simply allows me to export a file with the tests in.
    – ECiurleo
    Dec 3, 2015 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.