PATCH/hosts/{HostId}/runs/{RunId}/items/{SequenceNumber}

Applies to QAComplete 14.3, last modified on February 19, 2024

Sets the test status.

After an automated test has finished running on a test host, an agent on this host must update the test status in QAComplete. Tests can be Passed, Failed, Blocked, or Skipped. An agent can optionally add test step results for an automated test. The steps can differ from those specified in the test.

QAComplete automatically sets the test run status based on the statuses of individual tests in the test run.

Authentication

Basic authentication using the host ID and security token. See Authentication for details.

Request Format

To set a test status, send a PATCH request to the following URL:

http://{server}/rest-api/service/automation/v2/hosts/{HostId}/runs/{RunId}/items/{SequenceNumber}

Use the following request body:

{
   "status": "string",
   "date_started": "string",
   "date_finished": "string",
   "run_time": integer,
   "test_run_results": [
     {
       "status": "string",
       "actual_result": "string",
       "step": "string",
       "expected_result": "string"
     },
     {
       "status": "string",
       "actual_result": "string",
       "step": "string",
       "expected_result": "string"
     },
     …
  ]
}
Request parameters
URL parameters

HostId  :  integer, required

The host ID.

RunId  :  integer, required

The test run ID. This is the results[index].id value from the …/currentruns operation response. In QAComplete, test run IDs appear in Test Management > Run History and in the history of Test Schedules.

SequenceNumber  :  integer, required

For test sets, this is the 1-based index (the sequence number) of the test in the set. For individual tests, use 1.

You can get this value from the response of the …/currentruns operation as results[index].test_run_items[index]. test_run_results[index].sequence_number.

Body parameters

status  :  string, required

The test status: Passed, Failed, Blocked, or Skipped. For test sets:

  • If you mark a test as Failed and its stop_on_fail property is true, QAComplete will automatically mark the remaining tests as Blocked.

  • If one of the tests is Skipped, the entire test run becomes Incomplete.

date_started  :  string, required

The UTC date and time the test started.

date_finished  :  string, required

The UTC date and time the test finished. Must be greater than date_started.

run_time  :  integer, required

The test run time, in seconds.

test_run_results[]  :  array of objects, required

The step results of the automated test. Can be an empty array, meaning no step results.

status  :  string, required

The test step status: Passed, Failed or Blocked.

actual_result  :  string

The actual results of the test step as compared to the expected results.

step  :  string

The test step description.

expected_result  :  string

The expected results of the test step.

A sample request to change the test run status to Passed and to add test steps:

PATCH http://yourserver.com/rest-api/service/automation/v2/hosts/143/runs/575/items/1 HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 458

{
  "status": "Passed",
  "date_started": "2014-07-24T08:40:57Z",
  "date_finished": "2014-07-24T08:41:57Z",
  "run_time": 60,
  "test_run_results": [
    {
      "status": "Passed",
      "step": "User cannot log in with invalid login and/or password"
    },
    {
      "status": "Passed",
      "step": "The 'Forgot Password' link is visible"
    },
    {
      "status": "Passed",
      "step": "User can log in with valid login and password"
    }
  ]
}

The same request made by using cURL:

curl -u &id-token; -X PATCH -d PassedTest.txt -H "Content-Type: application/json" http://yourserver.com/rest-api/service/automation/v2/hosts/143/runs/575/items/1

Response Format

On success, the operation responds with HTTP status code 200 and returns a copy of the submitted information with some extra data.

If the operation fails, it returns the appropriate status code and (optionally) the error description in the response body.

A sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 542


{
  "sequence_number": 1,
  "stop_on_fail": false,
  "status": "Passed",
  "date_started": "2014-07-24T08:40:57.0000000Z",
  "date_finished": "2014-07-24T08:41:57.0000000Z",
  "run_time": 60,
  "test_run_results": [
    {
      "sequence_number": 1,
      "stop_on_fail": false,
      "status": "Passed",
      "step": "User cannot login with invalid login and/or password"
    },
    {
      "sequence_number": 2,
      "stop_on_fail": false,
      "status": "Passed",
      "step": "The 'Forgot Password' link is visible"
    },
    {
      "sequence_number": 3,
      "stop_on_fail": false,
      "status": "Passed",
      "step": "User can login with valid login and password"
    }
  ]
}

See Also

QAComplete Test Automation REST API Reference

Highlight search results