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.
Get Test Case Count
GET/api/public/v0/project/{project_id}/tcase/count
Returns the total number of test cases that match the specified filters. If no filters are provided, returns the total count of all test cases in the project.
Authentication
All requests require an API key in the Authorization header:
Authorization: ApiKey your.api.key.here
Path Parameters
project_id
: The project identifier (can be either the project code or UUID)
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
folders | number | Filter by folder IDs | folders=1&folders=2 |
recursive | boolean | Include test cases in subfolders (requires folders ) | recursive=true |
tags | number | Filter by tag IDs | tags=1&tags=2 |
priorities | string | Filter by priority levels (high, medium, low) | priorities=high&priorities=medium |
draft | boolean | Filter by draft status | draft=true |
Example Requests
Basic Count
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase/count"
Filter Examples
- Folder-based counting:
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase/count?folders=1&recursive=true"
- Priority-based counting:
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase/count?priorities=high"
- Tag-based counting:
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase/count?tags=1&tags=2"
- Draft status counting:
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tcase/count?draft=true"
Response Format
{
count: number // Total number of test cases matching the filters
}
Example Response
{
"count": 4
}
Error Responses
Status Code | Description |
---|---|
401 | Invalid or missing API key |
403 | Insufficient permissions or suspended tenant |
404 | Project not found |
400 | Invalid filter parameters |
500 | Internal server error |
Use Cases
- Monitor test coverage by counting test cases across different folders
- Track high-priority test case volume
- Review draft test case count before publishing
- Plan test runs based on tagged test cases
Filter Behavior
- If no filters are specified, all test cases in the project are counted
- Multiple filters are combined with AND logic
- Multiple values for the same filter (tags, priorities) are combined with OR logic
- The
recursive
parameter only applies whenfolders
is specified