code coverage

AnjaliW
AnjaliW used Ask the Experts™
on
Few questions which I am confused with:

1.Does code coverage happens  on JUNIT Classes?
2.If so ,then will it give all report where that JUNIT invokes other java sources.
3.If I am running Junit and then need to do code coverage on that testclass what should I have to DO?
4.Which command to execute to get code coverage of that JUNIT.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
>>1.Does code coverage happens  on JUNIT Classes?

basically it checks how much actual code is tested/invoked by unittests.

>>2.If so ,then will it give all report where that JUNIT invokes other java sources.

depends the tool you use

>>3.If I am running Junit and then need to do code coverage on that testclass what should I have to DO?

there are bunch of free and proprietary code coverage tools, EMMA is such one search google and choose the best one fit for you.

4.Which command to execute to get code coverage of that JUNIT

Author

Commented:
As said ..it checks actual sources has been covered  by test.
If I provide jar's of sources in there dependencies..then will it still do coverage of that classes inside jars. or it requires classes "target/classes/..." to instrument those classes.

In my scenario...it is not creating coverage report at target/cobetura directory...says no classes for instrumentation........

I am using Cobertura plugin....
as I can see you are using maven for your build. In that case simplest way is to use cobertura maven plugin http://mojo.codehaus.org/cobertura-maven-plugin/usage.html . just try to execute:
mvn clean cobertura:cobertura install

Author

Commented:
thx!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial