Skip to main content

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

ParameterTypeDescriptionExample
foldersnumberFilter by folder IDsfolders=1&folders=2
recursivebooleanInclude test cases in subfolders (requires folders)recursive=true
tagsnumberFilter by tag IDstags=1&tags=2
prioritiesstringFilter by priority levels (high, medium, low)priorities=high&priorities=medium
draftbooleanFilter by draft statusdraft=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

  1. 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"
  1. 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"
  1. 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"
  1. 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 CodeDescription
401Invalid or missing API key
403Insufficient permissions or suspended tenant
404Project not found
400Invalid filter parameters
500Internal 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 when folders is specified