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.

  • Answers to this question are likely to be very subjective - perhaps you could reword to ask for advantages and disadvantages of tools that meet your requirements? – Kate Paulk Jul 14 '14 at 11:23
  • What is your definition of "best"? – Peter M. Jul 14 '14 at 18:21

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
  • 1
    Maybe code coverage should not be a metric goal for integration tests, but I think it could be a solid way to find gaps in your tests story coverage. This way you can identify important parts of the applications that lack test-cases. Certainly for relative large legacy applications that are moving to more agile princibles this can be a helpfull tool. – Niels van Reijmersdal Jul 14 '14 at 15:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.