How To Test Your SLAs Using ATF

by snnerd
852 views

Why Automated Testing Matters for SLAs

Ensuring your ServiceNow SLAs perform as expected over time is essential—mistakes can lead to costly service disruptions or penalties. Whether creating Reusable Contractual SLA Definitions or learning how to safely modify SLAs in ServiceNow (written by my colleagues Kieran Jones and David McDonald, respectively), robust testing is crucial. In this guide, we’ll explore how the Automated Test Framework (ATF) can streamline SLA testing, helping you verify critical components such as start, stop, pause, and cancel conditions.

A SLA Definition record in ServiceNow

Imagine you’re managing SLAs across multiple regions with varying priorities and schedules. By identifying shared patterns and consolidating tests, you avoid redundancy and ensure each SLA performs as expected, regardless of location.

Using ATF, you not only save time but also create a reliable, repeatable framework that reduces the need for manual validation. As SLAs evolve, automated tests ensure stability and compliance without additional overhead.

Step 1: Identify repeating patterns

Look at a particular set of SLA measures (e.g. response, resolution, e2e) and identify their common conditions. You might get this from a design document, a contract, or, if creating regression tests, existing SLA Definitions.

Screenshot of Priority Resolution SLAs – Notice the recurring patterns in start, stop, and pause conditions.

In the example, we are looking at existing configurations. From the screenshot above, we observe the following patterns:

  • Start condition always checks for priority
  • Stop and pause conditions are the same

This will set the foundation for our Shared Parameters and Test Steps.

We have now identified that we will need to test.

  • Duration
  • Start condition
  • Pause condition
  • Stop condition

This may differ depending on the patterns you identify. For example, if you work with different timezones, you may wish to test Schedule, too.

Step 2: Create Parameter Definitions

We can test all our SLA Definitions in a single ATF Test using some good design techniques!

To enable Parameter Definitions on an ATF Test, select the Enable parameterized testing field. This can be done at any time.

Enabling parameterized testing on an ATF Test

After saving the record, the Parameter Definitions tab will be revealed.

Parameter Definitions Related List

We have four SLA definitions, each with its duration. Regardless of the patterns identified, we will need two Parameter Definitions for SLA Definition and Duration. If you plan on creating many more SLA Tests, you may consider creating Shared Parameters so they can be used across all your Tests. In this example, we will just use Exclusive Parameters.

Creating Parameter Definitions is similar to creating fields. Create one Reference field for the contract_sla table and another for the Duration type.

Parameter Definitions for SLAs

Now, we need a Parameter definition for each non-static pattern we identified.

Each SLA started with a different priority, but they all started with a priority. Priority is set by impact and urgency, so we will need parameters for those. Create two new String Parameter Definitions, as Impact and Urgency are choice fields. You can also use a Choice field if you wish.

Impact and Urgency Parameter Definitions

These parameters will allow us to Test all our SLA Definitions within a single ATF Test, making it easier to create and maintain.

Step 3: Populate your Parameter Definitions

Now, we are ready to load the data we need. Select the Test Run Data Sets and create entries for all our definitions. If you have many permutations, you can do this via bulk load. Consult your priority matrix to determine the correct combination of Impact and Urgency for the Priority you wish to use.

Test Run Data Sets for SLA Definitions

Our Parameter Definitions and Test Run Data Sets aren’t much use without Test Steps, so lets create them now!

Step 4: Create Test Steps

To test our SLA Definitions end to end, we can follow these steps:

  1. Impersonate a user
  2. Create a new Incident
  3. Populate Impact and Urgency
  4. Populate any other mandatory fields
  5. Save the record
  6. Check correct SLA has started
  7. Set State to On Hold
  8. Check SLA has paused
  9. Set State to Resolved
  10. Check SLA has paused
  11. Set State to Closed
  12. Check SLA has stopped

In our test steps, we will populate the SLA definition using parameter definitions, including durationimpact, and urgency.

Populate Parameters in Test Steps using the pill picker and selecting Parameters.

Using Parameters in Test Steps

The result is as follows:

17 Reusable Test Steps to test four SLA Definitions!

Execute our Test

It is time to execute our Test!

Since we have created 4 Test Data Runs, the Test will run 4 times.

SLA Test Execution with Parameters

If you want to reference my Test, download them from ServiceNow Share, which includes the tested OOB SLA Definitions.

TLDR

  • Identify repeating SLA patterns (e.g., start conditions, pause conditions).
  • Set up Parameter Definitions in ATF for streamlined test configuration.
  • Create Test Run Data Sets for each SLA Definition.
  • Develop Test Steps that simulate SLA lifecycle conditions (start, pause, stop).
  • Execute and validate to ensure SLAs function as expected.

Related Posts

2 comments

Jayanthi October 28, 2024 - 7:11 pm

How do you test the Sla if its breaching or not using atf

Reply
Avatar photo
snnerd October 29, 2024 - 4:49 pm

Check the expected breach time on the Task SLA record is the expected value (+duration in schedule)

Reply

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More