ATF test set values not setting values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 07:12 PM
Hi,
I'm having an issue with an ATF Test, following instructions in the DEV training. The Exercise is test a business rule in the NeedIt app. Unfortunatley everything I try fails.
The test steps are:
1. Impersonate user, Fred Luddy
2. Insert NeedIt request setting values for:
when needed: 100 days in the future
Requested for: The impersonated user
Requested for Email: The impersonated users email
3. Record Validation:
when needed: is not empty
Requested for: The impersonated user
Requested for Email: The impersonated users email
Unfortunately it fails everytime on the business rule, checking the When needed date is not in the past or today.
So I tried another test using the Record creation on the form, using the same values:
This also fails but I can see when it runs that the test is not setting any of the values using the set field values!!
Any ideas why this would be?
I'm using London: Build tag: glide-london-06-27-2018__patch1-08-15-2018
Thanks,
Barry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2018 10:22 AM
You're performing ATF regular client side testing, what kind of business rule are you testing? what does this do?
Also, in the failure result, which step is it failing at?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2018 02:42 PM
Sorry I started out testing the business rule, which is supposed to validate that the when needed date is in the future. The business rule works fine if I raise the ticket manually but when I try to run this through the ATF test it fails. So I tried running this so I can see the values being set on the form but it also fails.
The step fails when setting values, the values never get set.
So with the business rule test it is the second step that fails:
2. Insert NeedIt request setting values for:
when needed: 100 days in the future
Requested for: The impersonated user
Requested for Email: The impersonated users email
These values do not get set and it fails the test, every single time.
When I run the test in the form, it says the set values step is successful but fails the validation, because the values have not been set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 08:21 PM
I am having the same problem. Based on what I can see, it looks as though the "Set Values" test step isn't working in this scenario.
I am attempting the same DEV training module, configured in what I expect is the same manner: developer instance running London, working on the NeedIt application duplicated from the ServiceNow GitHub repository, using an ATFModule code branch from the LoadForATFModule tag.
When attempting "Exercise: Create Tests from a Template" in the "Using the Automated Test Framework" module, the "When needed - Future" test fails. I added a gs.info() step to the "NeedIt When needed field date" background script to capture the field values passed into the script and they look empty:
If I deactivate the "NeedIt When needed field date" background script, the test fails on the next background script which checks for a valid email address in the "Requested for email" field.
I also tried to push the workload client side with a test that impersonates a user, opens a new form, sets the values on the form then submits the form. However, the "set values" test step looks like it isn't doing anything. This is a screenshot from the ATF:
Note: The "Requested for" and "Requested for email" fields are populated by a separate client script.
Looking at the logs for the failed tests, it appears values are present but for some reason they just aren't making onto the form or into the record in the "Record Insert" test step. Here is my first attempt at running the test:
Here is the config for the "Insert Record" step:
Note: I can manually perform the test steps without a problem.
If I set a default value (in the future) for the "When Needed" field, the ATF can successfully submit the form (without a "set values" step) and it passes the background script checks. However, this means that the other tests, "When needed - Past" and "When needed - Today" are failing for the wrong reason; the "Requested for email" field is empty. For example:
Do you know what might be causing this error?
Regards,
Paul.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2019 09:04 PM
Is there any chance of hearing back on this one?