2

Is there a way to run Selenium WebDriver tests in a browser (or just run a test scenario manually in a browser), and get the code coverage of the web-app written in JavaScript? Are there any other code coverage tools except JSCover that can do such task?

jacefarm
  • 6,747
  • 6
  • 36
  • 46
john06
  • 21
  • 2

1 Answers1

1

Is there a way to run Selenium WebDriver tests in a browser (or just run a test scenario manually in a browser), and get the code coverage of the web-app written in JavaScript?

JSCover can when run in proxy mode (without HTTPS). A more robust approach would be to pre-instrument your JS before running your tests, which can be done by JSCOver and other tools (see answer to second question).

JSCover can also save data between pages using local-storage which can be useful for re-using existing selenium suites.

You'll need to add some code to the end of your tests to save the coverage data. To do that with JSCover, see http://tntim96.github.io/JSCover/manual/manual.xml#fileSystemSave.

Are there any other code coverage tools except JSCover that can do such task?

There is also Istanbul and BlanketJS which may be able to be used with the pre-instrumentation approach.

tntim96
  • 331
  • 2
  • 2