Software testing is integral to the development cycle as it ensures quality and meets the desired deliverables. Today, automation is preferred over manual testing to test the development cycle quickly and effectively.
The Automated Test Framework (ATF) fulfills this need for automation. It enables us to create and run automated tests to confirm that our instance works as expected, even after changing, for example, after an upgrade or during any customizations.
- Reduction in the cost, manual errors, and testing time
- Improvement in the business value and agility
- Testing UI changes without breaking the tests
- Automating the cycle and providing control and stability
Note: The ServiceNow automated test framework is not advised to run in production instance environments.
Here are a few of the important reasons why we should not run ATF on our production instance:
- Running ATF tests slow down instance performance
- Changes made within an ATF test would be visible to users before the rollback
- Actionable events, such as email notifications to customers or approvals to managers, would be triggered from data changed by ATF tests
- Sensitive production data could be seen when impersonating a user
- Audit history of data changes would remain even after data rollback
Elements of ATF: The essential elements used to develop ATF testing include:
- Test suites
- Test steps
A test suite is a group of tests that are typically performed at the same time.
An ATF test is a set of actions and assertions to verify an expected result. Individual test steps represent actions or assertions within the test.
A test step represents a single action or assertion within a test, such as opening a form, impersonating a user, or setting a field value. There can be various steps in one test, as shown below.
The below diagram explains the whole process included in ATF:
Rollback functionality of ATF:
The Automated Test Framework tracks data created by running tests and reverses changes after testing it.
Once each ATF test has been completed, any instance changes made during the individual test are rolled back:
- New records are deleted.
- Deleted records are restored.
- Updated records are reverted to previous values.
Impersonate users are unimpersonated:
ATF tests impersonate users while doing the work. The impersonated user is automatically unimpersonated at the end of the test.
A few other important points regarding ATF are as follows:
- The output values from one test step can be used as the input value for another stage within the same test. Output values cannot be used as input values for the test steps from another test.
- Each test step runs independently and is isolated from any other test.
Note: The ServiceNow automated test framework system property enables tests and test suites to run defaults for all instances.