The last few days I've begun using jscoverage to improve my application tests.
Finally it works really good after some problems and some improvements in the code.
I figured out to get the jscoverage-server to work using the proxy option.
Here are some possible improvements I could imagine:
It would also be nice to have the possibility to use pre-instrumented JS-code for the jscoverage-server.
Maybe a "report-finishing"-function, which processes the JSON-file and writes simple-HTML code for the final result data would help to make the report-results faster (especially when you have big JS-files resulting in a huge JSON-file) ... because after the tests have finished / or the server has shutdown the coverage data will not be changed any more - so than the data can be optimized for viewing the results.
Here are 2 patches I made to improve performance of the resulting report (using JSON.parse if available in modern browsers) and to fix a shutdown problem of the jscoverage-server when using non-localhost IP:
* patched jscoverage.js to improve performance of JSON parsing (using JSON.parse if available in modern browsers) * patched jscoverage-server.c to fix shutdown with non-localhost ip
Thanks for the patches. I just have a few questions:
Klaus wrote:It would also be nice to have the possibility to use pre-instrumented JS-code for the jscoverage-server.
I'm not sure why that would be useful?
Klaus wrote:Maybe a "report-finishing"-function, which processes the JSON-file and writes simple-HTML code for the final result data would help to make the report-results faster (especially when you have big JS-files resulting in a huge JSON-file) ... because after the tests have finished / or the server has shutdown the coverage data will not be changed any more - so than the data can be optimized for viewing the results.
Yes, probably that would improve the report. (The current implementation is basically just a quick hack to get reports working by reusing the existing JSCoverage user interface.)
Ed wrote:Thanks for the patches. I just have a few questions:
Klaus wrote:It would also be nice to have the possibility to use pre-instrumented JS-code for the jscoverage-server.
I'm not sure why that would be useful?
-> for performance improvements, so that the code is instrumented before the first page access. (but this was only an idea, not really required)
Ed wrote:
I am confused about this - doesn't the original code use 127.0.0.1? Is the patch reversed?
-> yes, I changed the parameter to use the given ip_address also for shutdown, otherwise the shutdown did not work when using a non local IP (e.g. using 0.0.0.0 as IP)