How do I setup an Ant task to generate Emma code coverage reports?
相关问题
- CA0001: Object reference not set to an instance of
- How can I have my ant task pass or fail based on t
- Ant inheriting Maven properties
- How can I zip multiple folders individually with a
- Class in jar not found at runtime, but was used to
相关文章
- Passing command line arguments to Java via ant bui
- What is the best way to cleanup the resources used
- ANT - Could not load a dependent class com/jcraft/
- library resolve to a path with no project.properti
- ant file that depends on another ant file
- android-sdk/tools/ant/build.xml:698: null returned
- ant jar's mainclass
- Integrate Ant builder into Eclipse: Error “Variabl
To answer questions about where the source and instrumented directories are (these can be switched to whatever your standard directory structure is):
Classpaths:
First you need to setup where Ant can find the Emma libraries:
Then import the task:
Then instrument the code:
Then run a target with the proper VM arguments like:
Finally generate your report:
Emma 2.1 introduces another way of obtaining runtime coverage information (.ec file). One can remotely request the data from the given port of the computer where an instrumented application is runnig. So there's no need to stop VM.
To get the file with runtime coverage data you need to insert the following snippet in your Ant script between running of your tests and generating coverage report:
Other steps are similar to Emma 2.0. They are perfectly described in previous post
More information on Emma 2.1 features: http://sourceforge.net/project/shownotes.php?group_id=108932&release_id=336859
The User Guide has a good example of how to set up your build script so that you not only seperate the instrumented code from the execution, but it's also all contained in the same
<target>
so that you don't have to run a series of different targets, but instead you can just do something likeant emma tests
(ifant tests
was how you normally ran your unit tests, for example).Here's their example: