Posted: 16 Sep 2020 12:39 EDT Last activity: 24 Jan 2021 20:15 EST
How do I unit test error messages on the primary page?
I have a Data Page that generates a page message when it is passed invalid parameters - This page message is set on the Data Page itself (as primary).
I have written some 'happy' Pega Unit Test rules and they work fine. However, my unit test that checks for the error scenario fails. In fact, the only way I can get the test to work is to change the logic of the data page itself, and I don't want that!
I have attached a couple of screenshots showing what I have in my unit test and the result.
Does anyone know how to get the test to pass on the data page containing the error message?
Thanks for the reply Braam. Sadly I could not see that page in the trace, and I added it as a named page under the tracer settings to be sure.
I am not running the latest version of Pega, so perhaps that page name has changed. In the version I have (Pega 8.3.1) there is a page named 'TestRunOutput' instead. That contains the error messages from the primary page (in this case D_TaskItemsSavable) copied into a text property. Still errors on that page cause the test fail, even if the errors are expected.
Sorry I didn't get a notification about your update and am only now circling back over old posts I commented on.
Did you get to the bottom of this or is there more to dig into?
I can see what you're trying to do, and it's annoying that you can't, but haven't you in essence implemented a Test Case for OOTB Platform functionality? That is, a Lookup Data Page returns an error when the keys don't locate an instance?
I propose you can focus your PegaUnits on the happier paths for this Data Page and trust that a lookup Data Page will honour its contract of returning an error when the lookup fails.