Reputation: 519
Has anyone tried building Velocity template engine extension or plugin?
Our team is heavily using Velocity Template Language for API input/output transformations. Since a lot of complex logic is in the VTL code, we have implemented a way to unit test the VTL code. However the current problem is that there's no way to measure the code coverage of these unit tests. We want to implement a VTL Engine extension to calculate the coverage when executing these tests. Does anyone have any insight or similar experience?
Thanks!!
Upvotes: 1
Views: 715
Reputation: 4160
Velocity doesn't have this feature yet.
Meanwhile, you can:
org.apache.velocity.runtime.parser.Node.java
class needs a new int field, visited
initialized to 0render()
method increment visited
in all the render()
method of all other parser nodes which do have such a methodo.a.v.runtime.parser.visitor.BaseVisitor
to collect, for each of your template, each node location infos and number of renderingsAnd if you're successful at this last option, be sure to submit a patch!
Upvotes: 1