ATF - Record Query to Find User - Then Impersonate - Then Set Assigned To

Laurie Marlowe1
Kilo Sage

Hello,

I'm just starting with ATF to convert as many of our manual tests to ATF.  First test, I'm trying to create an incident, fill out the form, assign to Service Desk and assigned to person.  I tried Create User to do this and it would not work.

find_real_file.png

The issue I'm seeing is when doing Field Values Validation, the Assigned To field is empty.

Step 2 - Record Query to find a Service Desk member

Step 3 - Impersonate Service Desk member (from step 2)

Step 4 - Open new form by impersonator

Step 8 - Set Assigned To as Service Desk member (from impersonate)

Then BOOM! it doesn't set the Assigned To.

What am I doing wrong?  Any help is greatly appreciated!

Thanks,

Laurie

 

1 ACCEPTED SOLUTION

Hi Laurie,

Yes steps can be shortened here:

like step no 4, 5 and 6 into one step called 'Record Insert' and similarly for step no 8 to 12 can be shortened as 'Set Field values' and 'Field Value validation'. Hope that much should serve the purpose.

Warnings we can ignore unless until there is an error we are good with the test steps.

 

Please mark this answer as helpful if it helped you.

 

Thank,

Mohit Kaushik

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

5 REPLIES 5

Mohit Kaushik
Mega Sage
Mega Sage

Hi Laurie,

Well there is always a best practice to find the reason of test failure, which you can get in test results.

I can see that the value you trying to set into "Assigned to" field is an invalid reference. Because assigned to is reference field to sys_user table but the record which you are getting in your step 2 that is a reference to Group Member[sys_user_grmember] table and that is not similar to User[sys_user] table. And there is one more thing in your test results, please check for the impersonate test it must be showing that impersonated user not found in system. 

Can you tell me the exact error which you saw in your test result. Is it some thing like this

"FAILURE: Failed to set field 'assigned_to' to value 'SOME SYS ID' because the reference is NOT valid".

If that is so then the reason i already told you above.

 

Please mark this answer as correct and helpful if your query is resolved.

 

Thanks,

Mohit Kaushik

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi Mohit,

Thank you for the explanation about assigned to and using the wrong table.  Makes perfect sense.  What I'm trying to accomplish is not impersonating a Service Desk user.  But creating or querying a Service Desk user, then have that user's name be populated in the assigned to field of the ticket.

I made some corrections.  Would you tell me if I have too many steps to accomplish this?  Also, do I need to be concerned about the warnings?

New steps

find_real_file.png

New Results

find_real_file.png

Warnings

find_real_file.png

Thank you for your time.  I really appreciate it.

Laurie

 

Hi Laurie,

Yes steps can be shortened here:

like step no 4, 5 and 6 into one step called 'Record Insert' and similarly for step no 8 to 12 can be shortened as 'Set Field values' and 'Field Value validation'. Hope that much should serve the purpose.

Warnings we can ignore unless until there is an error we are good with the test steps.

 

Please mark this answer as helpful if it helped you.

 

Thank,

Mohit Kaushik

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Thank you so much Mohit.  Your responses were very helpful.