Reputation: 3293
How can i generate an javascript test coverage using jstestdriver?
I am able to run the javascript test using jstestdriver. I want to generate a coverage report to check how much percentage of javascript files i have tested.
I have read through this website http://code.google.com/p/js-test-driver/wiki/CodeCoverage and followed the instructions provided. However, i still can not get a coverage report.
My folder struture right now is and the relevant files i have imported for coverage report:
-trunk
-app
-test
-lib
-jstestdriver
-javascipt (includes coverage.js, CoverageTest.js, Instrumentable.js, plugin.js)
-plugins (includes coverage.jar)
-unit
-controllerSpecs.js
-config
-coverage.conf
-scripts
- test-server.sh
- test.sh
- web-server.js
In my coverage.conf, I have the following content:
server: http://localhost:9876
load:
- test/lib/jstestdriver/javascript/coverage.js
- test/lib/jstestdriver/javascript/CoverageTest.js
- test/unit/*.js
plugin:
- name: "coverage"
jar: "test/lib/jstestdriver/plugins/coverage.jar"
module: "com.google.jstestdriver.coverage.CoverageModule"
exclude:
Thank you in advance for your help=)
Upvotes: 4
Views: 1145
Reputation: 3369
It didn't work as expected for me either, but now it does. I'm not sure why but I think all I changed was the whitespace in the config file:
plugin:
- name: "coverage"
jar: "coverage-1.3.4.b.jar"
module: "com.google.jstestdriver.coverage.CoverageModule"
Note: the .dat file which was generated was empty the first time I ran this.
(I have the CodeCoverage jar in the same directory as the .conf file)
Upvotes: 2