Skip to main content
Version: 2.0.0

Test cases - Create single

Create a single test case with createTestCase().

Arguments

payload

The payload argument is a JavaScript payload of the new test case payload (type CreateTestCase). In our API, the payload is used to create the new test case.

Types

🛠️ CreateTestCase

This type defines the structure for creating a new test case. Below are the fields of the CreateTestCase type.

pipelineSlug?

The slug (unique identifier) for the pipeline. It is a string that represents a simplified, URL-friendly version of a pipeline name.

name?

The name of the test case. It is a string that identifies the test case.

inputs?

The input data for the test case, formatted as a JSON object. The keys are strings and the values can be of any type.

expectedOutputs?

The expected outputs for the test case, also formatted as a JSON object. This can be null if there are no expected outputs defined for the test case.

Return value

caseId

The ID of the created test case as a UUID string.

Example

typescript
const caseId = await createTestCase({
pipelineSlug: "example-pipeline",
name: "Example test case",
inputs: { a: 1, b: 2 },
expectedOutputs: { c: 3 },
});
 
console.log("Case ID: ", caseId);