Guest wrote:where should *jscoverage.js and *.jscoverage.html be located? our JS folder? or our domain folder, the same as our logon.jsp folder?
The JS folder. For every JavaScript file x.js, you should see a file x.js.jscoverage.js (and x.js.jscoverage.html) in the same folder as x.js.
Guest wrote:From user guide, the SOURCE_DIR is our JS files location for jscoverage to copy all existing js files and instrument them for js coverage to use.
our folder structure:
domain logon page: \\webapp\logon.jsp
js files: \\webapp\jsfolder\*.js
How do I do for SOURCE_DIR and DEST_DIR?
Should I do: jscoverage web build as jscoverage webapp webapp\jsfolder?
No, you need to have a build folder (DEST_DIR) which is totally distinct from your source folder. The jscoverage program copies an entire folder, and all its subfolders, recursively, instrumenting any .js files. The destination folder should not be a subfolder of the source folder - if you did that, running "jscoverage webapp webapp\jsfolder", you would end up with something like this:
Code: Select all
webapp\logon.jsp
webapp\jsfolder\
webapp\jsfolder\script.js (original JavaScript code)
webapp\jsfolder\logon.jsp (!)
webapp\jsfolder\jsfolder\ (this is surely not what you want)
webapp\jsfolder\jsfolder\script.js (instrumented JavaScript code)
webapp\jsfolder\jsfolder\script.js.jscoverage.js
(Actually I think this would not happen, because jscoverage would detect that the destination folder is contained inside the source folder and abort.)
You should be doing something like
Now webapp\ contains your original web application, untouched, while webapp2\ contains the instrumented version of your web application.
Guest wrote:I only want to instrument the js code unser \\webapp\jsfolder. How do I run jscoverage and its parameters?
First, before you run jscoverage, create the build folder (e.g., webapp2\). Then run
Code: Select all
jscoverage webapp\jsfolder webapp2\jsfolder
Then copy logon.jsp and any other files and/or subfolders (except jsfolder\) from webapp\ to webapp2\.
This will create the jscoverage.html file in webapp2\jsfolder. That should not cause problems, but it makes the URL to access your logon page slightly more complicated: it will look something like
Code: Select all
http://mydomain:1234/path/jsfolder/jscoverage.html?../logon.jsp