POST/projects/{ProjectId}/tests/search

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

Returns a filtered list of tests a project contains.

Use the operation to get a filtered list of tests defined in the QACompleteTest Library. This operation is fully equivalent to the /projects/{ProjectId}/tests (GET) operation, but this one allows you to send a large filter string.

To get information on an individual test by its ID, use the …/tests/{Id} (GET) operation.

Authentication

Basic authentication using a user’s login and password. See Authentication for details.

Security Rights

The authenticating user must belong to a security group that has the Read privilege for the Test Library.

Request Format

To get a filtered list of tests, send a POST request to the following URL:

http://{server}/rest-api/service/api/v2/projects/{ProjectId}/tests/search?offset={offset}&limit={limit}
URL parameters

ProjectId  :  integer, required

The ID of the project.

offset  :  integer, default: 0

The number of tests to skip before counting the returned tests. The default value is 0, which is the offset of the first item. For details, see Paging Through Results Using Offset and Limit.

limit  :  integer, default: 25

The maximum number of tests to return in the response.

Body parameters

In the request body, pass the RequestTestsAllPost object that describes the tests to search for.

{
"Filter": "string"
}

Some string property values (for example, Status) are based on the choice lists defined in your QAComplete project. You can find these values in the Test Management > Test Library >  Tools >  Manage Choice Lists panel in QAComplete.

Filter  :  string

The filter expression to apply to the returned list. See Search Filters.

A sample request:

POST http://yourserver.com/rest-api/service/api/v2/projects/11873/tests/search HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 58

{
"Filter": "(status ~ 'Awaiting') AND (active = true)"
}

A sample request made by using cURL:

curl -u [email protected]:p@ssword -d @tests.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v2/projects/11873/tests/search

Response Format

On success, the operation responds with HTTP status code 200 and returns a JSON object with information about the tests.

A sample response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1792


{
    "metadata": {
       "result_set": {
          "count": 1,
          "offset": 0,
          "limit": 25,
          "total": 1
       },
        "permissions": {
            "acl": 7
       }
    },
    "results": [
      {
        "id": 1,
        "title": "Test input data",
        "status": "Awaiting Approval",
        "project_id": 11873,
        "__permissions": {
          "acl": 7
        },
        "active": true,
        "assigned_to_name": "Smith, John",
        "assignee_user_id": 25264,
        "avg_run_time": 375,
        "avg_run_time_formated": "00:06:15",
        "create_user_id": 25264,
        "custom_fields": [
          {
            "Id": "Custom1",
            "Name": "Components",
            "Value": "UI"
          }
        ],
        "date_created": "2015-07-31T10:19:10.5870000",
        "date_last_escalated": "2015-09-02T10:53:07.0000000",
        "date_updated": "2015-09-09T09:28:27.0000000",
        "description": "Test input data",
        "execution_type": "Manual",
        "folder_id": 8,
        "folder_name": "Regression Tests",
        "import_id": 143,
        "last_escalation_rule": "Esc Rule 1",
        "last_escalation_rule_id": 0,
        "last_run_by_name": "Smith, John",
        "last_run_by_user_id": 25264,
        "last_run_date": "2015-09-06T10:53:07.0000000",
        "last_run_test_set": 2,
        "last_run_test_set_title": "Regression Tests",
        "nbr_escalations": 2,
        "nbr_events": 0,
        "nbr_fail_status": 2,
        "nbr_files": 0,
        "nbr_files_not_secured": 0,
        "nbr_notes": 0,
        "nbr_pass_status": 4,
        "nbr_steps": 1,
        "nbr_times_run": 6,
        "notes_description": "note 1",
        "original_id": 0,
        "owner_name": "Smith, John",
        "owner_user_id": 25264,
        "priority": "3-Low",
        "script_name": "",
        "script_source_id": 0,
        "test_steps": [
          {
            "id": 5,
            "permissions": {
              "acl": 7
            },
            "create_user_id": 25264,
            "date_created": "2015-08-09T09:27:45.6700000",
            "date_updated": "2015-09-09T10:28:27.0000000",
            "expected_result": "The Tools dialog opens",
            "is_stopped_on_fail": false,
            "nbr_files": 0,
            "script_name": "",
            "script_source_id": 0
            "seq": 1,
            "step": "Select Tools from the application's main menu",
            "title": "Test input data",
            "update_user_id": 25264
          }
        ],
        "test_type": "Regression",
        "update_user_id": 25264,
        "user_name": "Smith, John",
        "version": 4
      }
    ]
  }

Error responses

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

If the project with the specified ProjectId does not exist or the authenticating user does not have rights to access the project, the operation returns the Access is denied error.

See Also

Tests Resources

Highlight search results