Automated Testing Framework – A Layered Approach

Two releases in, Automated Testing within ServiceNow is still largely in an immature state. Consider however, the tall task that is replacing the time-tested approach of actual user testing and you quickly realize the gravity of the situation. Even outside of the ServiceNow platform, no technology has been made readily available to replace the effectiveness of the human element in testing, and it appears that trend will continue for some time. The question then becomes: how does one effectively make use of the Automated Testing Framework right now?

To imagine how ATF operates, liken it to that of a tightly-run military base: orders/instructions are given out, the “tester” must follow those orders precisely, and if they are unable to do so, the test fails. There is no unpredictability in automated testing, no mercurial human element to defy or modify commands to their liking. The machine is simply doing exactly what it is told to do.

At its core, ATF directs users 4 ways: Request Catalog, Form, REST, and Server. Once again, the machine excels at mimicry to the highest degree, thus making it quite good at simple commands such as opening & submitting forms or setting field/variable values. These commands, found in the Request Catalog and Form test step sections, require little to no scripting and will often be used in repetition to input & submit data across various modules in an instance. Now any human can certainly perform these tasks quite efficiently, if they are comfortable navigating around the instance. But let’s assume that they are new to ServiceNow or even worse, veer away from a prescibed test script and choose to experiment. These human testers are now prone to inconsistent clicks and actions, making the results of numerous test cases over time incomparable.

A successful administrator of the Automated Testing Framework will use the consistency of the machine to their advantage. Sure, the tests for forms or Request Catalog Items can be basic and unassuming, but this simplicity serves as a benefit to automated test admins. End-to-end tests can be constructed using basic commands (no scripting involved) in the ATF and the consistency of the framework ensures that these tests can be used time and time again all while ensuring proper functionality. Keep in mind that tests may have to be modified over time to match changing forms or catalog items, but overall, the ATF becomes very adept at running through simple tests efficiently and consistently.

Once you venture outside of bare-bones elements like forms and catalog items, you enter the realm of custom scripting. These more complex actions are found in the REST & Server test step sections and involve things like creating and sending inbound REST requests or testing business rules and script includes. The ATF also employs the use of the Jasmine test framework, an open-source framework built for JavaScript. While experienced developers on the ServiceNow platform will be able to navigate through these more script-heavy actions in ATF, the actual time and effort involved in debugging ATF scripts exposes the lack of simplicity to leverage more advanced testing capabilities.

Despite this, automated testing for ServiceNow shows potential for the future. At the moment, some combination of advanced scripting skills and human testing will be necessary for comprehensive assurance of error free functionality.

2018-08-27T22:07:51+00:00