ATF test set values not setting values

Community Alums
Not applicable

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

find_real_file.png

 

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:

find_real_file.png

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

 

 

 

 

 

 

 

10 REPLIES 10

Nitesh Balusu
Giga Guru

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?

Community Alums
Not applicable

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.

 

PaulP
Kilo Contributor

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:

find_real_file.png

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:

find_real_file.png

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:

find_real_file.png

Here is the config for the "Insert Record" step:

find_real_file.png

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:

find_real_file.png

Do you know what might be causing this error?

Regards,

Paul.

PaulP
Kilo Contributor

Is there any chance of hearing back on this one?