|
Make your Testing
Infallible using Emma Code coverage tool
|
Make your Testing
Infallible using Emma Code coverage tool
For good client experience
and to ensure quality, our program must be tested thoroughly .We are often not
sure, if our test cases execute all of the modified code in the application.
Code coverage is a measure used in software testing. It describes the degree to
which the source code of a program has been tested. Code coverage is a software
engineering technique whereby we can track quality of our test plan/suite by
determining simple metrics like the percentage of {classes, methods, lines,
etc.} that were executed when the test plan/suite is executed.
Typical
Code Coverage Testing Lifecycle
Emma is a java based open
source, code coverage tool. Emma reports the percentage of code and the actual
lines of code that were executed in an html report. Based on the reports of
code coverage, development/QA can add more test cases to increase the coverage.
Emma helps to improve the quality of our test cases.
EMMA Code Coverage Life
Cycle:
1) Instrumentation
process: Emma adds some code to java classes, [this process is called
instrumentation.], when the code in the classes are executed. Output of this
process is instrumented application code & metadata file, used later to
generate the report. Application specific Meta file is created as a byproduct
of instrumentation. The Meta data file is combined with the coverage data file
to generate coverage reports. Meta data file is created at compile time.
We can enhance our build scripts (ant/ maven) to include
instrumentation process.
2) Run
your test cases.
3) Code
monitoring data is generated in-memory by EMMA as test cases are run on an
instrumented application. This data can be dumped onto the file system once
testing is complete. EMMA combines the Meta data and coverage data files to
generate the reports.
4) Run
the report.
5) Add
new test cases to your Test plan and repeat steps 2 to 4 to get better code
coverage.
Reasons
of choosing Emma over other Java code coverage tools.
1.
Emma supports html, xml & text report formats
2.
Emma injects minimal instrumentation byte code when compared to
other tools like Corbetura or Code Cover Emma’s instrumentation process is much
faster.
3.
Doesn’t force a test suite.
4.
Completely open-source and free tool.
5.
Is platform independent and works in any Java 2 JVM since 1.2
For
more info on Emma visit: http://emma.sourceforge.net/
What not to do with instrumented code?
Deploy
in UAT/ Production: instrumented applications can lead to larger memory usage
and performance issues. They should only be used in Dev/QA environments


No comments:
Post a Comment