Posted: 14 Oct 2015 15:03 EDT Last activity: 25 May 2017 13:31 EDT
Code/Rule Coverage in Pega
Hi, I have a requirement to get a report in pega showing the rule/code coverage. Lets say QA/UAT is running the testcase and in the backend there will be number of rules executed. We want to know out of 1000 rules how many got executed? I am looking to generate a weekly. Pega caches most of the rules in server/cllient/DB etc... Is there a way to do it in Pega?
***15/02/2017: Updated by moderator: Lochan to the details of the SR and enhancement***
Thanks for the update. The Log-Usage is sharing a lot of information. But i could not find how many rules got executed at a given time (say weekly). And it also runs on cache. But all the rules might not hit the cache. So how do I get the related information?
I have gone thourgh the Log-RuleUsage and Log-usage but pxNumPeeks property gives us the Number of times the class loader checked to see whether this entry was loaded. This is related to one rule or all the rules? I am looking for total DISTINCT rules executed for a given time.
If design view for a section is showing the included sections, does that showing of the included section “count” as rule coverage of that inner section ? Or does it only count if the app is actually run ? Things like this could make it harder to determine what an actual usage rule consists of. Without this need to distinguish, one could use a direct db row tracer, and merely say that any rule accessed from the db “counts” as a covered rule. /Eric
Thanks for the update. if a section has inner section, and when it is shown on the screen, it is fetched from either cache or DB and rendered on the screen. So I would consider the rule count as 2 (+ properties count etc...).
Regarding DB row tracer and DB counts I would like to get more details. lets say if a rule is already fetched from DB once it is cached for next time and I will not get accurate results from 2nd or 3rd time on wards. So how do we solve the problem?
Log-RuleUsage is showing only the cached information (if I am not wrong)... And every rule might not be cached as well. So how do we resolve this?
The first note in this discussion said the desire is to know whether a rule is getting executed, rather than how many times.
So, I would think that could be achieved as follows:
1) Make sure the computer is only being used for running the tests and not for editing. That way you can be sure you're not referencing any inner sections for editing an outer section, and therefore if the inner section is referenced at all, you can assume you do want to count it, and it was therefore referenced by one of your tests.
2) Truncate all cache tables so that any rule reference forces a db row access.
3) Put a db-level tracer on your rows, and count any row access to a rule as a usage of that rule.
Thanks for the update but this would be a painful process as every time we cant truncate the cache in higher env. We want a ongoing process where every week/date frequency would like to know how many rules got executed. We cant clear the cache every time a new application enhancement is added or a test case is executed. is there an alternative way? If it is the limitation of the product, i would like to request product enhancement feature.
I agree that having some UI to make this convenient in the product would be great, so please do submit a proposal. However, continuing to think about what is possible given today’s system, if you’re able to turn on the Pega tracer with all event types, while you run your test, and then use the “save” button in the tracer, you can sort the records in the resultant (xml) file by the right-hand tracer column, since that column gives the key of every rule the tracer recorded, so in that manner you can know not only what rules were recorded, but how many times. /Eric
It looks like this SR was turned into a product enhancement and this SA-16658 was generated. Please take a look at this SA for more information and follow up with your Account Executive for next steps.
I took a look into this SR for you and a product enhancement was created as a result of the investigation. Take a look at SA-16658 to know more. I have added the enhancement request number to the original post above under the Related Support Case Number field. You must follow-up with your Pega Account Executive, in case you need any information on the enhancement.