Question

Automated UI Scenario Testing - System date question

Hi,

We leverage Automated UI testing feature capability introduced in Pega Infinity. We can create scenario tests and run these. Our application depends on some calculations depends on the current system date. So when we record the test case, it passes correctly. But for example when we run the same test case one month later, test case fails as calculated values are not the same with recorded values as they depend on the current system date.

As this may be a common impediment for scenario testing for different applications relying on the system date, is there a solution or guideline that how we can overcome this issue and run the Scenario test without failing when date is changed?

Thanks and Regards

Comments

Keep up to date on this post and subscribe to comments

February 14, 2019 - 1:01pm

Currently  there is not out of the box way of simulating time. However if you can describe the setup of what you are trying to test in more detail we might be able to provide some ideas on how to effectively "simulate" the time.

The key aspect to testing anything that has a dependency on system time is to generally decouple or abstract the reference to time value in such a way that when testing, a simulated time can be supplied that is fully controllable.  With some rule types in the system this is not easily doable, such as the SLA rule, but if there are ways, then we might be able to figure something out.

 

Pega
March 7, 2019 - 3:16am

Hello,

we're facing the same problem thus run test with dynamic data instead static data in general.
For example with date i've recorded a test case inserting a date 01/01/2019. This date has a validation in the flow that prevents to insert dates one month before current. If we run the test now it fails.

It seems that provide dynamic data to automation is possible by reading this article https://community.pega.com/knowledgebase/articles/create-ui-based-tests-automated-scenario-testing that says "Provide data to your test cases with a predefined data page. This data page can provide unique values for each execution of the test case. You can populate the data page by using any source, including activities or data transforms."

Can you provide an example ?

Pega
March 18, 2019 - 2:51am

Hi bertr,

Please follow the below steps which helps in configuring dynamic data to a scenario automation test case.

Providing Dynamic data to the test case

     We can provide dynamic data to the test case in the cases where we need unique values for each execution of the test case.

A predefined Data page D_pyScenerioTestData of type Page is made available to the user through which he/she can provide the dynamic values.

User can populate the DataPage using any source(activity/Data Transform/...) and he/she is supposed to set the dynamic values  in the source.

If we use a Data Trasform say pyScenerioTestData to populate the DataPage, the Data Transform would look like

 

Screen Shot 2018-07-12 at 12.10.20 PM.png

We can use the property populated above in the test case.

Provide dynamic data to the test case from test case rule form.

In this case, the test case needs to be recorded first.Then the dynamic data should be referred in the test case as shown below:

 

Screen Shot 2018-07-12 at 12.17.06 PM.png

 

Next time the test case is ran, we see that "newdyncustomer" is entered in the Lastname field.We can also assert the dynamic values in the same way.

 

Provide dynamic data to the test case while recording:

     The data which we have populated in the Data page can also be referred to while recording any test case.

Screen Shot 2018-07-12 at 12.26.06 PM.png

 

 

Asserting CaseID' s  using regex in test step assertions:

We can also assert the dynamic data like Case IDs which are not the same every time using a regex.This approach can be used when user need not want to assert the exact data but wants to assert the pattern of the data like CaseID.The data which changes needs to be replaced with {} as below:

Screen Shot 2018-07-12 at 12.37.28 PM.png

 

Do let us know in case of any queries.

 

Thanks

Lavanya

April 15, 2019 - 4:18pm
Response to komml1

I am trying to dynamically provide the data in the Scenario Test cases. I am fetching the value of .pyNote from a Data Page D_FetchNote but instead of reading the Data Page, the Test case is reading it as a string. I am unable to see/ download the screenshots you provided above. Can you please explain how did you pass the value using the Data Page..?

Pega
April 16, 2019 - 4:37am
Response to PiyaliS6

Hi,

it seems that D_pyScenarioTestData is the only Data Page that works, the other are interpreted as a text
guess you can fill D_pyScenarioTestData with data from D_FetchNote.

Roberto

May 30, 2019 - 6:17am
Response to komml1

Hi Lavanya,

I dont have access to the attachement,

September 6, 2019 - 6:07am
Response to komml1

Hi,

Not able to access the attached screenshots. Kindly help

Thanks,

Sarika

Pega
April 16, 2019 - 4:50am

Yes D_pyScenarioTestData is the only Data Page that works.But the source for the data page can be customized.

 

Thanks

Lavanya

Pega
April 17, 2019 - 6:43am
Response to komml1

As an example testing the generic "Service Request" case type.
Test case is sourced by DT that uses the 2nd element in another data page ( D_pyProductList1 ).

D_pyProductList1 is the source for the dropdown in the first section (step collect info) of the case
so the test case data is sourced dynamically and from available data.

This can be useful when you move test cases trough environments to avoid they fail because missing reference data. 

Hope this helps
Best regards