How to create an IVR spike test using TestIVR

In this post we are going to develop an IVR spike test using TestIVR

In the previous article I discussed how you can implement an IVR stress test using TestIVR API. I also discussed how you can implement IVR experience tests and IVR load tests using TestIVR API in previous articles. In this post I am going to discuss IVR Spike Testing and how you can implement an IVR Spike Test using TestIVR.

IVR spike testing, evaluates if systems can handle a sudden surge in traffic. This sudden increase in traffic is often referred to as a “spike”. IVR spike testing is important because it can help identify potential system issues that may not be apparent during normal system usage. During an IVR spike test, a very large number of calls are generated and directed to the system under test at once. The system's performance is then monitored to see how well it handles the large load of traffic. This testing can help to identify any areas of the system that may need to be improved in order to handle a high volume of calls. So let's discuss how we can implement an IVR spike test using TestIVR.

After signing up the TestIVR web portal will provide you with an "API key" which can be used to call the TestIVR RESTful API. Using the API key you can call the TestIVR spike testing tool via different tools such as "curl", python libraries such as "requests".

The TestIVR API end point is https://api.testivr.com/. Keep in mind that in all your API calls to TestIVR API endpoint, you should add your "API key" in a Header called "Authorization" and you need to add "Api-Key " at its begining. So for instance in "curl" you will have something like (replace XXXXX with your "API key"):


curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Api-Key XXXXX" \
  -d '{
    "description":"sample path"
  }' https://api.testivr.com/path/
                

Or in python:

import requests

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Api-Key XXXXX',
}

json_data = {
    'description': 'sample path',
}

response = requests.post('https://api.testivr.com/path/', headers=headers, json=json_data)
                

Similar to stress test, experience test and load test, to develop an IVR spike test using TestIVR, you should start with creating a "path". As discussed in the previous articles, a "path" is basically a route for your test to follow. Later you can add "action"s (such as dialing a button or saying something to the IVR) to this path. Here I am going to use the same path and actions I created in another article. We need the id of that path for our spike test which in this case was "3". We can take a look at that path by submitting a GET request to path/ endpoint and passing 3/ as the url parameter:

curl --request GET \
  -k \
  --url https://api.testivr.com/path/3/ \
  --header 'Authorization: Api-Key XXXXX'
                

The API will response with something like this:

{
  "count":1,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":3,
      "created_at":"2022-10-24T23:15:41.262451Z",
      "description":"path to sales",
      "user":1
    }
  ]
}
              

To see the "action"s created on path "3" you can submit a GET request to action/ endpoint and pass the path id as a parameter like ?path=3:

curl --request  GET \
    -k \
    --url https://api.testivr.com/action/?path=3 \
    -H "Authorization: Api-Key XXXXX"
              

And the response will be:

{
  "count":4,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":3,
      "created_at":"2022-10-24T23:17:34.962940Z",
      "order":0,
      "type":"listen",
      "value":"Hello, how can we direct your call? Press 1 for sales, or say sales. To reach support, press 2 or say support.",
      "description":"listening to the ivr intro",
      "asr_threshold":0.9,
      "pause_before":0.0,
      "pause_after":0.0,
      "user":1,
      "path":3
    },
    {
      "id":4,
      "created_at":"2022-10-24T23:22:34.685174Z",
      "order":1,
      "type":"press",
      "value":"1",
      "description":"press 1",
      "asr_threshold":0.9,
      "pause_before":0.0,
      "pause_after":1.0,
      "user":1,
      "path":3
    },
    {
      "id":5,
      "created_at":"2022-10-24T23:24:28.167247Z",
      "order":2,
      "type":"listen",
      "value":"You asked for sales, please hold",
      "description":"listening to the prompt",
      "asr_threshold":0.9,
      "pause_before":0.0,
      "pause_after":1.0,
      "user":1,
      "path":3
    },{
      "id":7,
      "created_at":"2022-10-25T00:45:29.329226Z",
      "order":3,
      "type":"command",
      "value":"terminate",
      "description":"terminating the call",
      "asr_threshold":0.9,
      "pause_before":0.0,
      "pause_after":0.0,
      "user":1,
      "path":3
    }
  ]
}
              

