I have an automation framework based out of Selenium Web driver. I want to find out the extent to which automated test scenarios covers various sections of code. Can some one please suggest a code coverage tool for web application.(Preferably a tool which gives a report captures the sections of code which is not tested or less tested)
closed as primarily opinion-based by Kate Paulk♦, corsiKa♦ Jul 14 '14 at 19:16
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
I think you should be able to use JaCoCo to gather coverage of the backend, but there are more coverage tools for Java see: http://en.wikipedia.org/wiki/Java_Code_Coverage_Tools
Process looks something like this:
- Start application with coverage tool enabled
- Run tests against web-app instance
- Generate report of coverage files
See this article about integrating Jenkins, Sonar and JaCoco to get and report on code coverage of a Java web-app: http://deors.wordpress.com/2012/02/02/selenium-webdriver-grid-3/
Selenium WebDriver does not test code in the same way as a kit like JUnit. Code coverage tools are not an exact science even for unit tests. With Selenium WebDriver you are testing the views of an application. You could potentially look at the code in your views that are covered in you WebDriver tests and estimate how much code is covered. However I would consider this to be a useless metric.
I would measure my WebDriver tests in terms of stories or actions. e.g.
- Tests cover adding a user
- Tests cover creating a document
- Tests do not cover editing a document