Test cases - Create single
- TypeScript
- Python
Create a single test case with createTestCase()
.
Create a single test case with create_test_case()
.
Example
typescript
constcaseId = awaitcreateTestCase ({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 );
python
import gentraceimport osgentrace.init({"api_key": os.getenv("GENTRACE_API_KEY")})case_id = gentrace.create_test_case(pipeline_slug="guess-the-year",dataset_id="550e8400-e29b-41d4-a716-446655440000",payload={"name": "Test case 1","inputs": {"a": "1", "b": "2"},"expectedOutputs": {"value": "3"},},)print("Case ID: ", case_id)
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.
These are the possible keyword arguments.
pipeline_slug: Optional[str]
dataset_id: Optional[str]
payload: CreateTestCase
Note: Either dataset_id
or pipeline_slug
can be specified. If both are provided, dataset_id
will be prioritized. If only pipeline_slug
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
name: str
inputs: Dict[str, Any]
expectedOutputs: Optional[Dict[str, Any]]
Return value
caseId: string (UUID)