I am trying to derive test-coverage for unit-tests running across rules written in drl files(Drools rule engine). Basically I want to derive the percentage of the rule execution which has been actually covered by the unit tests written around them. Suggestions would be really helpful. Thanks in advance.
Asked
Active
Viewed 791 times
3

ndmeiri
- 4,979
- 12
- 37
- 45

Neha Akshara
- 31
- 2
-
2Could you please show us the research you've done so far? – Nick Slavsky Jun 01 '18 at 14:22
-
HI Neha! Does Ira's answer solve the problem for you? If so, please accept it by clicking the green checkmark. If not, please comment or edit your question to clarify what remains to be solved. Thanks! – Max von Hippel Jun 01 '18 at 21:55
2 Answers
1
Classic coverage is usually obtained by instrumenting the code with "I got here" probes, then executing tests, to see which probes got hit.
Instrumenting drools files sounds intriguing; you need a tool that can parse the Drools files and insert probes. I doubt that you will find this off-the-shelf.
See this technical paper, Branch Coverage for Arbitrary Languages made Easy, for a description of how to do this in general. The paper talks about using C/java as examples, but it could be a Drools rule instead.

Ira Baxter
- 93,541
- 22
- 172
- 341