- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2020 11:40 AM
Is there a way to test email notifications for a user I created in ATF?
Solved! Go to Solution.
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2020 08:41 AM
Hi Justin,
I've encountered this exact scenario. Unfortunately, the 'Create a User' step does not let you set the user's email address. What I did to get around this was to use a 'Record Insert' step to insert a record into the sys_user table, where I set the user's email address. It does not have to be a realistic email address.
Then my email query was able to find the inserted user's fake email address under 'Recipients'.
ServiceNow ATF rolls back so my user record insert was rolled back/deleted at the end of my Test.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2020 09:38 AM
Hi Justin,
Yes you can set the Group within the same 'Record Insert'. Just set the 'Primary Assignment Group' field value to the name of the Group. Obviously, the Group should have the relevant roles, so the inserted user will automatically gain those roles. I find it much easier to keep it all in the same 'Record Insert' rather than having a 2nd 'Record Insert' into the sys_user_has_role table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2020 09:45 AM
In addition to the other comment...
If you are trying to query an email for a particular record created, you can reference the 'Target' field to the record that was created in an earlier step. This will pull the email(s) for the exact record.
You can also query the 'Recipients' field by setting the 'Recipients' to CONTAINS the user's email address.
I would suggest combining both the 'Target' and 'Recipients' to pull the precise email record. Pulling only the 'Recipients' will query all email records for that person.