0

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)

  • 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. - stands for Monica Jul 14 '14 at 18:21
1

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/

0

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.