From 64e8995d6af6a4e1ea5feb616b744cf3cce20e0b Mon Sep 17 00:00:00 2001 From: Matthew Thomas <25988124+Ma11hewThomas@users.noreply.github.com> Date: Sat, 24 Oct 2026 13:17:31 +0100 Subject: [PATCH 1/2] Clarify case identity and coordinated retry executions --- CHANGELOG.md | 2 + examples/parameterized-cases.json | 42 +++++++++++++ schema/ctrf.schema.json | 4 +- spec/ctrf.md | 72 ++++++++++++++++++++++- tests/ctrf.test.json | 5 ++ tests/normative/valid-documents.test.json | 5 ++ 6 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 examples/parameterized-cases.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 35215c2..e692e81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Clarified parameterized case identity, rename and path scopes, and execution identity across coordinated retry processes. + - Defined parameterized test cases and clarified test-case terminology without changing execution or retry semantics. - Clarified deterministic `testId` guidance for UUID version 5 and documented name-based UUID version 8 schemes using RFC 9562. diff --git a/examples/parameterized-cases.json b/examples/parameterized-cases.json new file mode 100644 index 0000000..c085d8d --- /dev/null +++ b/examples/parameterized-cases.json @@ -0,0 +1,42 @@ +{ + "reportFormat": "CTRF", + "specVersion": "0.2.0", + "runId": "example-parameterized-run", + "results": { + "tool": { + "name": "example-runner" + }, + "summary": { + "tests": 2, + "passed": 2, + "failed": 0, + "skipped": 0, + "pending": 0, + "other": 0, + "start": 1700000000000, + "stop": 1700000000020 + }, + "tests": [ + { + "name": "login", + "testId": "login-case-alice", + "executionId": "login-execution-alice", + "status": "passed", + "duration": 10, + "parameters": { + "username": "alice" + } + }, + { + "name": "login", + "testId": "login-case-bob", + "executionId": "login-execution-bob", + "status": "passed", + "duration": 10, + "parameters": { + "username": "bob" + } + } + ] + } +} diff --git a/schema/ctrf.schema.json b/schema/ctrf.schema.json index 8323e01..66ecc00 100644 --- a/schema/ctrf.schema.json +++ b/schema/ctrf.schema.json @@ -144,12 +144,12 @@ "minLength": 1 }, "testId": { - "description": "Stable identifier for the test case. Should be derived from stable test attributes when generated by a producer", + "description": "Stable identifier for the test case within the producer's documented scope. Distinct parameterized cases should have distinct identifiers; retries retain the same identifier. No particular generation algorithm is required", "type": "string", "minLength": 1 }, "executionId": { - "description": "Unique identifier for this specific execution of the test case within a run. UUID recommended", + "description": "Identifier for one execution lifecycle of a test case within a run, including known coordinated retries across processes and their merged result. Independent executions should have different identifiers. UUID recommended", "type": "string", "minLength": 1 }, diff --git a/spec/ctrf.md b/spec/ctrf.md index 906fb34..548f631 100644 --- a/spec/ctrf.md +++ b/spec/ctrf.md @@ -909,6 +909,14 @@ A producer MAY use a canonical string directly, or MAY encode that canonical str > **Informative note.** UUID version 5 uses SHA-1. Under [RFC9562], name-based UUIDs derived from SHA-256 or newer SHA methods MUST use the UUID version 8 space rather than UUID version 5. UUID version 8 defines a custom UUID space, not a single deterministic generation algorithm, and does not by itself guarantee determinism, uniqueness, or interoperability. Producers using a name-based UUID version 8 scheme SHOULD document the hash algorithm, namespace, canonicalization rules, truncation, and bit layout. +For parameterized tests, distinct test cases SHOULD have distinct `testId` values within the producer's documented scope. Retries of the same case SHOULD retain its `testId`. + +The producer chooses its identity scheme. Case-defining parameter values, stable framework identifiers, or explicit case keys MAY be used; producers are not required to serialize parameter values to construct an identifier. Contextual parameters need not participate in case identity. + +An index-based identifier is suitable only when it reliably identifies the same case within the documented scope. If reordering the data source makes an existing identifier refer to a different case, documenting that ordering limitation does not itself establish stability. + +Producers SHOULD preserve `testId` across renames and file moves where their identity mechanism supports it. Name- or path-derived identifiers MAY change after a refactor; producers are not required to detect renames or moves or maintain continuity beyond their documented scope. + Consumers MUST treat the `testId` value as opaque. Consumers MUST NOT assume that `testId` values generated by different producers are globally comparable unless the producers document a shared generation scheme. @@ -927,6 +935,12 @@ If present, it MUST be a non-empty string. UUID is RECOMMENDED. `executionId` SHOULD be unique across executions and SHOULD NOT be reused across runs. +Known attempts of one coordinated execution SHOULD share an `executionId`, including when attempts run in separate processes or their reports remain separate. A merged result for that execution SHOULD retain the same `executionId`. Each distinct report document has its own document identity as defined in Section 5.3. + +An independent execution of the same test case SHOULD have a different `executionId`. Merging reports does not itself establish that their executions are retries; that relationship comes from the coordinated workflow. + +`testId` identifies the case across runs, while `executionId` identifies one execution lifecycle, including its retries. See Appendix D.7 for parameterized cases. + ### 9.3.1. `attemptId` **Description:** @@ -2238,12 +2252,12 @@ to this specification. "minLength": 1 }, "testId": { - "description": "Stable identifier for the test case. Should be derived from stable test attributes when generated by a producer", + "description": "Stable identifier for the test case within the producer's documented scope. Distinct parameterized cases should have distinct identifiers; retries retain the same identifier. No particular generation algorithm is required", "type": "string", "minLength": 1 }, "executionId": { - "description": "Unique identifier for this specific execution of the test case within a run. UUID recommended", + "description": "Identifier for one execution lifecycle of a test case within a run, including known coordinated retries across processes and their merged result. Independent executions should have different identifiers. UUID recommended", "type": "string", "minLength": 1 }, @@ -2834,7 +2848,7 @@ tests/auth/login.test.ts::auth > login::user can log in Producers MAY also encode the canonical string using a deterministic scheme such as UUID version 5, a documented name-based UUID version 8 scheme, or a hash. -This approach ensures that the same test retains the same `testId` across runs, enabling consumers to analyze historical trends, flakiness, and stability. +Stable input selection lets the same test case retain its `testId` across runs within the producer's documented scope. For parameterized tests, the scheme SHOULD distinguish case-defining parameter combinations as described in Section 9.2. Stable framework identifiers or explicit case keys MAY be used instead of name- and path-based generation; no particular algorithm or serialization of parameter values is required. When generating deterministic test identifiers, producers SHOULD: @@ -3553,3 +3567,55 @@ The `ctrf.` and `ctrf/` namespace prefixes are reserved for CTRF-defined extensi } } ``` + + +### D.7. Parameterized Test Cases + +These cases share the same test logic and display name but have different case-defining inputs. The producer supplies distinct stable case keys; CTRF does not require deriving identifiers from the displayed parameter values. A retry of either case would retain its `testId` and coordinated `executionId`. + +This example matches `examples/parameterized-cases.json`. + +```json title="Parameterized test cases" +{ + "reportFormat": "CTRF", + "specVersion": "0.2.0", + "runId": "example-parameterized-run", + "results": { + "tool": { + "name": "example-runner" + }, + "summary": { + "tests": 2, + "passed": 2, + "failed": 0, + "skipped": 0, + "pending": 0, + "other": 0, + "start": 1700000000000, + "stop": 1700000000020 + }, + "tests": [ + { + "name": "login", + "testId": "login-case-alice", + "executionId": "login-execution-alice", + "status": "passed", + "duration": 10, + "parameters": { + "username": "alice" + } + }, + { + "name": "login", + "testId": "login-case-bob", + "executionId": "login-execution-bob", + "status": "passed", + "duration": 10, + "parameters": { + "username": "bob" + } + } + ] + } +} +``` diff --git a/tests/ctrf.test.json b/tests/ctrf.test.json index 295a9fb..fe781c7 100644 --- a/tests/ctrf.test.json +++ b/tests/ctrf.test.json @@ -188,6 +188,11 @@ "tests": [{ "name": "test", "status": "passed", "duration": 100 }] } } + }, + { + "description": "Parameterized cases have distinct case and execution identities", + "valid": true, + "dataPath": "../examples/parameterized-cases.json" } ] } diff --git a/tests/normative/valid-documents.test.json b/tests/normative/valid-documents.test.json index 3d26cdf..444f633 100644 --- a/tests/normative/valid-documents.test.json +++ b/tests/normative/valid-documents.test.json @@ -43,6 +43,11 @@ ] } } + }, + { + "description": "Parameterized cases have distinct case and execution identities", + "valid": true, + "dataPath": "../../examples/parameterized-cases.json" } ] } From 0eefe9df6c1ffe05e1aaa0835f24eacf90bcb916 Mon Sep 17 00:00:00 2001 From: Matthew Thomas <25988124+Ma11hewThomas@users.noreply.github.com> Date: Sun, 25 Oct 2026 11:12:22 +0000 Subject: [PATCH 2/2] Shorten case and execution identity schema descriptions --- schema/ctrf.schema.json | 4 ++-- spec/ctrf.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/ctrf.schema.json b/schema/ctrf.schema.json index e88102d..fb64a70 100644 --- a/schema/ctrf.schema.json +++ b/schema/ctrf.schema.json @@ -144,12 +144,12 @@ "minLength": 1 }, "testId": { - "description": "Stable identifier for the test case within the producer's documented scope. Distinct parameterized cases should have distinct identifiers; retries retain the same identifier. No particular generation algorithm is required", + "description": "Stable identifier for the test case across runs within the producer's documented scope", "type": "string", "minLength": 1 }, "executionId": { - "description": "Identifier for one execution lifecycle of a test case within a run, including known coordinated retries across processes and their merged result. Independent executions should have different identifiers. UUID recommended", + "description": "Identifier for one execution lifecycle of a test case within a run, including coordinated retries. UUID recommended", "type": "string", "minLength": 1 }, diff --git a/spec/ctrf.md b/spec/ctrf.md index 0acda8f..3787dae 100644 --- a/spec/ctrf.md +++ b/spec/ctrf.md @@ -2250,12 +2250,12 @@ to this specification. "minLength": 1 }, "testId": { - "description": "Stable identifier for the test case within the producer's documented scope. Distinct parameterized cases should have distinct identifiers; retries retain the same identifier. No particular generation algorithm is required", + "description": "Stable identifier for the test case across runs within the producer's documented scope", "type": "string", "minLength": 1 }, "executionId": { - "description": "Identifier for one execution lifecycle of a test case within a run, including known coordinated retries across processes and their merged result. Independent executions should have different identifiers. UUID recommended", + "description": "Identifier for one execution lifecycle of a test case within a run, including coordinated retries. UUID recommended", "type": "string", "minLength": 1 },