Page 1 of 1

example-jsunit: coverage report shows JsUnit-API

Posted: 2010-03-24 11:35 am
by shirerom
When I try to create a coverage report from the jsunit example that comes with version 0.4 the report shows the coverage of the JsUnit-API.

I proceed like this:

1. instrumenting

Code: Select all

root@GranImmobi:/usr/local/src/jscoverage-0.4# jscoverage --verbose --no-instrument=jsunit doc/example-jsunit doc/instrumented-jsunit
Instrumenting file jsunit/licenses/index.html
Instrumenting file jsunit/licenses/lgpl-2.1.txt
Instrumenting file jsunit/licenses/mpl-tri-license-html.txt
Instrumenting file jsunit/licenses/mpl-tri-license-c.txt
Instrumenting file jsunit/licenses/Jetty_license.html
Instrumenting file jsunit/licenses/MPL-1.1.txt
Instrumenting file jsunit/licenses/gpl-2.txt
Instrumenting file jsunit/licenses/JDOM_license.txt
Instrumenting file jsunit/css/jsUnitStyle.css
Instrumenting file jsunit/readme.txt
Instrumenting file jsunit/images/powerby-transparent.gif
Instrumenting file jsunit/images/logo_jsunit.gif
Instrumenting file jsunit/images/red.gif
Instrumenting file jsunit/images/green.gif
Instrumenting file jsunit/app/main-counts-errors.html
Instrumenting file jsunit/app/main-counts.html
Instrumenting file jsunit/app/main-results.html
Instrumenting file jsunit/app/main-counts-failures.html
Instrumenting file jsunit/app/css/jsUnitStyle.css
Instrumenting file jsunit/app/css/readme
Instrumenting file jsunit/app/jsUnitTestManager.js
Instrumenting file jsunit/app/jsUnitTracer.js
Instrumenting file jsunit/app/main-errors.html
Instrumenting file jsunit/app/main-data.html
Instrumenting file jsunit/app/main-counts-runs.html
Instrumenting file jsunit/app/jsUnitCore.js
Instrumenting file jsunit/app/main-status.html
Instrumenting file jsunit/app/jsUnitMockTimeout.js
Instrumenting file jsunit/app/emptyPage.html
Instrumenting file jsunit/app/jsUnitVersionCheck.js
Instrumenting file jsunit/app/xbDebug.js
Instrumenting file jsunit/app/main-frame.html
Instrumenting file jsunit/app/testContainer.html
Instrumenting file jsunit/app/testContainerController.html
Instrumenting file jsunit/app/main-loader.html
Instrumenting file jsunit/app/main-progress.html
Instrumenting file jsunit/app/jsUnitTestSuite.js
Instrumenting file jsunit/testRunner.html
Instrumenting file test.html
Instrumenting file script.js
I check some files of the JsUnit-API and they are not intrumented like script.js is.


2. starting the server

Code: Select all

root@GranImmobi:/usr/local/src/jscoverage-0.4# cd doc/instrumented-jsunit/
root@GranImmobi:/usr/local/src/jscoverage-0.4/doc/instrumented-jsunit# jscoverage-server --verbose
Starting HTTP server on 127.0.0.1:8080
3. starting the test

I put this URL into Firefox

Code: Select all

http://127.0.0.1:8080/jsunit/testRunner.html?testPage=http://127.0.0.1:8080/test.html&autoRun=true
The output of jscoverage-server:

Code: Select all

GET /jsunit/testRunner.html?testPage=http://127.0.0.1:8080/test.html&autoRun=true HTTP/1.1
GET /jsunit/app/xbDebug.js HTTP/1.1
GET /jsunit/app/jsUnitCore.js HTTP/1.1
GET /jsunit/app/jsUnitTestManager.js HTTP/1.1
GET /jsunit/app/jsUnitTracer.js HTTP/1.1
GET /jsunit/app/jsUnitTestSuite.js HTTP/1.1
GET /jsunit/app/main-frame.html HTTP/1.1
GET /jsunit/app/main-loader.html HTTP/1.1
GET /jsunit/app/testContainer.html HTTP/1.1
GET /jsunit/app/main-data.html HTTP/1.1
GET /jsunit/app/main-status.html HTTP/1.1
GET /jsunit/app/main-progress.html HTTP/1.1
GET /jsunit/app/main-counts.html HTTP/1.1
GET /jsunit/app/main-results.html HTTP/1.1
GET /jsunit/app/main-errors.html HTTP/1.1
GET /jsunit/app/testContainerController.html HTTP/1.1
GET /jsunit/app/emptyPage.html HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/app/jsUnitCore.js HTTP/1.1
GET /jsunit/images/green.gif HTTP/1.1
GET /jsunit/app/main-counts-runs.html HTTP/1.1
GET /jsunit/app/main-counts-errors.html HTTP/1.1
GET /jsunit/app/main-counts-failures.html HTTP/1.1
GET /jsunit/app/jsUnitVersionCheck.js HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/images/logo_jsunit.gif HTTP/1.1
GET /jsunit/images/powerby-transparent.gif HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /jsunit/css/jsUnitStyle.css HTTP/1.1
GET /test.html?cacheBuster=1269429356997 HTTP/1.1
GET /jsunit/app/jsUnitCore.js HTTP/1.1
GET /script.js HTTP/1.1
POST /jscoverage-store HTTP/1.1
Warning: invalid source path: script.js
GET /jsunit/app/emptyPage.html?cacheBuster=1269429357102 HTTP/1.1
4. showing the coverage report

Clicking on the Button "Coverage report" show this:
Coverage Report
Coverage Report
jscoverage.png (47.58 KiB) Viewed 31391 times
It shows all JS-files of the JsUnit-API and script.js twice. Where is the mistake?

Re: example-jsunit: coverage report shows JsUnit-API

Posted: 2010-03-24 10:21 pm
by Ed
The "jscoverage" program and the "jscoverage-server" program are mutually exclusive; you need to use one or the other, but not both. If you use the "jscoverage" program, then you should just use an ordinary web server to run the tests (or use a file:/// URL). If you use the "jscoverage-server" program, there is no need to instrument the code beforehand.

Re: example-jsunit: coverage report shows JsUnit-API

Posted: 2010-03-25 9:57 am
by shirerom
Man, that was easy.

Thank you very much!!! :)


PS: You should mention the mutually exclusiv thing in the FAQ.