war

Questions, problems, suggestions, bug reports, and so on.
Post Reply
trailblazer
Posts: 7
Joined: 2008-04-11 8:13 am

war

Post by trailblazer » 2008-04-14 11:38 am

Hi All,

i want to know whether we can find out the code coverage for java script when the application is running in the server.. suppose i have a java script in the war file and deploy that war into some server and run the url .. as i click on the javascript actions ...how can i get those actions in coverage....


i have created two folders as you said and instrumented my sample.js and i have copied that instrumented sample.js into my war file and deployed that into jboss and i have opened jscoverage.html and placed that url(http://localhost:8282/example/samplepage.xhtml) and now when i try to click on the javascript actions i was not able to click on that ...browser is showin the following error (_$jscoverage. sample .js is null or not an object ) but when i run that url normally it works fine... can you help me if i have done something wrong ..or can you tell me whether the coverage for java script in the war file can be measured or not..


Thanks

siliconforks
Site Admin
Posts: 34
Joined: 2007-05-26 5:25 am

Re: war

Post by siliconforks » 2008-04-14 3:32 pm

You are copying the instrumented sample.js file - are you copying all the files in the instrumented directory? The jscoverage command creates a lot of files there, and you will need to copy all of them, preserving the directory structure.

Briefly, suppose the source for your web application is arranged as described in http://tomcat.apache.org/tomcat-6.0-doc ... ource.html:

Code: Select all

example/
  src/
    ...
  web/
    samplepage.xhtml
    sample.js
    WEB-INF/
      web.xml
Then you would run jscoverage:

Code: Select all

jscoverage web web-instrumented
Then modify the command that builds the .war file so that it includes the files from the web-instrumented/ directory instead of the web/ directory. Make sure you include ALL the files in the web-instrumented/ directory - jscoverage creates a lot of additional files.

Once you have deployed the war file, you have to visit the jscoverage.html page in the deployed web application (a jscoverage.html page anywhere else will not work):

http://localhost:8282/example/jscoverag ... page.xhtml

Post Reply