user3896914
user3896914

Reputation: 9

Junit test suite execution programmatically

I want to build a tool in java, where I can see the progress of my Junit test suite execution. Like below.

  1. Current executing class.
  2. How many test cases completed(Passed, Failed)?
  3. How many test cases pending?

From this information, I want to build a graphical report.

How to start?

Upvotes: 1

Views: 228

Answers (1)

Jeff Bowman
Jeff Bowman

Reputation: 95614

The preferred external facade seems to be JUnitCore, which offers a series of useful run(...) overloads. Call JUnitCore.addListener with a RunListener implementation and you should be able to get the notifications you need.

Note that the total number of test cases pending may not be easy to get ahead of time; the test count is available as part of the Description object but by default JUnit doesn't seem to create all the runners and Descriptions until immediately before their run.

Upvotes: 4

Related Questions