GitHubContribute in GitHub: Edit online

copyright: years: 2019 lastupdated: "2023-02-12"


Configuring workers for Voice Agent Tester

You can create a worker to manage tests. A worker contains the outline of which number to call to run test cases against.

A worker, which contains the following information, manages the tests:

  • A list of test cases IDs that the worker uses when the worker runs the tests
  • The number of times that the worker runs all the test cases
  • The number of failures that the worker tolerates before the tests that are running fail
  • A call definition of who the worker calls to run tests

Creating a worker

To create a worker, first create a JSON object and then do a POST request for the JSON object.

You can use the following example to create your JSON object:

Each test case in the following example represents a separate phone call. All test cases run sequentially.

{
    "name" : "payment worker",
    "description" : "This worker tests all flows related to making a payment",
    "namespace":"dev",
    "iterations" : 20,
    "failuresToIgnore": 2,
    "callDefinition": {
      "tenantId":"17873345644",
      "to": "sip:testee@someplace",
      "from": "sip:tester@someplace",
      "tenantConfig":{
        "config":{
          "tenantURI":"sip:someone@someplace.com"
        },
        "updateMethod":"merge"
      },
      "route":["sipSomewhere"]
    },
    "cases" : [
        {"caseId": "guid"},
        {"caseId": "guid"},
        {"caseId": "guid"}
    ]
}

The following table describes the properties for the JSON object:

Table 1. Properties for the JSON object
Property Description
name Specifies the name of the worker
description Optionally specifies a more detailed description of the worker
namespace Optionally specifies a group to which a test case is bound. If no namespace is specified, the namespace is default.
iterations Specifies the number of times that the worker runs all the test cases. When you set the value to 0, the worker runs a never ending job. When you run with a value of 0, modify the job to stop or pause the worker.
callDefinition Specifies the definition of how the outbound call is started. The "tenantId" URI is the URI of the tenant that starts the outbound call. The key-value pairs for the outbound call body require to and from values, but they also accept values of tenantConfig and route. For more information, see Making outbound calls using REST API.
failuresToIgnore Optionally specifies the number of failures to ignore before the job fails. If the property isn't defined, the job runs to completion no matter how many failures it has.
cases Specifies a list of test case IDs to run for a single iteration.

Next, create the worker by entering a POST request for the JSON object that you created in the previous sub-step.

Use the following example:

POST /voice-agent-tester/v1/worker

If the POST request is successful, a 201 CREATED response is returned. This response includes the GUID of the worker that you created. You use the GUID to manage the worker.

Additional requests to manage workers

  • To get the worker JSON object associated with a specific ID, use a request similar to the following example:

    GET /voice-agent-tester/v1/worker/<worker-id>
    

    The following example shows the JSON object that can be returned on a GET request:

    {
      "id":"guid",
      "rev":"version",
      "name" : "payment worker",
      "description" : "This executor tests all flows related to making a payment",
      "iterations" : 20,
      "callDefinition": {
        "tenantId":"17873345644",
        "to": "sip:testee@someplace",
        "from": "sip:tester@someplace",
        "tenantConfig":{
          "config":{
            "tenantURI":"sip:someone@someplace.com"
          },
          "updateMethod":"merge"
        },
        "route":["sipSomewhere"]
      },
      "cases" : [
          {"caseId": "guid"},
          {"caseId": "guid"},
          {"caseId": "guid"}
      ],
      "jobs" : [
          {"jobID": "guid"},
          {"jobID": "guid"}
      ],
      "batchJobs" : [
          {"jobID": "guid"},
          {"jobID": "guid"}
      ]
    }
    

The following table describes additional properties for the JSON object:

Table 4. Additional properties for the JSON object
Property Description
id Specifies the GUID for the worker
rev Specifies the current version of the worker
jobs Specifies an array of jobs started by the worker
batchjobs Specifies an arrray of batch jobs started by the worker
  • To modify an existing worker by using a PUT request, use a request similar to the following example:

    PUT /voice-agent-tester/v1/worker/<worker-id>
    
  • To delete a worker by using the DELETE request, use a request similar to the following example:

    Deleting a worker deletes all the job data for the worker that ran or for the worker that is running.

    DELETE /voice-agent-tester/v1/worker/<worker-id>
    
  • To get a list of all workers in the query namespace by using a GET request, use a request similar to the following example:

    GET /voice-agent-tester/v1/worker?namespace=<your_namespace>
    
  • To delete all the workers in the query namespace by using a DELETE request, use a request similar to the following example:

    Deleting all the workers deletes all the job data for all the workers that ran or for all the workers that are running.

    DELETE /voice-agent-tester/v1/worker?namespace=<your_namespace>