Posted: 10 Jul 2019 8:58 EDT Last activity: 6 Aug 2019 5:22 EDT
Creating a Test Case for date manipulation in a Decision Table
The decision table works as expected in the application.
I am attempting to create a test case for a decision table. This table takes a string of text, and returns an altered datetime value
I added a Data Transform to the test case to set the ScheduleDate, as well as the pyCalendar value,.
The top condition passes the test, but the second condition evaluates based on CurrentDateTime rather than the ScheduleDate. Is there something I can do in my test case to ensure that it returns a date value based on ScheduleDate rather than the current date?
At this point, there is no easy way to assert this. Return result field on Decision Card in PegaUnit does not allow expressions or property references currently. Instead this can be achieved by some work arounds, 1) Decision tree can be wrapped in DT or Activity and write PegaUnit for wrapped rule which allows to leverage Property card assertion to do this. 2) With in the same test case of DecisionTree, use the decision card for evaluation of first row as you have been doing but have just one row in the decision card. This will allow you to add other assertion cards to the rule. Additionally add Property assertion card, add a row to have parameter reference (which contains current date) on left side and on right side use expression support to call a function which can invoke the Decision rule with required values.
We will try to address this usecase in a better way in upcoming releases.
While calling addTime function, why first parameter is blank. What is the default value taken by addTime function, when first param is blank? Is it current date. Try giving schedule date as parameter in that place.