Skip to main content
Version: 4.7.23

Test cases - Create single

Create a single test case with createTestCase().

Example

typescript
const caseId = await createTestCase({
pipelineSlug: 'example-pipeline',
name: 'Example test case',
inputs: { a: 1, b: 2 },
expectedOutputs: { c: 3 },
datasetId: '550e8400-e29b-41d4-a716-446655440000',
});
 
console.log('Case ID: ', caseId);

Arguments

payload: CreateTestCase

Note: Either datasetId or pipelineSlug can be specified in the payload. If both are provided, datasetId will be prioritized. If only pipelineSlug is specified, Gentrace will create the test cases in the pipeline's golden dataset.

Types

🛠️ CreateTestCase

This type defines the structure for creating a new test case. The fields of the CreateTestCase type differ slightly between TypeScript and Python:

pipelineSlug?: string

datasetId?: string (UUID)

name: string

inputs: object

expectedOutputs?: object

Return value

caseId: string (UUID)