JSCoverage with automated scripts

Questions, problems, suggestions, bug reports, and so on.
Post Reply
4nit
Posts: 1
Joined: 2012-01-10 7:40 am

JSCoverage with automated scripts

Post by 4nit » 2012-01-10 7:44 am

I want to test the code coverage for one of the website. I have instrumented the javascripts and able to get the code coverage information using jscoverage.html. We have 100s of automated scripts (QTP scripts) to test the functionality and wanted to run all of them and get the code coverage at the end.
How can i integrate the jscoverage into these scripts ?

tessarakt
Posts: 3
Joined: 2012-06-07 10:24 pm

Re: JSCoverage with automated scripts

Post by tessarakt » 2012-06-07 10:46 pm

I adapted the approach from http://mercenary-code.blogspot.com/2010 ... enium.html .

The basic idea is to load run a HTML page and its scripts in a browser with Selenium WebDriver. Then a small script (the one used in that blog post is overly complicated, JSON.stringify() rules) hands the coverage information to the driver code, which can output in a well-known format (for CI integration), or just do whatever it likes to do.

There also is the jscoverage-server - I have not tried it, but you perhaps should take a look.

HTH,

Jens

Post Reply