JSCoverage with JSUnit
JSCoverage with JSUnit
Hello,
I want to run JSUnit on jscoverage instrumented code. My .js files are in c:/ my .html files which using .js files are in D:/
Can I use jscoverage-server for this operation. I want to store coverage report in an html file. I am asking if relative paths ok inside instrumented js files.
Thanks,
LowerEastSide
I want to run JSUnit on jscoverage instrumented code. My .js files are in c:/ my .html files which using .js files are in D:/
Can I use jscoverage-server for this operation. I want to store coverage report in an html file. I am asking if relative paths ok inside instrumented js files.
Thanks,
LowerEastSide
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: JSCoverage with JSUnit
Do you have a reference to the C: drive hard-coded in your HTML files, like this?
If so, you will not get any code coverage statistics, because your HTML files will always be referring to the un-instrumented code.
Code: Select all
<script src="file:///C:/script.js"></script>
Re: JSCoverage with JSUnit
Hello,
I am able to run JSUnit with Instrumented Code. While JSUnit suite is running I see "Coverage" button on the IE. If I click that button a new IT window pops up and I could see the coverage data. What can I do to make sure after the test is run coverage data is stored in an HTML file.
Thanks,
LowerEastSide
I am able to run JSUnit with Instrumented Code. While JSUnit suite is running I see "Coverage" button on the IE. If I click that button a new IT window pops up and I could see the coverage data. What can I do to make sure after the test is run coverage data is stored in an HTML file.
Thanks,
LowerEastSide
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: JSCoverage with JSUnit
Are you using the jscoverage-server.exe program now? Or are you using the jscoverage.exe program to create instrumented files?
Re: JSCoverage with JSUnit
Hello, I am using jscoverage.exe to instrument files and then running jsunit on that.
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: JSCoverage with JSUnit
In order to save a coverage report, you will have to use jscoverage-server.exe instead of jscoverage.exe.
In order for this to work, you will have to access all your files via jscoverage-server - e.g., you can't have any references to file:/// URLs hard-coded in your HTML.
In order for this to work, you will have to access all your files via jscoverage-server - e.g., you can't have any references to file:/// URLs hard-coded in your HTML.
-
- Posts: 6
- Joined: 2009-04-06 3:19 pm
Re: JSCoverage with JSUnit
Hello,
Can you please point out to an example where JSUnit works with jscoverage-server.exe?
Please tell me if the following steps good
a) Copy all .js files inside jscoverage-server
b) start jscoverage-server.exe
c) change html files to get .js files from jscoverage-server
d) run jsunit and do coverage-report()
Regards,
LowerEastSide
Can you please point out to an example where JSUnit works with jscoverage-server.exe?
Please tell me if the following steps good
a) Copy all .js files inside jscoverage-server
b) start jscoverage-server.exe
c) change html files to get .js files from jscoverage-server
d) run jsunit and do coverage-report()
Regards,
LowerEastSide
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: JSCoverage with JSUnit
There is an example for JSUnit in the doc/example-jsunit directory of the JSCoverage distribution. You can run this:lowerEastSide wrote:Hello,
Can you please point out to an example where JSUnit works with jscoverage-server.exe?
Code: Select all
jscoverage-server.exe --verbose --document-root=doc/example-jsunit
Code: Select all
http://127.0.0.1:8080/jsunit/testRunner.html?testPage=http://127.0.0.1:8080/test.html&autoRun=true
That looks about right ... are there any differences between what you are doing and the doc/example-jsunit example?lowerEastSide wrote: Please tell me if the following steps good
a) Copy all .js files inside jscoverage-server
b) start jscoverage-server.exe
c) change html files to get .js files from jscoverage-server
d) run jsunit and do coverage-report()
-
- Posts: 6
- Joined: 2009-04-06 3:19 pm
Re: JSCoverage with JSUnit
The only difference is that in the example-jsunit both html and .js files are inside doc-root for jscoverage-server where as in my case they both are outside.. So I will be copying .js files and update html to reference them. Then I can run jsunit and add coverage-report button on jsunit testRunner.html.
Thanks Ed
Regards,
LowerEastSide
Thanks Ed
Regards,
LowerEastSide
-
- Posts: 6
- Joined: 2009-04-06 3:19 pm
Re: JSCoverage with JSUnit
Hello ED,
Another Question.
Should I have both .html files and .js files under jscoverage-server doc_root or only placing .js files are sufficient ?
Regards,
LES
Another Question.
Should I have both .html files and .js files under jscoverage-server doc_root or only placing .js files are sufficient ?
Regards,
LES
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: JSCoverage with JSUnit
I'm not sure if that arrangement will work - it may generate security warnings from your browser - I would recommend serving everything through jscoverage-server.