Test Plans
How to manage test plans using the public API
The plans endpoints allow you to create and manage test plans in your project. A test plan is a collection of test runs that are organized and executed together, typically for a specific milestone or release. Write operations (create, update, close, reopen, move and delete) can only be performed by users with role test runner or with higher privileges.
Test Plan Overview
A test plan consists of:
- Title and Description: Basic information about the plan
- Milestone: Optional association with a project milestone
- Runs: One or more test runs, each containing a set of test cases
Each run within a plan:
- Has its own title
- Can be assigned to a specific user
- Can be associated with a configuration
- Contains exactly one query plan that specifies the test cases to include
List Test Plans
Returns the test plans of the project, without their runs.
Query Parameters
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
closed | boolean | Filter by state. | No filter | closed=false |
milestoneIds | number | Filter by milestone ID. Repeat the parameter for multiple IDs. | No filter | milestoneIds=5 |
offset | number | Number of items to skip. | 0 | offset=10 |
limit | number | Maximum number of items to return. Accepted range: 0–1,000. | 100 | limit=20 |
sortField | string | Field to sort by: title, created_at, last_activity_at (the latest result or run log in any of its runs; the creation time for a plan without either) or closed_at (open plans last). | created_at | sortField=title |
sortOrder | string | Sort direction for sortField: asc or desc. | desc | sortOrder=asc |
Response
Status: 200 OK
{
total: number // Number of matching test plans across all pages
offset: number // Offset applied to this response
limit: number // Limit applied to this response
data: Array<{ // Test plans in this page
id: number // Test plan ID
projectId: string // ID of the project the test plan belongs to
title: string // Title of the test plan
description: html // Description of the test plan
milestoneId: number | null // ID of the milestone of the test plan, null if none
authorId: number // ID of the user who created the test plan
integrationLink: { // Jira or Linear issue linked to the test plan, null if none
type: string // Integration type (`jira` | `linear`)
integrationId: string // ID of the integration
issueId: string // The issue as sent in `integrationIssueId`: its ID, or a Jira key / Linear identifier
issueTitle: string // Title of the issue
issueUrl: string // URL of the issue
remoteLinkId: string // ID of the link back to the test plan in the tracker; empty once QA Sphere found that link removed in the tracker
} | null
closedAt: datetime | null // Closing time, null if open
closedByUserId: number | null // ID of the user who closed the test plan, null if open
createdAt: datetime // Creation time
updatedAt: datetime // Last update time
lastActivityAt: datetime | null // Time of the latest result or run log in any of its runs
}>
}Get Test Plan
Returns a test plan with its milestone and runs.
Response
Status: 200 OK
{
...TestPlan // The fields List Test Plans returns for each test plan
milestone: { // Milestone of the test plan, null if none
id: number
title: string
createdAt: datetime
updatedAt: datetime
archivedAt: datetime | null
archivedBy: number | null
} | null
runs: Array<{ // Its runs, in order
id: number // Run ID, usable with the run and result endpoints
title: string // Title of the run
isAutomated: boolean // Whether automated tests execute the run; `false` for a run people execute manually
assignmentId: number | null // ID of the assigned user, null if none
assignment: { // Assigned user, null if none
id: number
email: string
name: string
avatar: string | null // Absolute URL of the avatar, null if none; fetching it requires authentication
role: string // Workspace role (`owner` | `admin` | `user` | `test-runner` | `viewer`)
} | null
configurationId: string | null // ID of the configuration of the run, null if none
configuration: { // Configuration of the run, null if none
id: string
title: string
createdAt: datetime
updatedAt: datetime
} | null
queryPlans: Array<{ // Exactly one query plan
tcaseIds: string[] // Test cases in the run
}>
}>
}Create New Test Plan
Creates a new test plan in the project with one or more test runs.
Authentication
Requires an API key with at least Test Runner role permissions. See Authentication for more details.
Request Body
{
title: string // Title of the test plan (max 255 characters)
description?: html // Description of the test plan
milestoneId?: number // Associated milestone
integrationIssueId?: string // Issue to link the plan to in the project's Jira or Linear integration
runs: Array<{ // List of runs in the plan
title: string // Title of the run (max 255 characters)
assignmentId?: number // Assigned user ID
configurationId?: string // Configuration ID
isAutomated?: boolean // Whether automated tests execute the run; `false` creates a run people execute manually (default `true`)
queryPlans: Array<{ // Exactly one query plan per run
tcaseIds: string[] // Test cases to include (test case ID, sequence number or legacy ID)
}>
}>
}Field Constraints
title: Must be 1–255 characters long and unique within the milestone (or among plans without milestones)description: HTML content that will be sanitizedmilestoneId: The milestone must belong to the project and must not be archivedintegrationIssueId: ID or key of an issue in the project's Jira or Linear integration. It is ignored when the project has no Jira or Linear integration. If the issue cannot be fetched, the plan is not created: the response is400 Bad Requestfor an issue that doesn't exist, and otherwise has the status the integration endpoints return when the tracker refuses a requestruns: Must contain at least one run- Each run must have exactly one query plan
tcaseIds: Each value may be a test case ID, sequence number or legacy ID of a test case in the project. A value that matches no test case fails the request with400 Bad RequestassignmentId: Must be an active user with permissions above Viewer role- Test case IDs must be standalone or filled types (not templates)
Response
Status: 201 Created
{
id: number // ID of the created test plan
}Example Response
{
"id": 5
}Error Responses
| Status Code | Description |
|---|---|
| 409 | Conflict - Plan title already exists in milestone |
Update Test Plan
Updates a test plan. Fields left out keep their current values. A closed test plan must be reopened first.
Authentication
Requires an API key with at least Test Runner role permissions. See Authentication for more details.
Request Body
{
title?: string // New title (1–255 characters)
description?: html // New description
milestoneId?: number // Milestone to move the plan and its runs to; 0 takes them out of their milestone
integrationIssueId?: string // Issue to link the plan to; an empty string removes the link
runs?: Array<{ // Full replacement of the plan's runs
id?: number // Existing run to keep (see Get Test Plan); omit for a new run
title: string // Title of the run (max 255 characters)
assignmentId?: number // Assigned user ID
configurationId?: string // Configuration ID
isAutomated?: boolean // As in Create New Test Plan, for a new run; a kept run keeps its value
queryPlans: Array<{ // Exactly one query plan
tcaseIds: string[] // Test cases (test case ID, sequence number or legacy ID)
}>
}>
}Field Constraints
title: Must be unique within the milestone, among test plans and runs, also when onlymilestoneIdchangesmilestoneId,assignmentIdandtcaseIds: Same as for Create New Test PlanintegrationIssueId: ID or key of an issue in the project's Jira or Linear integration. Changing or removing the link also removes the link back from the old issue. If the issue cannot be fetched, the update fails and the plan is left unchanged. It is ignored when the project has no Jira or Linear integration, except that an empty string still removes an existing linkruns[].idmust be one of the plan's runs
Replacing the runs
runs replaces the whole list, and each run is replaced as given:
- Runs left out are deleted for good, with their results. They don't go to the trash
- A kept run's assignee and configuration are cleared if left out
- Test cases that leave a run take the time tracked on them with them, and their results stop counting in the run
To change one run, use Update Test Plan Run.
Response
Status: 200 OK
The updated test plan, in the shape Get Test Plan returns.
Errors
| Status Code | Description |
|---|---|
| 400 | A run ID that isn't the plan's |
| 409 | The plan is closed or the title is taken in the milestone |
Update Test Plan Run
Updates one run of a test plan. Fields left out keep their current values. A closed test plan must be reopened first.
Request Body
{
title?: string // New title of the run (1–255 characters)
assignmentId?: number // User to assign the run to; 0 unassigns it
configurationId?: string // Configuration of the run; an empty string removes it
queryPlans?: Array<{ // Exactly one query plan, replacing the run's test cases
tcaseIds: string[] // Test cases (test case ID, sequence number or legacy ID)
}>
}Test cases that leave the run take the time tracked on them with them, and their results stop counting in the run.
Response
Status: 200 OK
The updated run, in the shape of the runs items in Get Test Plan.
Errors
| Status Code | Description |
|---|---|
| 404 | The run isn't one of the plan's runs |
| 409 | The plan is closed |
Close Test Plan
Closes a test plan and all of its runs.
Response
Status: 200 OK
{
message: string
}Errors
| Status Code | Description |
|---|---|
| 409 | The plan is already closed |
Reopen Test Plan
Reopens a closed test plan and its runs. The runs catch up with the changes made to test cases while they were closed, and an archived milestone of the plan is unarchived.
Response
Status: 200 OK
{
message: string
}Errors
| Status Code | Description |
|---|---|
| 409 | The plan is already open |
Move Test Plans to Milestone
Moves test plans, with their runs, into a milestone or out of their milestone. Closed plans can be moved too, and stay closed.
Request Body
{
planIds: number[] // Plans to move (1 to 100)
milestoneId: number // Milestone to move them to; 0 takes them out of their milestone
}Response
Status: 200 OK
{
message: string
}Errors
| Status Code | Description |
|---|---|
| 400 | The milestone is archived |
| 409 | A plan's title is taken in the milestone |
Delete Test Plan
Deletes a test plan with its runs. They go to the trash as one entry, which restores them together. The link back from a linked Jira or Linear issue is removed.
Response
Status: 200 OK
{
message: string
}Common Use Cases
Cross-Browser Testing
Create a test plan to run the same test suite across different browsers:
{
"title": "Release 3.0 Browser Compatibility",
"description": "<p>Browser compatibility testing for Release 3.0</p>",
"milestoneId": 15,
"runs": [
{
"title": "Chrome Tests",
"configurationId": "chrome_latest",
"assignmentId": 3,
"queryPlans": [
{
"tcaseIds": [
"1CEPaUhgH_Tvt2LZygwVRQa",
"1CAPaUhgH_Tvt2LZygwVRTb",
"1DAPaUhgH_Tvt2LZygwVRSc",
"1EEPaUhgH_Tvt2LZygwVRLm",
"1FEPaUhgH_Tvt2LZygwVRNn"
]
}
]
},
{
"title": "Firefox Tests",
"configurationId": "firefox_latest",
"assignmentId": 3,
"queryPlans": [
{
"tcaseIds": [
"1CEPaUhgH_Tvt2LZygwVRQa",
"1CAPaUhgH_Tvt2LZygwVRTb",
"1DAPaUhgH_Tvt2LZygwVRSc",
"1EEPaUhgH_Tvt2LZygwVRLm",
"1FEPaUhgH_Tvt2LZygwVRNn"
]
}
]
},
{
"title": "Safari Tests",
"configurationId": "safari_latest",
"assignmentId": 3,
"queryPlans": [
{
"tcaseIds": [
"1CEPaUhgH_Tvt2LZygwVRQa",
"1CAPaUhgH_Tvt2LZygwVRTb",
"1DAPaUhgH_Tvt2LZygwVRSc",
"1EEPaUhgH_Tvt2LZygwVRLm",
"1FEPaUhgH_Tvt2LZygwVRNn"
]
}
]
},
{
"title": "Edge Tests",
"configurationId": "edge_latest",
"assignmentId": 3,
"queryPlans": [
{
"tcaseIds": [
"1CEPaUhgH_Tvt2LZygwVRQa",
"1CAPaUhgH_Tvt2LZygwVRTb",
"1DAPaUhgH_Tvt2LZygwVRSc",
"1EEPaUhgH_Tvt2LZygwVRLm",
"1FEPaUhgH_Tvt2LZygwVRNn"
]
}
]
}
]
}Multi-Platform Testing
Test the same application across different platforms and devices:
{
"title": "Mobile App Platform Testing",
"description": "<p>Testing mobile app across different platforms</p>",
"runs": [
{
"title": "iOS 17 - iPhone 15",
"configurationId": "ios17_iphone15",
"assignmentId": 4,
"queryPlans": [
{
"tcaseIds": [
"1GEPaUhgH_Tvt2LZygwVROo",
"1HEPaUhgH_Tvt2LZygwVRPp",
"1IEPaUhgH_Tvt2LZygwVRQq",
"1JEPaUhgH_Tvt2LZygwVRRr",
"1KEPaUhgH_Tvt2LZygwVRSs"
]
}
]
},
{
"title": "iOS 17 - iPad Pro",
"configurationId": "ios17_ipad_pro",
"assignmentId": 4,
"queryPlans": [
{
"tcaseIds": [
"1GEPaUhgH_Tvt2LZygwVROo",
"1HEPaUhgH_Tvt2LZygwVRPp",
"1IEPaUhgH_Tvt2LZygwVRQq",
"1JEPaUhgH_Tvt2LZygwVRRr",
"1KEPaUhgH_Tvt2LZygwVRSs"
]
}
]
},
{
"title": "Android 14 - Pixel 8",
"configurationId": "android14_pixel8",
"assignmentId": 5,
"queryPlans": [
{
"tcaseIds": [
"1GEPaUhgH_Tvt2LZygwVROo",
"1HEPaUhgH_Tvt2LZygwVRPp",
"1IEPaUhgH_Tvt2LZygwVRQq",
"1JEPaUhgH_Tvt2LZygwVRRr",
"1KEPaUhgH_Tvt2LZygwVRSs"
]
}
]
},
{
"title": "Android 14 - Samsung Galaxy",
"configurationId": "android14_galaxy",
"assignmentId": 5,
"queryPlans": [
{
"tcaseIds": [
"1GEPaUhgH_Tvt2LZygwVROo",
"1HEPaUhgH_Tvt2LZygwVRPp",
"1IEPaUhgH_Tvt2LZygwVRQq",
"1JEPaUhgH_Tvt2LZygwVRRr",
"1KEPaUhgH_Tvt2LZygwVRSs"
]
}
]
}
]
}Regression Testing Across Environments
Run regression tests across different deployment environments:
{
"title": "Regression Test Suite - All Environments",
"description": "<p>Full regression testing across staging and production-like environments</p>",
"runs": [
{
"title": "Regression Tests - Staging US",
"configurationId": "staging_us_east",
"assignmentId": 3,
"queryPlans": [
{
"tcaseIds": [
"1LEPaUhgH_Tvt2LZygwVRTt",
"1MEPaUhgH_Tvt2LZygwVRUu",
"1NEPaUhgH_Tvt2LZygwVRVv",
"1OEPaUhgH_Tvt2LZygwVRWw",
"1PEPaUhgH_Tvt2LZygwVRXx",
"1QEPaUhgH_Tvt2LZygwVRYy"
]
}
]
},
{
"title": "Regression Tests - Staging EU",
"configurationId": "staging_eu_west",
"assignmentId": 4,
"queryPlans": [
{
"tcaseIds": [
"1LEPaUhgH_Tvt2LZygwVRTt",
"1MEPaUhgH_Tvt2LZygwVRUu",
"1NEPaUhgH_Tvt2LZygwVRVv",
"1OEPaUhgH_Tvt2LZygwVRWw",
"1PEPaUhgH_Tvt2LZygwVRXx",
"1QEPaUhgH_Tvt2LZygwVRYy"
]
}
]
},
{
"title": "Regression Tests - Staging APAC",
"configurationId": "staging_apac",
"assignmentId": 5,
"queryPlans": [
{
"tcaseIds": [
"1LEPaUhgH_Tvt2LZygwVRTt",
"1MEPaUhgH_Tvt2LZygwVRUu",
"1NEPaUhgH_Tvt2LZygwVRVv",
"1OEPaUhgH_Tvt2LZygwVRWw",
"1PEPaUhgH_Tvt2LZygwVRXx",
"1QEPaUhgH_Tvt2LZygwVRYy"
]
}
]
}
]
}Component-Based Testing
Create test plans with different test cases for distinct components or modules:
{
"title": "Sprint 23 Feature Test Plan",
"description": "<p>Test plan for different components developed in Sprint 23</p>",
"runs": [
{
"title": "User Authentication Module",
"assignmentId": 3,
"queryPlans": [{ "tcaseIds": ["1CEPaUhgH_Tvt2LZygwVRQa", "1CAPaUhgH_Tvt2LZygwVRTb"] }]
},
{
"title": "Payment Processing Module",
"assignmentId": 4,
"queryPlans": [{ "tcaseIds": ["1EEPaUhgH_Tvt2LZygwVRLm", "1FEPaUhgH_Tvt2LZygwVRNn"] }]
},
{
"title": "Notification Service",
"assignmentId": 5,
"queryPlans": [{ "tcaseIds": ["1GEPaUhgH_Tvt2LZygwVROo", "1HEPaUhgH_Tvt2LZygwVRPp"] }]
}
]
}Best Practices
- Configuration-Based Runs: Most test plans will have runs with similar titles and identical test cases, differing only in configurations (e.g., browsers, devices, environments)
- Consistent Naming: Use a consistent naming pattern for runs testing the same functionality across configurations (e.g., "Feature X - Chrome", "Feature X - Firefox")
- Same Test Cases: Reuse the same test case IDs across runs when testing across different configurations
- Assign by Expertise: When testing across platforms, assign runs based on platform expertise rather than feature expertise
- Link to Milestones: Associate plans with milestones for better release tracking
- Exception Cases: Only create runs with different test cases when testing distinct components or modules
Limitations
- Each run must have exactly one query plan
- Only User selection test runs are supported (tcaseIds must be specified). See Types of Runs for more details.
- Dynamic folder/tag-based selection is not available for plans
- Test plans cannot be cloned via the public API (planned for future release)
Related Resources
- Runs - Learn about individual test runs
- Test Cases - Manage test cases
- Milestones - Work with project milestones
- Results - Add results to test cases in runs