jeudi 3 mars 2016

Get list of JUnit test Classes from the source code context in Java

In order to generate some test documentation, I would like to get a list of JUnit test classes in the project. Assume, we have the following project structure.

project/
  src/
    Main.java
  test/
    XTest.java
    YTest.java

The Main.java file should be able to read all the test classes (i.e. XTest and YTest) in order to extract all the test methods. The usual suspects like Package.getPackage() do not seem to work on test classes, but only on the actual source code.

How can I accomplish that?





Aucun commentaire:

Enregistrer un commentaire