I am looking for pointers towards a tool which can help me determine the functional automation coverage in nodeJs. (This is not unit Tests!).
I have a lot of selenium automation running for my frontend application written in NodeJS. But I want to know the functional coverage of these automation.
(I used jacoco for java based earlier)
As mentioned in one of the comments, istanbul is a really nice, very generic, coverage tool. It acts as a middle man between the node process and your scripts, so as long as you are executing something in the node runtime, it should do what you want. I'm not sure how you are running your selenium tests but I run mocha through it like so:
node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- test/*-test.js
#or simply:
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- test/*-test.js
Even though mocha is normally run as its own "command", it can be "fed" into istanbul and coverage is printed out that way. So in your case, whatever command you use to run the frontend tests in node/selenium can be run in istanbul. As I said, this is a very generic process that can be applied to anything that runs within node.js.
Now I don't really have any hands on experience with Selenium but what I do know that it is a bit a Rube Goldberg system with many interconnected processes (some potentially on different machines). If you are looking for something to capture both front end, backend, and test code (or frontend code running in the browser, served from backend code) in one line, I'm not sure that exists ("frontend application written in NodeJS" is what keyed me into this).
The answer to this question is to have istanbul-middleware
https://github.com/gotwarlost/istanbul-middleware
istanbul
and istanbul-middleware
are different and needs to be installed separately. I have successfully instrumented the code using this. Steps are as follows
istanbul-middleware
to your nodejs application/coverage
(or if you changed it from the github example change it here) and get your coverage information.Read the github readme for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With