- 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-09-2020 11:41 AM
Yes. You can query the sys_email table for records created relative past 1 minute that contain whatever identifiable information from that notification. For example, subject contains FIRST NAME. This is the only real way to query for emails sent out from ATF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2020 08:21 AM
Hm I queried the sys_email table and found no email. However, when I set the recipient as an existing user, the email was generated...For the created user in ATF, is there no way for them to receive an email?

- 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:05 AM
Ah, that would do it. Were you able to set roles and groups for the user as well?
edit: ah i can insert a record into sys_user_has_role with the created record from the earlier step