In the above actions, the test basically first listens for an intro from the IVR system. Then it dials the number 1 on the keypad. Then it listens for another prompt, and at the end it terminates the call. You can read more detail about how we created the above actions in IVR experience testing article.

The next step is to setup the spike test using the defined path. You can do that by submitting a POST request to /general/test/ endpoint and set test_type to spike. Important parameters to pass are:

      path: the path you want to use for your test (in our example this is set to "3").
      phone: the phone number of the IVR system you want to run the test on.
      calls: the total number of calls you want to run for the spike test.
      levels: for stress testing we only run one level of calls levels should be set to "1"
      test_type: the type of the test, in this case you should set it to spike.

For spike testing, TestIVR will make several simultaneous calls to the IVR system at once. The total number of calls in will be equal to the value passed as calls parameter above. For instance if you pass "600" for calls, TestIVR will make all those 600 calls at once.

In our case I am going with:

curl -X POST \
  -k \
  --url https://api.testivr.com/general/test/ \
  --header "Content-Type: application/json" \
  --header "Authorization: Api-Key XXXXX" \
  --data '{
      "name": "sales path spike test ",
      "description":"spike test for sales path",
      "path": 3,
      "phone": "16506839455",
      "levels": 1,
      "calls": 5,
      "test_type": "spike"
  }'
                

And the result will be like this:

{
  "status": "OK",
  "data": {
    "id": 3,
    "created_at": "2022-11-19T23:10:13.299651Z",
    "description": "spike test for sales path",
    "name": "sales path spike test",
    "phone": "16506839455",
    "levels": 1,
    "calls": 5,
    "test_type": "spike",
    "user": 1,
    "path": 3
  }
}
                

From above you need to keep in mind what is the id for your new spike test, which in this case is "3".

Now the spike test will run. Keep in mind that each run will have separate set of outcomes, a run can fail due to various reason such as IVR system declining the call, or the promopt doesn't match the expected values.

If you need to pull the outcomes you need to first pull the test id, to do that you can submit a GET request to /general/run/ endpoint:

curl -X GET \
 -k \
 --url https://api.testivr.com/general/run/ \
 --header "Content-Type: application/json" \
 --header "Authorization: Api-Key XXXXX"
                

The output goning to be like this:

{
  "count":17,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":17,
      "created_at":"2022-11-19T23:10:15.237106Z",
      "user":1,
      "load_test":3,
      "test":26
    },
    ...
    {
      "id":13,
      "created_at":"2022-11-19T23:10:13.528811Z",
      "user":1,
      "load_test":3,
      "test":22
    },
    ...
    ]
}
              

You see for the load_test with id "3" we have total of five results, each for one of the calls made to the system. To see the outcome of each test you need its test id. So for instance to see the outcome of the test with id "26" (first one above), you can submit the following request:

curl -X GET \
  -k \
  --url https://api.testivr.com/outcome/?test=26 \
  --header "Content-Type: application/json" \
  --header "Authorization: Api-Key XXXXX"
              

Note that we are filtering the outcomes based on the test id by adding ?test=26 to the request. The result will be like:

{
  "count":2,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":36,
      "created_at":"2022-11-19T23:10:30.697630Z",
      "outcome":"not_match",
      "value":"how can we direct your call press one for sales or say sales to reach support press two or say support",
      "expected_value":"Hello, how can we direct your call? Press 1 for sales, or say sales. To reach support, press 2 or say support.",
      "match_ratio":0.8867924528301887,
      "user":1,
      "test":26,
      "action":3
    },
    {
      "id":41,
      "created_at":"2022-11-19T23:10:40.744337Z",
      "outcome":"match",
      "value":"you asked for sales please hold",
      "expected_value":"You asked for sales, please hold",
      "match_ratio":0.9523809523809523,
      "user":1,
      "test":26,
      "action":5
    }
  ]
}
              

In the response, each items of the resuls shows the outcome of one of the "actions" we had on the "path". We can see the "action" id in the action field of the response.

This article shows how you can create a simple spike test for IVR using TestIVR. Please let me know if you have any question through our email: support@testivr.com

We also provide a good document on our API which provides more detailed information on all the calls you can make to TestIVR.