Software testing is an integral part of the development cycle as it ensures the quality and meets the desired deliverables. Today, automation is preferred over manual testing to test the development cycle quickly and effectively.
This need for automation is fulfilled by the Automated Test Framework (ATF). 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, during any customizations.
- Reduction in the cost, manual errors, testing time
- Improvement on the business value and agility
- Testing UI changes without breaking the tests
- Automating the cycle and providing the control and stability
Note: The Automated Test Framework is not advised to run in ServiceNow production instance environments.
Few of the important reasons why we should not run ATF on our production instance:
- Running ATF tests slows 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 action or assertion 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 rolls back changes after testing it.
Once each ATF test has 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.
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 test step 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 ATF system property to enable tests and test suites to run is defaulted for all ServiceNow instances.
About the Author
Manjusha Verma, Software Engineer, Cloud ADM – ESM