James Raitsev
James Raitsev

Reputation: 96491

jUnit: How to determine level of code coverage?

How can i determine what percentage of my methods (and code) are covered by jUnit tests? I am assuming there is a more sophisticated way then simply counting ... and 1 and 2 and ..

I specifically wonder how will such counting be handled when single method is covered by 'n' tests.

Upvotes: 39

Views: 59036

Answers (3)

Ankit Bansal
Ankit Bansal

Reputation: 5072

I would suggest to go for Cobertura for code coverage. It gives detailed information and can give you line by line coverage as well as branch coverage.

Upvotes: 3

Alex Martelli
Alex Martelli

Reputation: 882481

This presentation points to several tools you can use for the purpose.

Upvotes: 3

quamrana
quamrana

Reputation: 39404

I've used EclEmma very successfully to cover JUnit test runs. And its free.

Upvotes: 39

Related Questions