<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I don’t think anybody else has bothered to do this. Drools generates the classes in memory and they aren’t written on disk – this makes linking with the standard instrumentation methods extremely hard if not impossible.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>You may be able to hook into the classloader and/or class creation code to pass the bytecode through the instrumentation library if this is really needed, but if you tell your manager the cost of doing this they may be happy with the alternatives proposed – or just not doing coverage on code.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thomas<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <b>On Behalf Of </b>mike<br><b>Sent:</b> 23 January 2012 16:25<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Code Coverage<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I was wondering if there was any blog post or tutorial on how to set that up in jenkins or teamcity or things like that ... it's not a trivial thing to do ... also, based on the responses here, doesn't seem like a common practice<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I don't know enough to figure out how to set it up ... as far as i know i need to instrument the code ... now, the code, would be whatever drools generates ... i don't know how to pickup the package that drools generates n' them how to instrument it<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>thank you very much four your time and answers<o:p></o:p></p></div><div><p class=MsoNormal>cheers<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Mike<o:p></o:p></p><div><p class=MsoNormal>2012/1/23 Swindells, Thomas <<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>There is nothing stopping you taking the output and producing a report in your CI showing lines (Rules) in red and green as to whether they have been touched as part of the tests – if you separate out your rules into a separate module you could probably output the report in the exact same format as the standard java report xml and get the standard tools to output an almost identical report.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thomas</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>mike<br><b>Sent:</b> 23 January 2012 16:14</span><o:p></o:p></p><div><p class=MsoNormal><br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Code Coverage<o:p></o:p></p></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I could argue this left and right with my managers ... but in reality when we mention code coverage we mean looking at a report in CI showing lines of code in green or red ... anything short of that is something else<o:p></o:p></p><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thank you very much for the response <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Cheers<o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Mike<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On Mon, Jan 23, 2012 at 10:47 AM, Wolfgang Laun <<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>It is highly recommended as "best practice" to have RHS code that<br>doesn't contain any branching instructions. Then, executing means full<br>coverage.<br><br>In case it is necessary to have more complex code I'd not put it into<br>a RHS anyway (where it isn't really OO any more) but I'd code it in<br>Java files and just call from the RHS.<br><br>For the LHS you can also argue that firing proves coverage; although<br>it won't be full *expression* logic coverage, due to potentially<br>skipped subexpressions in disjunctions.<br><br>-W<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><br><br>On 23/01/2012, mike <<a href="mailto:mikemps@gmail.com" target="_blank">mikemps@gmail.com</a>> wrote:<br>> Thank you very much Thomas ... yes, what i need is standard code coverage<br>> ... my company is all over that metric<br>><br>> cheers<br>> Mike<br>><br>> 2012/1/23 Swindells, Thomas <<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>><br>><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> It depends what you are asking for,****<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> If you just want to know what proportion of rules you have written have<br>>> actually activated then that can be simply achieved by having a<br>>> AgendaEventListener and using it to ‘tick’ rules off when they have been<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> triggered – the blog entry should have you achieve this.****<br>>><br>>> ** **<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> If you actually want to integrate it with standard java code coverage<br>>> reports then this is a different question and is likely to be much harder,<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> if not impossible, ****<br>>><br>>> ** **<br>>><br>>> Thomas****<br>>><br>>> ** **<br>>><br>>> *From:* <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<br>>> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] *On Behalf Of *mike<br>>> *Sent:* 23 January 2012 14:34<br>>> *To:* Rules Users List<br>>><br>>> *Subject:* Re: [rules-users] Code Coverage****<br>>><br>>> ** **<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> Thank you very much ... as far as i know in order to do code coverage i<br>>> need to instrument the packages i'm interested in covering ... this<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> recommendation doesn't take me in that direction****<br>>><br>>> ** **<br>>><br>>> It is very useful however in showing a way to test rules individually.****<br>>><br>>> ** **<br>>><br>>> Thank you****<br>>><br>>> Mike ****<br>>><br>>> ** **<br>>><br>>> 2012/1/17 Toni Rikkola <<a href="mailto:toni.rikkola@gmail.com" target="_blank">toni.rikkola@gmail.com</a>>****<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> You need to write the coverage tests for JUnit yourself. Test Scenarios in<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> Guvnor do this, but you can't use them outside Guvnor. ****<br>>><br>>> ** **<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> Test Scenarios get all the rule names for the rules in one package and<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> then compares that list to the rules that fired.****<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> Edson's blog entry might help you<br>>> <a href="http://blog.athico.com/2011/10/cookbook-how-to-test-rules-using-xunit.html" target="_blank">http://blog.athico.com/2011/10/cookbook-how-to-test-rules-using-xunit.html</a><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> .****<br>>><br>>> ** **<br>>><br>>> Toni****<br>>><br>>> ** **<br>>><br>>> On Jan 16, 2012, at 5:49 PM, mike wrote:****<br>>><br>>> ** **<br>>><br>>> Hi there,****<br>>><br>>> ** **<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> I was wondering if its possible to measure code coverage on test running<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> against a set of rules.****<br>>><br>>> ** **<br>>><br>>> Thank you****<br>>><br>>> Mike****<br>>><br>>> ****<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>> _______________________________________________<br>>> rules-users mailing list<br>>> <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users****" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users****</a><br>>><br>>> ** **<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>><br>>><br>>> _______________________________________________<br>>> rules-users mailing list<br>>> <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users****" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users****</a><br>>><br>>> ** **<br>>><br>>> ------------------------------<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>>><br>>><br>>> **************************************************************************************<br>>> This message is confidential and intended only for the addressee. If you<br>>> have received this message in error, please immediately notify the<br>>> <a href="mailto:postmaster@nds.com" target="_blank">postmaster@nds.com</a> and delete it from your system as well as any copies.<br>>> The content of e-mails as well as traffic data may be monitored by NDS for<br>>> employment and security purposes. To protect the environment please do not<br>>> print this e-mail unless necessary.<br>>><br>>> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18<br>>> 4EX, United Kingdom. A company registered in England and Wales. Registered<br>>> no. 3080780. VAT no. GB 603 8808 40-00<br>>><br>>> **************************************************************************************<br>>><br>>> _______________________________________________<br>>> rules-users mailing list<br>>> <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>>><br>>><br>><o:p></o:p></p></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></p></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div></div></div></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>