I was looking for a code coverage tool for Java based UI, I came across this tool – ECLEmma.
EclEmma is a free Java code coverage tool for Eclipse, available under the Eclipse Public License.
home page : http://www.eclemma.org/
Below are the steps that are to be followed to setup EclEmma for code coverage:
- Open Eclipse; Goto "Help->Software Updates->Find and Install" menu
- Click "Next >" In Install window and add a new remote site by clicking on "New Remote Site" button
- Enter any name and specify the URL as http://update.eclemma.org
- Click finish to search and install the EclEmma Java Code Coverage plug-in
- Restart Eclipse when prompted
- Now a new icon can be seen next to Run or Debug icons.
- Click on arrow next to Coverage icon and select "Open Coverage Dialog"
- Select “Eclipse Application” and click on “New” to create a new configuration.
- Goto "Coverage" tag and select only the packages in which the source for your feature is checked-in. You can contact the developer or see the folders in changelists to know the list of all packages used by the feature.
- Click on "Apply" after all the required packages are selected and then on "Coverage" button to launch your app in "Code Coverage" mode.
- Conduct Manual / Automated testing to cover the feature that you are trying to test and close your app.
- Now you can see a new tab with the name "Coverage" near "Console" or "Problems" tab
- Navigate to exact Java files where the source of your feature is written and check out the percentage of coverage done.
- You can double-click on Class or Function to navigate to corresponding Java file and see what parts of code were not exercised and write more test cases to cover the un-exercised code.
- You can export the whole of Coverage results to HTML format by right-clicking on any row and selecting "Export Session"
- You can have multiple sessions and then you can merge them together.