We use a server side scripting framework that embeds Rhino for
processing javascript files. One thing that elludes us is a method to
test our code efficiently, partially because the script files have a
lot of server side dependencies, making unit tests hard. As a result
we have functional tests for the resultant output but limited insight
onto the effeciveness of the test.
I'm sure this has been asked of before but how conceptually difficult
would it be to write some kind of code coverage tool around Rhino ? If
we ran a functional test which invoked the server side javascript
components some kind of report as to which paths through the script(s)
were followed (or not) would be immensely useful. Any pointers ?
Should I give up now ? :-)
thanks
Tim
When rhino compiles to class files it can optionally generate line
debugging information in the class file. I've never attempted it, but
it would be worth a try to use a standard Java code coverage tool when
running with those class files.
--N
You might want to look at the program I wrote for measuring JavaScript
code coverage:
http://siliconforks.com/jscoverage/
Note that it is designed for measuring coverage in client-side browser
scripts, so you would have to do some tinkering to get it to work with a
server-side Rhino framework.