How to test drop down values for a field using ATF on any form .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019 05:46 AM
How to automate test case using ATF to check whether a field has all required drop down values as mentioned by the customer.
For eg :
State has Open,Resolved ,WIP,Pending etc .
So how to check using ATF that the respective field has proper mentioned drop down values by the customer .
- Labels:
-
Automated Test Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2024 06:45 AM
yes, @Hasan6 May I know which version of plugin you are using?
Vinuthna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 02:34 AM - edited 02-04-2025 03:00 AM
Hello,
To validate the choices, the simpliest way is to check records are available in the "Choice" table, for the specific language, maybe at a specific position or with dependant value, to validate the specific label.
You can implement this method using a "Record Query" action on "Choice" [sys_choice] table, but you'll need as many actions as there are choices to test.
The other way is to use "Run Server Side Script", using glide records and loops to check the choices. Probably a better way to check the choice order.
A code snippet to put in a "Run Server Side Script" function, to check the incident states in french (for exemple):
var choice_list = new GlideRecord("sys_choice");
choice_list.addEncodedQuery("name=incident^element=state^inactive=false^language=fr");
choice_list.orderBy('sequence');
choice_list.orderBy('label');
choice_list.query();
var labels = ["Nouveau", "En cours", "En attente", "Résolu", "Fermé"];
// Check the labels and the record
var ind = 0;
for (; ind < labels.length && choice_list.next(); ++ind) {
assert("Label " + ind, labels[ind], choice_list.getValue('label'));
}
// There are no more labels to check and no more item in list
assert("No more labels to check", labels.length, ind);
assert("No more choices in list", false, choice_list.hasNext());
function assert(name, shouldbe, value) {
assertEqual({
name: name,
shouldbe: shouldbe,
value: value
});
}
Loïc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 03:02 AM
@Robert129 , An alternative way to check the choices of a variable on the portal form is:
Create test step 1 - "Open a RP (SP)",
Step 2 - "Set variable values (SP)" and select a dropdown to validate.
Run the test script, and once it succeeds, update the variable value to another dropdown. This process ensures that all choice lists are validated.
Please mark reply as Helpful/Correct, if applicable. Thanks!