0

I have not found any related searches to my problem here and hence Im writing this one.

I have a JUnit Class

MyHandler Class with tests - testx,testy,testz

that calls other JUnit Classes

MyTestA, MyTestB classes each having tests

based on some logic

MyTestA has tests - testa1, testa2, testa3
MyTestB has tests - testb1, testb2, testb3

Everything works fine, except that the report shows only 3 tests executed (testx,testy,testz) - Though all the tests in MyTestA, MyTestB are also executed, they are not part of the report. I see this when using Junit reporting using ant and also in Eclipse IDE.

Within MyHandler Class, I am calling the JUnit classes as ,

org.junit.runner.JUnitCore.runClasses(MyTestA)
org.junit.runner.JUnitCore.runClasses(MyTestB)

Is there anyway, we can include the individual called junit tests in the Junit report? We are using ant to build along with junit reporting.

Appreciate any help on this, Sudhakar

1 Answers1

0

JUnit will only report on the structure it knows about, so use a JUnit test suite (Junit4 Test Suites). You can list all the test classes and JUnit will run them and also include them in the report.

Community
  • 1
  • 1
Joe
  • 29,416
  • 12
  • 68
  • 88
  • The problem is I already have JUnit Test Suite calling MyHandler (There are more than one MyHandler). In fact, I have JUnit Test Suite that calls different MyHandlers and each MyHandler in turn calls the JUnit Classes MyTestA, MyTestB . So only the MyHandler tests - testx,testy,testz are part of the report, though testa1,testa2,testa3, testb1,testb2,testb3 are run successfully. Can you please let me know if there is any way we can include the called tests inside the report? Thanks, Sudhakar – Sudhakar Betha Aug 07 '13 at 15:17
  • Create a suite that directly includes `MyTestA` and `MyTestB`, rather than calling `runClasses`. – Joe Aug 08 '13 at 10:40