Closed gajananrmahajan closed 4 years ago
If the application is deployed, you should instrument the JS code using file-mode before deploying. There is a working example here: https://github.com/tntim96/JSCover/tree/master/examples/localStorage-file-system
There are also other tools that might be better suited for your scenario: https://blog.logrocket.com/using-the-chrome-devtools-new-code-coverage-feature-ca96c3dddcaf/ https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-adding-code-coverage-recording-with-istanbul
@tntim96, I can see that you've been handling this project alone. Thanks for all your efforts and keep moving this project!
I'm very new to code coverage and applications deployed in tomcat. Searched a lot and also went through JSCOver doc but could comprehend fully, hence need your help. My questions could be silly but please help me.
My requirement is to get JS Code Coverage of application which is deployed in Tomcat. To hit the code, I'll execute Selenium tests.
In document I can see following command where doc/example has js code(& index.html) which is going to be checked for coverage -
java -jar target/dist/JSCover-all.jar -ws --document-root=doc/example --report-dir=target
In Tomcat, my app is at -
/home/oracle/apache-tomcat-8.5.11/webapps/MyApp
which is using port8080
. And I hit command -java -jar target/dist/JSCover-all.jar -ws --document-root=/home/oracle/apache-tomcat-8.5.11/webapps/MyApp --report-dir=target
But it results into error -
Exception in thread "main" java.lang.RuntimeException: java.net.BindException: Address already in use (Bind failed)
Steps by team -
java -jar target\dist\JSCover-all.jar -fs --local-storage /home/oracle/apache-tomcat-8.5.11/webapps/MyApp target/MyApp-Ins
This created instrumented folder MyApp-Ins
WEB-INF
folder from/home/oracle/apache-tomcat-8.5.11/webapps/MyApp
to something likeWEB-INF-OLD
MyApp-Ins
underwebapps
at same level as ofMyApp
java -cp target\dist\JSCover-all.jar jscover.server.SimpleWebServer target/MyApp-Ins 8080
But this results into error -
I did not understand why this failed and why to use port
8080
again here(which is used for app deployed) and usetarget/MyaApp-Ins
which is instrumented in JSCover directoryPlease help me how I can proceed with this?