跳转到内容
EN

Upload an external test report

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

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

Record the results of a run executed outside Praxis by uploading a CTRF or JUnit report. Nothing has to exist first: a first upload from CI creates the run it reports on (executor external) and catalogues the cases the report names, so there is no setup call before the first result. When the report already belongs to a run, pass ref and the upload joins it; the run’s counts and verdict are recomputed from the report. Uploading the same reportId again is idempotent and counts once, so a retry after a timeout is safe — and a reported case is catalogued once, however many reports carry it. The report’s bytes are kept as a file (the file field of the answer) rather than in the results database, so the original document stays retrievable. Send purpose feedback instead when the report is your own local run rather than evidence: the document is stored as an organization-private file and nothing else happens — no run is created or joined, no case state changes and the merge gate never reads it — so a developer’s machine can publish what it ran without any commit being credited as tested. With purpose evidence the report is also filed as test evidence, package by package: DevOps recomputes each package’s input hash from ref.commit (so the commit must already be pushed; an unreadable commit records the run but no evidence), and writes passed or failed only for a package whose every case at the gate’s sizes the report carries — a report of a few files leaves that package without evidence. Pass ref.branch and ref.pullRequest so the run says where it came from; devops.projects.retrieveTestPlan at the commit then shows what the gate will read.

签名

praxis.devops.projects.testReports.create(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string};body:{/** Your own identifier for this report. e.g. "rep_2026_11_03_presubmit" */ reportId:string;/** What the report is for, and it decides whether the upload touches a run at all. e.g. "feedback" */ purpose?:"evidence"|"feedback";/** Which report format the document is in; it decides how the document is parsed. e.g. "ctrf" */ format:"ctrf"|"junit";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 report document itself, as text — JSON for ctrf, XML for junit. e.g. "{\"results\":{\"tool\":{\"name\":\"playwright\"},\"summary\":{\"tests\":4,\"passed\":3,\"failed\":1},\"tests\":[]}}" */ report:string}}):Promise<{/** Identifier of the stored report, for reference when reconciling an upload with a run. e.g. "trp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The run this report was folded into, whose counts were recomputed from it; null for a feedback upload, which never creates or joins a run. e.g. "trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ run:string|null;/** What this upload was for, echoed back so a caller mixing the two cannot read feedback as evidence. e.g. "feedback" */ purpose:"evidence"|"feedback";/** The report format that was parsed, echoed back so a caller mixing formats can confirm which one was recorded. e.g. "ctrf" */ format:"ctrf"|"junit";/** RFC 3339 UTC time the report was received; a repeat upload of the same reportId keeps the first time. e.g. "2026-11-03T09:20:00Z" */ receivedTime:string;/** How many executions this report carried, which is how a caller notices a report that folded in fewer results than expected. e.g. 4 */ executionCount:number;/** How many cases this upload added to the catalog because the report named cases the catalog did not have yet. e.g. 3 */ autoCataloged?:number;/** The file holding this report's original bytes, which is how a caller fetches the document a run's results were computed from. e.g. "file_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ file?:(string)|null}>;

参数

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

请求体

必填内容类型说明
是application/jsonThe report document, its format, the run it belongs to, and the caller’s own report id.

响应

状态码内容类型说明
200application/jsonThe stored report with how many executions it carried and when it was received.
400application/jsonREPORT_INVALID means the body is not a well-formed report of the declared format, or a required field is missing; nothing was recorded, so correct the document and upload it again.
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.