跳转到内容
EN

Create a test run

Code Mode: praxis.devops.projects.testRuns.create

HTTP: POST /devops/v1/projects/{project}/test-runs

Start a run of the project’s tests at one commit. Name a plan to use its selector, or pass a selector directly for this run alone; the ref says which commit to test and is required, because a run without a commit has nothing to report against. waitUntil decides how far the call waits before answering — queued, the default, returns as soon as the run exists; started waits until the run has begun, except for an external run, which is answered at once because it leaves queued only when your own CI uploads; finished waits for a verdict. The wait is bounded at about 25 seconds, and a wait that reaches that bound returns the run as it stands rather than failing — read state to see whether it finished. A retry of an earlier run is a new run: pass its commit and selector, and read the earlier run to compare. The run executes the selected cases at ref.commit, in Praxis, on the code of that commit; the commit needs a published catalog, and a commit without one is refused with CATALOG_NOT_READY while a build is started, so retry shortly after. selector (below) narrows by size, purpose, framework, tags, package or case id; there is no field that selects a feature by its title, so to run one feature list its cases with praxis api devops project test-case list and pass their ids in selector.cases (or pass its package in selector.packages). Large cases are selectable with sizes [large], but a cloud run records them as skipped for now, and there is no separate e2e selector: frameworks [playwright] selects browser cases, large ones skipped the same way. environment names the environment the run is evidence for; it is recorded on the run and given to the cases as PRAXIS_TEST_ENV, it does not point the cases at the deployed environment. To run the tests on your own CI instead, create the run with executor external and upload the result with praxis api devops project test-report create; the local report of your own machine goes up as private feedback with praxis devops test report --id <run> --upload, and it never counts as test evidence.

签名

