Export test cases
POST
/testcases/exportCustom export the list of test cases (in JSON format)
Example
Section titled “Example”Use resource IDs from your own project. Keep the API token in your server or CI environment.
import { createConfiguration, ExportApi } from '@testcollab/sdk';
const config = createConfiguration(process.env.TESTCOLLAB_TOKEN!);const api = new ExportApi(config);
const result = await api.exportTestCases({ "exportTestCasesPayload": { "project": 123, "exportAs": "csv", "criteria": "all", "fields": [] }});console.log(result);curl --request POST \ "https://api.testcollab.io/testcases/export?token=$TESTCOLLAB_TOKEN" \ --header 'Content-Type: application/json' \ --data '{ "project": 123, "export_as": "csv", "filter_model": "example", "sort_model": "example", "criteria": "all", "testCases": [], "fields": [], "testPlan": 123, "configs": []}'Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
project |
number | Yes | Project ID |
export_as |
string | Yes | Export data as CSV/EXCEL Values: csv, excel. |
filter_model |
string | No | Stringified filter object (Ag-grid filters) |
sort_model |
string | No | Stringified array of sort model objects (Ag-grid sort models) |
criteria |
string | Yes | Export selected or all test cases. If none is selected and filter is present then all filtered test cases will be considered. Values: all, selected. |
testCases |
Array of number | No | Selected test case IDs - will be considered only if criteria is selected. |
fields |
Array of string | Yes | Fields provided here will be considered for export. If none then all default fields. You can specify the custom fields using the template “cf_ “ so if you want data for custom field whose Id is 123, along with test case title, priority and suite then the fields parameter would be like - { “title”, “priority”, “suite”, “cf_123” ] |
testPlan |
number | No | If test cases related to a particular test plan has to be exported. |
configs |
Array of number | No | Will be considered only if test plan is provided. Selected test plan configurations IDs - If none then all. |
run |
number | No | Will be considered only if test plan is provided. Selected run otherwise latest run. |
remove_tags |
boolean | No | Strip HTML tags from text fields |
Response
Section titled “Response”200 — Action status details
| Field | Type | Required | Description |
|---|---|---|---|
header_row |
string | No | Stringified header |
testCases |
Array of string | No | Array of stringified test case data for export |
{ "header_row": "example", "testCases": []}Errors
Section titled “Errors”| Status | Meaning |
|---|---|
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not found |
500 |
Internal server error |