Posted: 24 Feb 2021 16:31 EST Last activity: 4 Mar 2021 13:04 EST
Testing Case Types
I am running into issues while attempting to automate testing of Case Types.
First of all, creating Test Cases for stages and flow rules in a Case Type seem to only be possible for Create stages. Discussions I have read for testing downstream stages and or flow rules is to create a new test case and the Case Type level, and have the recorder run starting at the very beginning until the portion of the Case Type -- the particular stage, step, or flow you are interested in testing. The issue I am running into is that when a stage transition involves work item to a different work queue, the recorder "breaks"; that is, once the original submitter submits a request, the system displays a message saying "Thank you for the request" and then the request is routed to a Case Worker work queue for review and approval. But in order to follow to that stage I either have to click "Refresh" or "Change Stage" from the navigation bar, and at this point I lose the recorder: both the orange border and orange window in the bottom right corner that says "Recording....." and containes a button that says "Create test case" disappear and are unrecoverable, effectively rendering it impossible to create a test case that travels any further than the original submission.
I have attempted to work around this by using the "Automation Recorder" at the portal level, but in Pega 8.1 this recorder seems unequal to the task. It seems to become bogged down and confused before I am even done with the request submittal stage, missing steps in the recording process, especially when it comes to data typed into fields by the user. Often I will click on a control, enter data, and move on to the next, only for the Recorder to pane to show a "Verify" rather than an "Enter". When I click the gear to observe or edit the step, I see that the "click" event is displayed, but not the "change" event, and there is no way to add this event. Once the recorder misses one of the steps it doesn't seem to recover and misses many of the subsequent steps. And there is no way to add new steps manually or add events to those steps even if I could.
So all of that is to say, is there any way to actually do high level testing of Case Type processes?
@Stephen Miller In scenatio test ( Using the Automation Recorder ), for each recordable control gets captured in 2 steps. First click will select the control ( for texinputs etc you will see after first click a step is created in right hand side recorder pannel). Then second event is captured when youre defocused from the control ( after entering data you tab out from that control), then the same recorded step is modified with the value that you have entered.
These tests are also rules ( like datatransform / decision rules ), so you can open them in dev studio also and see further details for the step. to see all the testcases there is a landing page ( designer studio footer has a link to open that with label scenario testing)
@sahag I agree with your assesment that control capture is a two step process. First it registers the click/focus and then after you change focus it records that the data was changed. Except when it doesn't. My experience has been that once you have performed a number of operations, there will come a point when it the recorder starts to lose track. It will still record the fist action - the click/focus - but when you enter data and then remove focus for the control in question, it fails to perform the second update step; it gets lost and never carriers through with the second action. You can repeat the process indefinitely, but if it failed to update once, it will fail to update from that point on.
Also I agree that you can find these tests, as rules in the "Scenario Test" landing page, but these are not editable. So if I start an Automated Recording, I get a certain ways in, the recorder stops recognizing that I changed the data in a control, then I cannot come to this landing page, open the test and fix it. I can just see that it is wrong.
My ultimate goal is to be able to test that work is getting routed to the correct place. For the Case Type in question, once a User/Customer submits a request/order, that it order is routed through several offices for review and approval. I want to be able to test that the orders are getting routed to the correct place at the correct time. Because these actions/rules are flows, I cannot test them atomistically/individually/standalone. If I attempt to test them with a test case, the flow recorder gets lost / dissappears / breaks at the work queue transition, so I can't test it that way. If I try to test it with the automation recorder, the recorder gets lost once I've performed too many operations (eventually stops recording the second part of the two part process you mentioned). So I'm left wondering: how do I test that my cases are getting routed correctly?
For testing business logic at individual rule level like an activity or data transform or starter flows, I would recommend using PegaUnits. PegaUnits allow to test all combinations at unit level thoroughly.
For end to end testing using UI, Scenario Testing can be used. Scenario Testing has ability to record only based on mouse clicks. So, if you are entering any values in text boxes or other controls and tabbing out while recording a scenario test, those steps may fail to get recorded. This might be a reason for Scenario test not recording some of the steps as you mentioned. I would recommend to refer articles at below space which may be helpful in deciding what kind of automation and how to use.