praxis.devops.projects.testRuns.create(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string};body:{ref:{/** Branch the commit was reached through, for display and attribution; it does not pin the run, the commit does. e.g. "main" */ branch?:string;/** Full 40-character commit sha the run tested, which is what its result is evidence about. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ commit:string;/** The proposed change whose testing started this run; absent for runs started by a schedule or by hand. e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ pullRequest?:string;/** Commit at the head of the group being landed together, when the run tested a merged candidate rather than one change. e.g. "5a3b0d2e9f8c7b6a5d4e3f2a1b0c9d8e7f6a5b4c" */ mergeGroupHead?:string;/** The release this run is evidence about; absent unless the run belongs to a release. e.g. "rls_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ release?:string;/** The promotion this run belongs to; absent unless the run was started to guard or observe one. e.g. "prm_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ promotion?:string};/** Plan whose selector this run uses; omit it when passing selector instead. e.g. "tpl_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ plan?:string;selector?:{/** Keep only cases of these declared sizes; omit to allow every size. e.g. ["small","medium"] */ sizes?:Array<"small"|"medium"|"large">;/** Keep only cases carrying at least one of these purpose tags; omit to allow every purpose. e.g. ["regression"] */ purposes?:Array<"smoke"|"regression"|"acceptance"|"contract"|"performance">;/** Keep only cases from these test frameworks; omit to allow every framework. e.g. ["bun"] */ frameworks?:Array<"gherkin"|"bun"|"vitest"|"jest"|"pytest"|"go"|"playwright">;/** Keep only cases carrying every one of these tags; use it to narrow to an area without naming each case. e.g. ["devops"] */ allTags?:Array<string>;/** Keep only cases carrying at least one of these tags; use it to widen across neighbouring areas. e.g. ["api","cli"] */ anyTags?:Array<string>;/** Keep only cases in these repository packages; the package is the directory the file lives in. e.g. ["services/devops"] */ packages?:Array<string>;/** Run exactly these cases, named by id; use it to re-run a known failure without widening to its whole area. e.g. [] */ cases?:Array<string>;/** True keeps only cases declared safe to run against a production environment; use it for a plan whose environment is production. e.g. false */ prodSafeOnly?:boolean;/** Present to select only the cases a commit range can affect, the way a presubmit wants it. */ affected?:{/** The commit the change is measured against; the affected set is what changed between this commit and the run's own commit. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ base?:string}};/** Environment this run is evidence for; it is recorded on the run and given to the cases as PRAXIS_TEST_ENV, and the cases still execute at the commit, not agains e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment?:string;/** How many times each selected case runs, which is how a flake is told apart from a real failure; omit for once. e.g. 1 */ repeat?:number;/** How far the call waits before answering, bounded at about 25 seconds; omit it for queued, which returns at once. e.g. "queued" */ waitUntil?:"queued"|"started"|"finished";/** Who carries the run out. e.g. "cloud" */ executor?:"cloud"|"external";/** A key you choose to make creating this run idempotent: repeating the call with the same requestId returns the run it created instead of starting another, so a r e.g. "ci-4512-a1b2c3d" */ requestId?:string}}):Promise<{/** Run identifier used for later reads, cancellations and execution listings. e.g. "trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always test_run; use it to tell answers apart when several kinds are handled together. */ object:"test_run";/** RFC 3339 UTC time the run was created, which is when its selection was fixed. e.g. "2026-11-03T09:00:00Z" */ createTime:string;/** RFC 3339 UTC time the run's state or counts last changed. e.g. "2026-11-03T09:12:00Z" */ updateTime:string;/** Canonical Console link for this run, for putting a human-readable reference in a card or a message. e.g. "https://console.deepraxis.com/devops/tests/runs/trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this run belongs to, from the project list or create answer. e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string;/** The plan that selected this run's cases; absent for a run created with an ad-hoc selector. e.g. "tpl_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ plan:string;/** What started this run, which is how a run is attributed back to the event that wanted it. e.g. "manual" */ trigger:"manual"|"pull_request"|"merge_group"|"promotion"|"schedule"|"retry"|"fix_attempt";ref:{/** Branch the commit was reached through, for display and attribution; it does not pin the run, the commit does. e.g. "main" */ branch?:string;/** Full 40-character commit sha the run tested, which is what its result is evidence about. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ commit:string;/** The proposed change whose testing started this run; absent for runs started by a schedule or by hand. e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ pullRequest?:string;/** Commit at the head of the group being landed together, when the run tested a merged candidate rather than one change. e.g. "5a3b0d2e9f8c7b6a5d4e3f2a1b0c9d8e7f6a5b4c" */ mergeGroupHead?:string;/** The release this run is evidence about; absent unless the run belongs to a release. e.g. "rls_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ release?:string;/** The promotion this run belongs to; absent unless the run was started to guard or observe one. e.g. "prm_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ promotion?:string};/** The environment the run executed against; absent when the run needed none. e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment:string;/** Where the cases actually ran. e.g. "external" */ executor:"cloud"|"external";selection:{selector:{/** Keep only cases of these declared sizes; omit to allow every size. e.g. ["small","medium"] */ sizes?:Array<"small"|"medium"|"large">;/** Keep only cases carrying at least one of these purpose tags; omit to allow every purpose. e.g. ["regression"] */ purposes?:Array<"smoke"|"regression"|"acceptance"|"contract"|"performance">;/** Keep only cases from these test frameworks; omit to allow every framework. e.g. ["bun"] */ frameworks?:Array<"gherkin"|"bun"|"vitest"|"jest"|"pytest"|"go"|"playwright">;/** Keep only cases carrying every one of these tags; use it to narrow to an area without naming each case. e.g. ["devops"] */ allTags?:Array<string>;/** Keep only cases carrying at least one of these tags; use it to widen across neighbouring areas. e.g. ["api","cli"] */ anyTags?:Array<string>;/** Keep only cases in these repository packages; the package is the directory the file lives in. e.g. ["services/devops"] */ packages?:Array<string>;/** Run exactly these cases, named by id; use it to re-run a known failure without widening to its whole area. e.g. [] */ cases?:Array<string>;/** True keeps only cases declared safe to run against a production environment; use it for a plan whose environment is production. e.g. false */ prodSafeOnly?:boolean;/** Present to select only the cases a commit range can affect, the way a presubmit wants it. */ affected?:{/** The commit the change is measured against; the affected set is what changed between this commit and the run's own commit. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ base?:string}};/** How many cases the run selected; compare it with the catalog's case count when a run looks too small. e.g. 34 */ selectedCount:number;/** Which rule produced this set — a plan's selector, an explicit list, or the affected set of a commit range. e.g. "plan" */ reason:"affected"|"plan"|"explicit";/** What the affected selection reacted to — the changed packages, files or cases; present only when reason is affected. e.g. ["packages/praxis/rpc-kit"] */ affectedBy?:Array<string>};/** How many times each selected case ran in this run; more than one means a flake can be told apart from a real failure. e.g. 1 */ repeat:number;/** How far the run has got, from being queued to being finished; finished is the only state where the result is final. e.g. "finished" */ state:"queued"|"provisioning"|"running"|"reporting"|"finished";/** The verdict. e.g. "failed" */ result:"pending"|"passed"|"failed"|"errored"|"cancelled"|"timed_out"|"no_tests";counts:{/** Executions that passed, counting a case that passed on a retry as passed. e.g. 30 */ passed:number;/** Executions that failed and counted against the run; quarantined failures are not included here. e.g. 2 */ failed:number;/** Executions that failed and then passed on a retry inside this run. e.g. 1 */ flaky:number;/** Selected executions the tool reported as skipped; they neither pass nor fail the run. e.g. 0 */ skipped:number;/** Selected executions that have not reported yet, which is why a run may still change its result. e.g. 1 */ pending:number;/** Executions reported under a status outside the known set, kept visible instead of being folded into passed or failed. e.g. 0 */ other:number;/** Failures from quarantined cases; they are recorded but do not fail the run, so they explain a failed case that did not fail the verdict. e.g. 1 */ quarantinedFailures:number};/** The external tool that produced the results, present for runs whose results arrived as an uploaded report. */ tool?:{/** Name of the tool that ran the cases, as the uploader declared it. e.g. "playwright" */ name?:string;/** Version of that tool, when the uploader declared one; absent otherwise. e.g. "1.48.0" */ version?:string};/** How many parallel pieces the run's cases were split into, which bounds how long the run takes. e.g. 1 */ shards:number;requestedBy:{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string};/** The earlier run this one re-runs cases from; absent unless the trigger is a retry. e.g. "trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ retryOf?:string;/** RFC 3339 UTC time execution actually began; absent while the run is still queued. e.g. "2026-11-03T09:01:00Z" */ startTime?:string;/** RFC 3339 UTC time the run stopped, whether it finished, failed, was cancelled or timed out; absent while it is still going. e.g. "2026-11-03T09:12:00Z" */ endTime?:string;/** Why the run was cancelled, as given by whoever cancelled it; present only for cancelled runs. e.g. "superseded by trn_01JQ8Z3M9K4V7B2N6C5X0YTRHX" */ cancelReason?:string;/** What the executor reported when the run errored; present only for errored runs, and it concerns the run, not the cases. e.g. "executor lost before reporting shard 2" */ errorMessage?:string;/** Present only when the read asked to expand failedExecutions; it lists this run's non-passed executions so a second call is not needed. */ failedExecutions?:Array<{/** The run this execution belongs to, from the run list or create answer. e.g. "trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ run:string;/** The case that was executed, retrievable with a case read for its declaration and state. e.g. "tc_9f2b1c0d8e7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c" */ case:string;/** The case's title as it read when this run executed it, which may predate a later rename. e.g. "a route the table does not name is a 404 and never reaches the service" */ title:string;/** The repository package the executed case lives in. e.g. "services/devops" */ package:string;/** Path of the file that declared the case, relative to the repository root. e.g. "services/devops/spec/features/http-face/http-face.feature" */ file?:string;/** How this execution ended. e.g. "failed" */ status:"passed"|"failed"|"skipped"|"pending"|"other"|"timed_out"|"cancelled";/** True when the case failed and then passed on a retry inside the same run — the fact behind the run's flaky count. e.g. false */ flaky:boolean;/** True when the case was quarantined at the time of the run, so its failure was recorded but did not fail the verdict. e.g. false */ quarantined:boolean;/** How long the case took in milliseconds, summed over its attempts. e.g. 412 */ durationMs:number;/** Every attempt this case took, in order; more than one is what a retry or a flake looks like. */ attempts:Array<{/** Which try this was, counting from 1. e.g. 1 */ attempt:number;/** How this try ended, using the same vocabulary as the execution it belongs to. e.g. "failed" */ status:"passed"|"failed"|"skipped"|"pending"|"other"|"timed_out"|"cancelled";/** How long this try took in milliseconds. e.g. 380 */ durationMs:number;/** The failure message for this try; absent when it did not fail. e.g. "expected 404, received 400" */ message?:string;/** Diagnostic text for this try, such as a stack trace; absent when none was reported. e.g. "at Object.<anonymous> (http-face.steps.ts:57:3)" */ trace?:string;/** RFC 3339 UTC time this try began; absent when the tool reported no timing. e.g. "2026-11-03T09:04:00Z" */ startTime?:string}>;/** The failure message the tool reported, as written; absent for executions that did not fail. e.g. "expected 404, received 400" */ message?:string;/** The step that failed, when the tool identifies one; absent for tools that report only a message. e.g. "Then the answer is HTTP 404" */ failedStep?:string;/** Stack trace or equivalent diagnostic text; absent when the tool reported none. e.g. "at Object.<anonymous> (http-face.steps.ts:57:3)" */ trace?:string;/** Files recorded as evidence for this execution, such as screenshots or reports; empty when the tool attached none. */ evidence:Array<{/** File name as the producing tool wrote it, for display when listing evidence. e.g. "http-face-404.png" */ name:string;/** Media type of the stored file, which decides whether it can be shown inline. e.g. "image/png" */ contentType:string;/** Identifier of the stored file, used to fetch its contents through the file API. e.g. "file_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ fileId:string;/** Size of the stored file in bytes. e.g. 48123 */ size:number}>;/** True when the executed case was not in the catalog at that commit, so a result exists for a case the project no longer knows; it is surfaced rather than dropped e.g. false */ uncatalogued:boolean}>;/** Present only when the run's counts cannot be trusted: they add up to more executions than the cases the run selected, which only happens when a case was counted */ countsUntrusted?:{/** What the disjoint count buckets (passed, failed, skipped, pending, other and quarantined failures) add up to; flaky is not added because it qualifies a case alr e.g. 7539 */ counted:number;/** How many cases the run selected, which is the bound the counts must fit. e.g. 7500 */ selectedCount:number;/** How many executions the counts report beyond the selection; 0 never appears here, since the field itself only appears when the counts are over. e.g. 39 */ overflow:number}}>;

参数

名称位置类型必填说明
projectpathstring是Identifies the project whose data you are reading, from the project list or create answer.

请求体

必填内容类型说明
是application/jsonThe commit to test, plus the plan or selector that decides which cases run.

响应

状态码内容类型说明
200application/jsonThe created run; its result is pending until executions are reported, unless waitUntil already waited for a verdict.
400application/jsonINVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible.
404application/jsonPROJECT_NOT_FOUND means no project with that id is visible to this organization; list the projects and use an id from that answer.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.