copyright: years: 2019 lastupdated: "2019-06-14"
Configuring jobs for Voice Agent Tester
You can create a job to run test cases for a single worker. A job contains, among other information, all the results of the tests cases that run, the status of the job, and the percent completion of the test cases.
A single worker can run many jobs, either sequentially or in parallel, over a long span of time. Jobs are mapped to the namespace of the worker that starts it. Each job contains its status while the job runs, and results after the job completes.
-
Create a job for a particular worker by issuing a POST request similar to the following example:
POST /voice-agent-tester/v1/worker/<worker-id>/job
A job starts itself immediately on creation. When you create a new job with a post, a job ID is returned. You can use this job ID to check the job status, and to stop, pause, unpause, or restart the job.
-
Enter a GET request to get the job status, including the results.
GET /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>
If you make a GET request for a job that is running, the JSON object that is returned looks like the following example:
{ "id": "guid", "startTime": "timestamp", "status": "running", "percentComplete": 45, "iterationNumber": 10, "turnNumber": 3, "caseNumber":0, "casesExecuted": [ { "caseId": "guid", "latestRev": "latest version of test case ran", "statusDuringExecution": "status of the test case while executed" } ], "workerUsed": { "id": "guid", "rev": "version", "namespace": "demo", "iterations": 1, "failuresToIgnore": 3, "callDefinition": { "tenantId": "16152059387", "to": "sip:16152059388@9.27.110.136:5070", "from": "sip:16152059387@9.27.110.136:5060" }, "cases": [ { "caseId": "guid" } ], "jobs": [ { "jobID": "guid" } ], "batchJobs": [ { "jobID": "guid" } ] }, "currentCase": { "id": "guid", "rev": "version", "name": "Name", "description": "decription", "namespace": "demo", "turns": [ { "receive": { "type": "substring", "value": "name" }, "send": { "type": "string", "value": "Yes" } } ] }, "results": { "numberOfFailures": 0 } }
If you make a GET request for a job that completed, the JSON object that is returned looks like the following example:
{ "id": "guid", "startTime": "timestamp", "stopTime": "timestamp", "status": "completed", "casesExecuted": [ { "caseId": "guid", "latestRev": "latest version of test case ran", "statusDuringExecution": "status of the test case while executed" } ], "workerUsed": { "id": "guid", "rev": "version", "namespace": "demo", "iterations": 1, "failuresToIgnore": 3, "callDefinition": { "tenantId": "16152059387", "to": "sip:16152059388@9.27.110.136:5070", "from": "sip:16152059387@9.27.110.136:5060" }, "cases": [ { "caseId": "guid" } ], "jobs": [ { "jobID": "guid" } ], "batchJobs": [ { "jobID": "guid" } ] }, "results": { "numberOfFailures": 1, "failures": [ { "time": "timestamp", "error": "error that occured", "testCaseID": "guid of test case", "testCaseName": "name of test case", "turnNumber": 8, "iteration": 15, "sipCallID": "guid of call" } ] } }
Job structure
The following table describes the job structure:
Key | Description |
---|---|
ID | Specifies the GUID of the job. |
status | Specifies the current job status. |
startTime | Specifies the time stamp of when the job started. |
stopTime | Specifies the time stamp of when the job finished, whether it finished successfully or failed. |
percentComplete | Specifies the percentage that is completed for the job. If you're running infinite iterations, this information isn't included. |
iterationNumber | Specifies the number of the iteration that the job is in. |
caseNumber | Specifies which test case of the worker test cases it's running. |
turnNumber | Specifies the turn number that the job is on in the current test case. |
casesExecuted | Specifies the following information: An array of test cases that the job ran; The latest version of each test case that the job ran; Whether the test case was changed or deleted during the running of the job. |
workerUsed | Specifies the worker definition that was used to run the job. |
currentCase | Specifies the test case that the job is running. |
results | Specifies the JSON object with the number of failures that occurred and an array of details for each failure that occurred. |
Job status
The following table describes the possible status of a job:
Status | Description |
---|---|
created | Specifies that the job was created. |
starting | Specifies that the job is starting. |
re-starting | Specifies that the job is running and that it restarts when given the chance. |
running | Specifies that the job is running. |
completed | Specifies that the job finished successfully. |
failed | Specifies that the job exceeded the maximum number of failures to ignore, as defined in the failuresToIgnore key for the worker. |
paused | Specifies that the job is paused. |
pausing | Specifies that the job is in the process of pausing. |
stopped | Specifies that the job is stopped. |
stopping | Specifies that the job is stopping. |
invalid | Specifies that the worker that was used for the job isn't valid, or that something went wrong in the call when the jobs were running. Maybe a test case that was used in the worker was deleted. |
-
Modify a running job without deleting the job.
You can start, stop, pause, or unpause, a running job without deleting the job.
- Start a job.
Issue a PUT request with a start directive, similar to the following example:
PUT /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>/start
- Stop a job.
Issue a PUT request with the stop directive, similar to the following example:
PUT /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>/stop
- Pause a job.
Issue a PUT request with the pause directive, similar to the following example:
PUT /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>/pause
- Unpause a job.
Issue a PUT request with the unpause directive, similar to the following example:
PUT /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>/unpause
The following table describes the directives that you can use to modify a running job:
Directive | Description |
---|---|
stop | Specifies that the actively running test is stopped, and that the current data is reset. |
start | Specifies that if the job isn't running, the results for the job are cleared, and the job is started from the beginning. If the job is running, the results for the job are also cleared, and the job is started from the beginning. |
pause | Specifies that the currently running test completes. Then, the job is paused before the next test case is run. |
unpause | Specifies that the job is started at the test case and iteration where the job was paused. |
-
Delete a job.
You can delete a specific job or all jobs that are associated with a worker.
- Delete a specific job by issuing a DELETE request similar to the following example:
DELETE /voice-agent-tester/v1/worker/<worker-id>/job/<job-id>
If the job is active, the test is stopped.
Important All accumulated job data is deleted and can't be recovered.
- Delete all jobs associated with a specific worker by issuing a DELETE request similar to the following example:
DELETE /voice-agent-tester/v1/worker/<worker-id>/job
Important All accumulated job data is deleted and can't be recovered.