Closed weiding111 closed 5 years ago
proxy server start command - java -jar JSCover-all-2.0.3.jar -ws --proxy --port=3128 --report-dir=./jscover/output --document-root=/Users/***/js --local-storage
my question is if there is jscoverage.json existing, then execute ((JavascriptExecutor)(auto.getDriver())).executeScript("if(window.jscoverage_report)jscoverage_report();");}. Does the new report will be merged with the existing jscoverage.json?
It should be. I've checked that it works in the basic JSCover proxy example, and manually calling jscoverage_report()
. You might be able to try this with your set up.
Also, you could try using the HTML5 local-storage option to store coverage data between pages. See https://github.com/tntim96/JSCover/tree/master/examples/localStorage-proxy
I stoped the web driver after one test jscoverage report generated. then start webdriver again, use jscoverage_report(), so does it merge with the former one? stop and start web driver will not reflect the merge report actions, right?
I noticed that there is a mention on link 2 you provided. running tests with intermediate page results stored in HTML5 local-storage (i.e. no iframes or child windows)
If the product server contains iframes and chind window, the js could not be instrumented in the report?
What that means is that JSCover doesn't require iframes or child windows to store intermediate JSON data when it stores it in HTML5 local-storage.
If the product server contains iframes and chind window, the js could not be instrumented in the report?
JSCover should work as documented. If the JS goes through the proxy, it'll get instrumented regardless of frames etc...
I use the jscover proxy mode to run the webdriver selenium test. For each of the tests the workflow like following -
That means it report should be saved after each of the test completed.
Now the issue is the jscoverage.json is always the same with the tests running. The expected result should be the jscoverage.json is merged for all of the tests report.
According to the JSCover manual page 3.2.2 Storing reports The store button triggers the POSTing of the coverage data to the server in JSON format. The following will then occur: If a JSON file, jscoverage.json, already exists, the coverage data will be merged
So why the jscoverage.json does not merged after execute the "jscoverage_report()" when each of test finished? How to make the report jscoverage.json as a merged one?