tntim96 / JSCover

JSCover is a JavaScript Code Coverage Tool that measures line, branch and function coverage
GNU General Public License v2.0
399 stars 84 forks source link

https websites via JSCover proxy #198

Closed ramprasadgk closed 9 years ago

ramprasadgk commented 9 years ago

How much is the effort to get https websites via JSCover proxy, can you please elaborate on details? and effort required

tntim96 commented 9 years ago

Proxying in general is inferior to pre-instrumenting the JavaScript before deploying to your web-server for a number of reasons, even though this can be more difficult to set up - usually it will be worth the effort.

How much is the effort to get https websites via JSCover proxy

I haven't had time to look at this in depth, but I suspect it is quite difficult. You're welcome to take a look at implementing it. I would imagine this would best be done by combining JSCover with an existing (and license compatible) open-source (preferably Java) proxy-specific project. I'm unaware of any such projects, but haven't looked recently.

ramprasadgk commented 9 years ago

Thanks for the prompt reply , "I would imagine this would best be done by combining JSCover with an existing (and license compatible) open-source (preferably Java) proxy-specific project"

If we have, lets a SSl proxy project ,then what would be the effort, we are kind of blocked now in using this tool on a large scale project

tntim96 commented 9 years ago

That depends on how easy it is to integrate.

we are kind of blocked now in using this tool on a large scale project

I strongly recommend instrumenting the JS before deploying, and measuring the coverage without the proxy.

ramprasadgk commented 9 years ago

I strongly recommend instrumenting the JS before deploying, and measuring the coverage without the proxy. How does this work, if i just instrument JS using fs mode and than should I have to run webdriver test to make sure these code this coverage ?

tntim96 commented 9 years ago

Yes. Take a look at https://github.com/tntim96/JSCover/tree/master/examples/localStorage-file-system which is a working example of this

tntim96 commented 9 years ago

If your server is Java based, you may be to set up a filter to instrument the JavaScript as it is served.

I would imagine this would best be done by combining JSCover with an existing (and license compatible) open-source (preferably Java) proxy-specific project.

The LittleProxy project may suite, but it would be some time before anything is useable.

ramprasadgk commented 9 years ago

sure, will keep a tab on LittleProxy project We plan to do during deployment, in that case after deployment if that is served using apche/weblogic server, can we generate report from client side,

tntim96 commented 9 years ago

can we generate report from client side

Yes. The example linked to above demonstrates this. It is also documented in the manual.

ramprasadgk commented 9 years ago

Thanks! and when we have the JSON file how do we convert it to html report and 2) what is the difference between local-storage and file-system mode ,please elaborate

bianxirui commented 9 years ago

Proxying in general is inferior to pre-instrumenting the JavaScript before deploying to your web-server

Could I bother to consult the steps? Are the commands below sufficient? java -cp target/dist/JSCover-all.jar jscover.server.SimpleWebServer . 8080 java -jar target/dist/JSCover-all.jar -ws --proxy --port=3128 --report-dir=target

ramprasadgk commented 9 years ago

I am gettign this error when trying to merge two reports, can you take a look

Jul 10, 2015 8:47:33 PM jscover.report.Main runMain INFO: Args: --merge,C:\Users\testreport,C:\Users\report2,C:\rep Jul 10, 2015 8:47:33 PM jscover.report.Main runMain INFO: Starting JSCover 1.0.20-SNAPSHOT merge Jul 10, 2015 8:47:33 PM jscover.report.Main mergeJSON INFO: Merging JSON from 'C:\Users\testreport\jscoverage.json' Jul 10, 2015 8:47:33 PM jscover.report.Main mergeJSON INFO: Merging JSON from 'C:\Users\report2\jscoverage.json' Jul 10, 2015 8:47:34 PM jscover.report.Main mergeOriginalSource INFO: Couldn't find directory 'C:\Users\testreport\original-src' to merge -->\ we need original source code here **

tntim96 commented 9 years ago

That's just a an INFO log, not an error, the program will continue. The report uses the original-src directory to display the file coverage, so it tries to merge them but won't fail if it's not there. It depends on what you're doing as to whether this is a problem or not.

ramprasadgk commented 9 years ago

hey I get this error now when trying to merge report Exception in thread "main" java.lang.NullPointerException at jscover.report.FileData.addCoverage(FileData.java:379) at jscover.report.JSONDataMerger.mergeJSONCoverageMaps(JSONDataMerger.java:381) at jscover.report.Main.mergeJSON(Main.java:443) at jscover.report.Main.mergeReports(Main.java:421) at jscover.report.Main.runReport(Main.java:411) at jscover.report.Main.runMain(Main.java:394) at jscover.report.Main.main(Main.java:366)

tntim96 commented 9 years ago

Can you provide the two files you're trying to merge?