Test Cases
The test cases endpoints allow you to retrieve information about test cases in your project. This can be useful for planning test runs and monitoring your test coverage.
Types of Test Cases
In QA Sphere, there are three types of test cases:
- Standalone Test Case: These are the standard test cases.
- Template Test Case: Similar to standalone test cases, but they can include parameters within
${}in their title, preconditions, and steps. These parameters can be replaced with specific values to generate multiple test cases from the same template. - Filled Test Cases: Automatically created by the system by substituting parameter values in template test cases. They inherit all properties from the parent template test case.
important
- Users can directly create standalone and template test cases. When creating template test cases, users can specify a list of values for the parameters, which the system uses to automatically generate the corresponding filled test cases.
- Updates to a template test case will also update the corresponding filled test cases.
- Deletion is permitted for all three types of test cases. Deleting a template test case will also delete the associated filled test cases. Deleting a filled test case will only remove that specific test case.
- Test runs include only standalone and filled test cases.
List Project Test Cases
GET/api/public/v0/project/{project_id}/tcase
Retrieves all test cases within a project based on the filters provided in the request query parameters.
Path Parameters
project_id: The project identifier (can be either the project code or UUID)
Query Parameters
All query parameters are optional and some can be specified multiple times using the format param=value1¶m=value2¶m=value3.
| Parameter | Type | Multiple | Description | Allowed Values | Example |
|---|---|---|---|---|---|
page | number | no | Page number for fetching test cases in batches | page=1 | |
limit | number | no | Maximum number of test cases to return, or maximum test cases per page (default: 10, if page is specified) | limit=10 | |
sortField | string | no | Field to sort by | id, seq, folder_id, author_id, pos, title, priority, created_at, updated_at, legacy_id | sortField=title |
sortOrder | string | no | Sort order (requires sortField; default: desc) | asc, desc | sortOrder=desc |
types | string | yes | Filter test cases by type | standalone, template, filled | types=standalone |
search | string | no | Filter test cases by title (case insensitive, partial matches) | search=ui | |
folders | number | yes | Filter test cases by folder ID (does not consider child folders) | folders=10&folders=12 | |
tags | number | yes | Filter test cases by tag ID | tags=12 | |
priorities | string | yes | Filter test cases by priority | high, medium, low | priorities=low |
draft | bool | no | Filter test cases by draft status | true, false | draft=true |
templateTCaseIds | string | yes | Filter test cases by their parent template test case identifiers | templateTCaseIds=1CEPaUhuR_yNsLvcbYJhw46 | |
requirementIds | string | yes | Filter test cases by requirement ID | requirementIds=1CEPaUhuR_abc123def456 | |
cf_${custom field system name} | string | yes | Filter test cases by custom field value | The values for custom fields are defined under Settings > Custom Fields | cf_automation=Automated |
include | string | yes | Include additional fields in the response which are omitted by default | steps, tags, project, folder, path, requirements, customFields, parameterValues | include=steps |
tip
- Use pagination when project contains large number of test cases
- Only include necessary non-default fields
- Different filters are combined with AND logic
- Multiple values for the same filter are combined with OR logic
Example Request
Fetch all test cases with default fields
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase
Fetch all test cases with "Automation" custom field to be "Automated"
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?cf_automation=Automated
Fetch all test cases with "Known Issue" custom field to be "Yes"
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?cf_known_issue=Yes
Fetch 20 test cases sorted by title in ascending order
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?limit=20&sortField=title&sortOrder=asc
Fetch 7th page of test cases sorted by pos where each page contains 15 test cases
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?page=7&limit=15&sortField=pos&sortOrder=asc
Fetch all draft test cases
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?draft=true
Fetch 10 most recent added test cases
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?limit=10&sortField=created_at&sortOrder=desc
Fetch test cases with "backend" in their title
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?search=backend
Fetch test cases with "backend" in their title and include custom fields
curl \
-H "Authorization: ApiKey your.api.key.here" \
https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase?search=backend&include=customFields