---
original_url: "https://jace.pro/blog/meetup-lab-automated-test-framework-—-test-smarter-not-harder/"
format: markdown
ai_optimized: true
---

Meetup Lab: Automated Test Framework — Test Smarter, Not Harder- # Meetup Lab: Automated Test Framework — Test Smarter, Not Harder

May 2, 2019 [servicenow](/tags/servicenow/)

  Enable AI AnimationThis lab from the May 2019 ServiceNow Developer Meetup walks through setting up Automated Test Framework tests for Incident Management requirements. Authors: Mike Hedlund, Scott Halverson.
*This lab originally from the [sndevs meetups repo](https://github.com/sndevs/meetups) and [hosted on GitHub Pages](https://sndevs.github.io/meetups/).*

## [Lab Setup](#lab-setup)

Import the [ATF Demo Update Set](./ATF%20Demo%20Update%20Set.xml) into your instance before starting.

## [Create a Test for IM_001](#create-a-test-for-im_001)

Requirement: The ‘ATF is Great’ field shall be ‘read-only’ to all users.

Under ‘Automated Test Framework’ select the ‘Test’ module and click ‘New’
- Name: `(ATF) IM_001`, Description: *The ‘ATF is Great’ field shall be ‘read-only’ to all users.*
- Add Test Step → Server → **Impersonate** — User: `ITIL User`
- Add Test Step → Form → **Open a New Form** — Table: `Incident`
- Add Test Step → Form → **Field State Validation** — Read only: `ATF is Great`
- Select ‘Run Test’ and confirm all steps pass

## [Create a Test for IM_002](#create-a-test-for-im_002)

Requirement: The ‘ATF Demo Notes’ field shall only be visible when the Category field has a value of ‘ATF Demo’.

- Create new Test: `(ATF) IM_002`
- Add Test Step → Server → **Impersonate** — User: `ITIL User`
- Add Test Step → Form → **Open a New Form** — Table: `Incident`
- Add Test Step → Form → **Set Field Values** — Short description: `Test`, Caller: `ITIL User`, Category: `Software`
- Add Test Step → Form → **Submit a Form** — Assert type: ‘Form submitted to server’
- Add Test Step → Form → **Open an Existing Record** — Reference the record submitted in step 4
- Add Test Step → Form → **Field State Validation** — Not visible: `ATF demo notes`
- Add Test Step → Form → **Set Field Values** — Category: `ATF Demo`

- Add Test Step → Form → **Field State Validation** — Visible: `ATF demo notes`
- Run Test and confirm all steps pass

## [Create a Test for IM_003](#create-a-test-for-im_003)

Requirement: The ‘ATF Demo’ button shall only be visible to Users with the ‘atf_demo’ role.

- Create new Test: `(ATF) IM_003`
- Add Test Step → Server → **Impersonate** — User: `ITIL User`
- Add Test Step → Form → **UI Action Visibility** — Not visible: `ATF Demo`
- Add Test Step → Server → **Impersonate** — User: `Auto Test`
- Add Test Step → Form → **Open a New Form** — Table: `Incident`
- Add Test Step → Form → **UI Action Visibility** — Visible: `ATF Demo`
- Run Test and confirm all steps pass

## [Create a Test for IM_004](#create-a-test-for-im_004)

Requirement: A new section shall be added to the Incident form named ‘ATF Demo’ with the ‘ATF is Great’ and ‘ATF demo notes’ fields.

- Create new Test: `(ATF) IM_004`
- Add Test Step → Server → **Record Query** — Table: `sys_ui_section`, Caption: `ATF Demo`
- Add Test Step → Server → **Record Query** — Table: `sys_ui_element`, Element: `u_atf_is_great`, Sys UI Section.table: `incident`, Sys UI Section: `ATF Demo`
- Repeat step 3 with Element: `u_atf_demo_notes`
- Run Test

## [Create a Test for IM_005](#create-a-test-for-im_005)

Requirement: A notification shall be sent to the ‘Caller’ when an Incident record is created.

- Create new Test: `(ATF) IM_005`
- Impersonate User: `ITIL User`
- Open a new Incident form
- Set Field Values: Short description: `Test`, Caller: `Auto Test`
- Submit the form
- Select custom test config ‘Notification Check’
- Notification: `Incident opened for me`, Document: record from step 4, Recipients: `auto.test@example.com`
- Run Test

## [Create and Run the IM Test Suite](#create-and-run-the-im-test-suite)

- Under ‘Automated Test Framework’ select ‘Suites’ and click ‘New’
- Name: `IM Test Suite`, Description: `ATF Demo`
- Add each of the 5 individual Tests to the suite
- Select ‘Run Test Suite’ and confirm all pass

---
[View this page on GitHub](https://github.com/jacebenson/jace.pro/tree/main/./src/posts/2019/2019-05-02-meetup-atf-lab.md).

[Meetup Lab: Automated Test Framework — Test Smarter, Not Harder](https://jace.pro/blog/meetup-lab-automated-test-framework-%E2%80%94-test-smarter-not-harder/) [Jace Benson](https://jace.pro) ![Jace Benson](https://jace.pro/icon-512x512.png)

---

*This content is from Jace Benson's ServiceNow and tech blog at jace.pro*
*Original post: https://jace.pro/blog/meetup-lab-automated-test-framework-—-test-smarter-not-harder/*
