Skip to Content
Judgment Labs
TypeScriptTesting

TestRunsFactory

Run test suites and read results. Access via judgeval.testRuns.

A case that names a test environment carries it as c.environment, a key of run.environments. Load that definition's seed before the case, and answer its tool calls with cannedToolResult.

const run = await judgeval.testRuns.start(testSuiteId, { candidate: process.env.GIT_SHA });
await Promise.all(
  run.cases.map((c) => Tracer.testCase(run.run_id, c.case_id, () => agent(c.input))),
);
const { results } = await judgeval.testRuns.results(run.run_id);

start()

Start a run of the test suite's latest published version.

With stored_traces: true each case's stored trace, named by its metadata.trace_id, is scored instead of running the agent. Every published case needs a trace in this project.

async function start(testSuiteId: string, options: { case_filter?, candidate?, candidate_meta?, trigger?, stored_traces? } = {}): Promise<StartedRun>

Parameters

Prop

Type

Returns

Promise<StartedRun>


score()

Trigger scoring of an existing run's traces with the latest published version. Returns the new run right away; its cases are scored in the background, so poll get.

async function score(runId: string): Promise<{ run_id: string }>

Parameters

Prop

Type

Returns

Promise<{ run_id: string }>

On this page