Skip to main content
Version: 2.0.0

Test cases - Create multiple

Create multiple test cases with createTestCases().

Arguments

payload

The payload argument is a JavaScript array payload of the new test cases (type CreateMultipleTestCase). In our API, this payload is used to create the new test cases.

Types

🛠️ CreateMultipleTestCase

This type defines the structure for creating multiple test cases. Below are the fields of the CreateMultipleTestCases type.

pipelineSlug

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

testCases

An array of test cases to create. Each test case has the type CreateMultipleTestCasesTestCasesInner.

🛠️ CreateMultipleTestCasesTestCasesInner

This type defines the structure for creating a single test case. Below are the fields of the CreateMultipleTestCasesTestCasesInner type.

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

creationCount

The number of test cases created as a number.

Example

typescript
const creationCount = await createTestCases({
pipelineSlug: "example-pipeline",
testCases: [
{
name: `TC 1`,
inputs: { a: 1, b: 2 },
expectedOutputs: { c: 3 },
},
],
});
 
console.log("Created test case count: ", creationCount);