Question
Appriss, Inc
US
Last activity: 17 Jul 2018 16:43 EDT
Testing a read-only property doesn't work
I created a When rule that tests the value of a property that happens to be read-only. It's a value that gets written once when the user logs in, but is read-only after that.
I'm trying to test the when rule using several values. However, because the property is read-only it does not get set during the test case. And so when I do the following tests, it fails on the second step with Expected true, Actual false.
Is there a way around this situation or should there be an enhancement request or is it working as designed?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Appriss, Inc
US
Since I am trying to test a property associated with the currently logged in user, it doesn't seem possible to change the value. I'll just have to explain away the warning.
EPAM Systems, Inc.
ES
I couldn't understand your use-case properly, apologies for that.
Could you explain, how you're configuring the value of the property at first place? Is it configured, as part of any flow?
Is it constant for all the cases? Or once the user logged in, it's configured. Based on it, we could it figure out where the value is lost.
Suggestions regarding configuring the property value:-
User Level:-
- Invoking a data transform or activity to configure this property after authentication activity.
- Data Page loaded through Data Transform with the desired value at Requestor Level.
- An agent configured with an activity to be called after authentication.
Case Level:- The property value could be configured at case level through a data transform which could be configured at Case Type Rule for initialization.
Hope it gives you a brief idea. Kindly respond to my queries such that we could assist in a better way.
Regards,
Asif
Anamata
NL
Hi Jeff,
Assuming you have created a Test Case for this When rule: did you add a setup to this test to set the property value?
Regards,
Bas
Updated: 28 Jun 2018 11:51 EDT
Appriss, Inc
US
@Bopstal I did not add a setup / teardown for the test. I did create a new when rule, used another property that could be written to and it worked fine.
@Asif_Hasan I didn't setup the property, so I'm not exactly sure. The use case is, the user logs in and these static properties are initialized. Of course, once initialized, they can't be changed, even for testing.
I'll give your suggestions a try.
Pegasystems Inc.
US
Here is context of Jeff original issue.
He created a When rule IsAPMUser. The rule IsAPMUser has an expression that is checking the value of a property in a Page, however, the page is pointing to a Data Page that is readonly. The When rule works but his TestCase was failing when testing for true condition.
In working with him on the issue, we found out that the TestCase behave as expected if the property being tested is not on a readonly data page.
He just wanted to know if there are other suggestion(s) for his situation?
Pegasystems Inc.
IN
Read only datapage shouldn’t create any problem unless you are trying to modify the property values .
in your case you are trying to fetch one of the property in datapage and use it in when condition ,is it able to read the value properly ?
Let us know the Pega version and screenshot of when rule so that we can have a look at it once .
Thanks,
Arun
Anamata
NL
In which context are you running the WHEN rule?
Possible sollutions to your test data problem:
- If it's not possible to generate test data for the page list, modify the data that your data page is fetching.
- Create a copy of the data page into your development/test application and configure it as editable. This version will overrule the version in your application. You should be able to modify data now.
Regards
Michel
Accepted Solution
Appriss, Inc
US
Since I am trying to test a property associated with the currently logged in user, it doesn't seem possible to change the value. I'll just have to explain away the warning.