Unit Test Rule auto cleanup not working for data table, but it is for work table
Using Pega Unit Test Rules, we are creating DB objects in the Setup Data to then use during rule execution and interrogate in our assertions. Then OOTB in the Cleanup we have the checkbox ticked that auto cleans up all data that was created during the Setup.
We have seen that for Work level DB objects this works as expected and the DB records are cleaned. However I have a Data table, with different keys (not pyID) and this is not auto cleaned up after the Unit Test has run.
I was wondering whether there was some restrictions on the functionality of this auto clean up based on keys? Or based on other factors?
Any help much appreciated
***Edited by Moderator: Lochan to update platform capability tags***
If the class of data table extends from Data- class, cleanup should work fine similar to classes extending Work-. pzInsKey of the work and data records is used internally to track and cleanup the items, so it is not dependant on pyID specifically. As you may know, cleanup happens only for items which get newly created during execution of the test case.
Yes you're right! Thanks. I forgot to update. The issue I noticed was that my data class did not inherit from Data-. For the cleanup to work we need to inherit from either Work- or Data-. Bonus knowledge - to make sure of the Unit Test rules, you often will need to load a particular object onto the primary page in which the rule being tested will execute. This is RunRecordPrimaryPage