Question
Achmea
NL
Last activity: 14 Mar 2019 10:35 EDT
TestCase compile error Executable.evaluateWhen-FUAFailed
Hi
I have a decisionTable which has in the conditions column a when rule:
@(Pega-RULES:Utilities).callWhen(tools, IsVitalisPolicy, Primary).
Primary is the class of the decisiontable.
When I run the the desiciontable it runs ok. But when I turn this into a testcase it give me a compilation arror because it looks for the when rule on the Test-rule-class.
Platform: Pega 7.2
Greetings
Bertus van den Hof
Achmea
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hi , Please use the following syntax. @(Pega-RULES:Utilities).callWhen(tools, MyWhen, myStepPage). when Primary is passed Rule-Test-Unit-Case is picked up. The following error suggest so - RuleNotFoundException
com.pega.pegarules.pub.generator.RuleNotFoundException: Failed to find a 'RULE-OBJ-WHEN' with the name 'ISVITALISPOLICY' that applies to 'Rule-Test-Unit-Case'. There were 11 rules with this name in the rulebase, but none matched this request. The 11 rules named 'ISVITALISPOLICY' defined in the rulebase are:
11 unrelated to applies-to class 'Rule-Test-Unit-Case', for example: {Achmea-FW-CaseMgmtFW-Data-PSK, Achmea-Work-, Achmea-FW-CaseMgmtFW-Data-OverlijdensMelding, Achmea-FW-CaseMgmtFW-Work}.
Pegasystems Inc.
IN
Ideally the test case class would be same as decision table class. Was the test case class set to something else after clicking on "covert to test" button?
A screenshot of error would be helpful.
Let us know if error is during test case save or run of test case.
Achmea
NL
Hi,
Thanks for the reaction. The error occurs during the running of the testcase. The testcase is created from running the desiciontable and convert to test. See the attached screenshots.
Gr Bertus van den Hof
Pegasystems Inc.
IN
Ok.Thank you for the detailed screenshots.
This seems to be a limitation of RUF callWhen which fails to pass context of primary thru the chain of calls.
Could you try using @(Pega-RULES:ExpressionEvaluators).evaluateWhen("IsVitalisPolicy") instead and please let me know the results.
I assume both decision table and when rule belong to same class.In such case, evaluateWhen is simpler RUF than callWhen
Pegasystems Inc.
IN
One need not modify the test case for it, just changing decision table column should suffice.
Pegasystems Inc.
IN
It seems there is not much difference between these two RUFs in callWHEN() -- PRStackFrame frame = ((PegaAPI)tools).pushStackFrame("when", null, myStepPage, true, false); In evaluateWhen()
ClipboardPage topPage = tools.getStepPage();
if (topPage != null) {
frame = ((PegaAPI)tools).pushStackFrame("when", null, topPage, true, false);
} Could you share the stack trace from log after the test case fails.
Pegasystems Inc.
IN
ClipboardPage topPage = tools.getStepPage();
PRStackFrame frame = null;
if (topPage != null) {
frame = ((PegaAPI)tools).pushStackFrame("when", null, topPage, true, false);
} Could you share the stack trace from log after the test case fails
Achmea
NL
Hi all,
Thanks for the suggestion. The test runs OK after changing the CallWhen into a evaluate when. The small difference between passing the steppage and getting the steppage was crucial. I have added the stacktrace of the error if you are interested
Gr Bertus
Accepted Solution
Pegasystems Inc.
IN
Hi , Please use the following syntax. @(Pega-RULES:Utilities).callWhen(tools, MyWhen, myStepPage). when Primary is passed Rule-Test-Unit-Case is picked up. The following error suggest so - RuleNotFoundException
com.pega.pegarules.pub.generator.RuleNotFoundException: Failed to find a 'RULE-OBJ-WHEN' with the name 'ISVITALISPOLICY' that applies to 'Rule-Test-Unit-Case'. There were 11 rules with this name in the rulebase, but none matched this request. The 11 rules named 'ISVITALISPOLICY' defined in the rulebase are:
11 unrelated to applies-to class 'Rule-Test-Unit-Case', for example: {Achmea-FW-CaseMgmtFW-Data-PSK, Achmea-Work-, Achmea-FW-CaseMgmtFW-Data-OverlijdensMelding, Achmea-FW-CaseMgmtFW-Work}.
Achmea
NL
Hi
I tested the option myStepPage instead of primary. And it work now OK. The Pega Help is not very clear on this subject. It says myStepPage is a reserved word but I can not find information about it when to use. Only some examples. But decision tables in Pega rules do use this option as well so we will go along this solution
Thanks for your support
Bertus
Pegasystems Inc.
US
Hi @BERTUSVDHOF!
Could you go to that help file and click the Feedback button on the right pane and submit that feedback? It will go to the related team and they can update the information?
Thanks!