Skip to main content
Version: 2.0.0

Test case management via SDK

We expose a few methods to perform CRUD operations on test cases. This is helpful for creating internal workflows to manage test cases.

Test case creation (single)

typescript
import { createTestCase } from "@gentrace/core";
 
const caseId = await createTestCase({
pipelineSlug: "testing-pipeline-id",
name: "Test case 1",
inputs: {
query: "describing an ethical dilemma you encountered and asking for feedback",
sender: "Batman",
receiver: "Black Widow"
},
expectedOutputs: {
value: "Dear Natasha,\n I have run into a problem..."
}
});
 
console.log("Case ID: ", caseId);
 

Test case creation (multiple)

typescript
import { createTestCases } from "@gentrace/core";
 
const creationCount = await createTestCases({
pipelineSlug: "emails",
testCases: [
{
name: "Batman -> Black Window #1",
inputs: {
query: "describing an ethical dilemma you encountered and asking for feedback",
sender: "Batman",
receiver: "Black Widow"
},
expectedOutputs: {
value: "Dear Natasha,\n I have run into a problem..."
}
},
{
name: "Superman -> Wonder Woman #3",
inputs: {
query: "desperately asking for backup to a tough situation you am in",
sender: "Superman",
receiver: "Wonder Woman"
},
expectedOutputs: {
value: "Subject: Urgent Assistance Required: Backup Needed Immediately"
}
}
]
});
 
console.log("Creation count: ", creationCount);

Update case

typescript
import { updateTestCase } from "@gentrace/core";
 
const caseId = await updateTestCase({
id: "550e8400-e29b-41d4-a716-446655440000",
// You can also update the archive status, inputs, and expected outputs
name: "New test case name",
});
 
console.log("caseId", caseId);