Skip to main content
Version: 2.0.0

Test cases - Get

Get all test cases for a given pipeline with getTestCases().

Arguments

pipelineSlug

Pipeline slug as a string. Learn [about pipelines here] (pipeline/basics). Create a new pipeline here.

Return value

Returns an array of TestCases.

🛠️ TestCase

The TestCase type represents the structure of a test case in TypeScript. Below are the fields of the TestCase type.

id

The unique identifier for the test case as a UUID string

createdAt

The timestamp when the test case was created as ISO 8601 string.

archivedAt?

The timestamp when the test case was archived as ISO 8601 string. This can be null if the test case has not been archived.

updatedAt

The timestamp when the test case was last updated as ISO 8601 string.

expectedOutputs?

An object representing the expected outputs for the test case as a JavaScript object. This can be null if there are no expected outputs.

inputs

An object containing input data for the test case as a JavaScript object. The object keys are strings with associated values of any type.

name

The name of the test case.

pipelineId

The identifier for the pipeline that the test case is associated with as a UUID string.

Example

typescript
const cases = await getTestCases("example-pipeline");
 
for (const testCase of cases) {
console.log("Case: ", testCase.name, testCase.id);
}