Use AT to validate a choice is NOT in a list

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello,
I have a use case for the Assigned to field where it is filtered based on several criteria. I would like to create an ATF Test to validate that the invalid options are not in the list. There does not seem to be an assert type associated with setting values on the form, it either succeeds and passes the test or does not succeed and fails the test. I can't tell it to expect a failure and continue the test.
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@George P - To validate 'Assigned to' field values via ATF you can use Test Step - 'Field Value Validation'
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
My thoughts
-> ServiceNow ATF does not directly support a built-in “negative assertion” step for reference or dropdown fields, meaning you cannot natively expect a value to be missing and have the test pass when it is.
-> best practice is to use the Field Values Validation test step to check for correct positive options (i.e., only the expected valid choices are available), but there is no out-of-the-box step to assert that a value is specifically “not present” in the dropdown for reference fields
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
This was how I was seeing it as well. But the request is to remove invalid users and that is what I am trying to test.
Is there a script test that could access g_form to attempt to set the values? The script would then handle the failure as success use case. I just haven't found such a test step that would do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you can try to use Run Server Side Script step.
But that's not full proof solution.
You will have to stay with ATF limitations.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader