Skip to main content

Test Object

Each entry in the tests array represents a single executed test case. A test object captures the identity, outcome, timing, diagnostics, and optional retry data for that test.

Properties​

NameTypeRequiredDescription
idStringOptionalLegacy UUID identifier retained for compatibility. New producers should prefer testId; consumers should prefer testId when both are present.
testIdStringOptionalStable, non-empty identifier for the logical test case. It should be deterministic across runs within the producer's documented scope.
executionIdStringOptionalNon-empty identifier for this specific execution of the test case within a run. UUID is recommended and the value should not be reused across runs.
attemptIdStringOptionalNon-empty identifier for the final attempt, including an initial attempt with no retry. UUID recommended; preserve when the same raw attempt is represented in a merged report.
nameStringRequiredThe name or title of the test case. Must be a non-empty string.
statusStringRequiredThe final outcome of the test. Must be one of: passed, failed, skipped, pending, other.
durationNumberRequiredThe total execution time for the test case, in milliseconds.
startIntegerOptionalWhen test execution began, in milliseconds since the Unix epoch.
stopIntegerOptionalWhen test execution ended, in milliseconds since the Unix epoch.
suiteArray of StringsOptionalSuite hierarchy from top-level suite to the immediate parent of the test. Useful for logical grouping.
messageStringOptionalA user-visible error or failure message associated with the test result.
traceStringOptionalA stack trace or structured trace information describing the failure.
snippetStringOptionalA code snippet or relevant source excerpt associated with the failure.
aiStringOptionalAI-generated diagnostic data, commentary, or suggestions related to the test.
lineIntegerOptionalThe line number associated with the test definition.
rawStatusStringOptionalThe original status from the source tool before CTRF normalization.
tagsArray of StringsOptionalSimple keyless classifications (e.g., ["smoke", "regression"]).
labelsObjectOptionalStructured key-value metadata. Values may be strings, numbers, booleans, or non-empty arrays of those primitive types.
typeStringOptionalA classification for the test (e.g., "unit", "integration", "e2e").
filePathStringOptionalThe path to the file that defines the test case.
retriesIntegerOptionalNumber of re-executions after the initial attempt. Must be a non-negative integer. When greater than zero, requires retryAttempts with exactly this many entries. When zero, retryAttempts must be absent.
flakyBooleanOptionalWhether the test is considered flaky. True only if final status is passed after one or more failed attempts.
stdoutArray of StringsOptionalLines of standard output generated during test execution.
stderrArray of StringsOptionalLines of standard error output generated during test execution.
descriptionStringOptionalHuman-readable context for the test case.
assertionFailuresArrayOptionalNon-empty list of failed assertions from this attempt. Each entry can include message, trace, expected and actual strings, and extra metadata.
threadIdStringOptionalIdentifies the worker for the final attempt. Earlier attempts can record their own threadId in retryAttempts.
browserStringOptionalThe browser used during test execution (for browser-based tests).
deviceStringOptionalThe device or device profile used during test execution.
screenshotStringOptionalA single base64-encoded screenshot captured during execution. Must not be a URL or file path.
parametersObjectOptionalTest parameters, input values, or contextual data relevant to the execution. See Parameters Object.
stepsArray of ObjectsOptionalTest steps or sub-operations performed during the test. See Step Object.
attachmentsArray of ObjectsOptionalAdditional artifacts associated with the test case. See Attachment Object.
retryAttemptsArray of ObjectsOptionalOrdered history of attempts completed before the final attempt represented by the test object. See Retry Attempt Object.
insightsObjectOptionalDerived metrics specific to this test case across runs. See Insights Object.
extraObjectOptionalExtension point for arbitrary test-specific metadata.

Example​

{
"testId": "authentication/login/valid-credentials",
"executionId": "2cf7e0b4-ea0c-4ef4-a18a-b9d6f6f0e100",
"attemptId": "48c3f90b-95a9-4c13-a42f-0888bb0b1000",
"name": "should authenticate user with valid credentials",
"status": "passed",
"duration": 1200,
"suite": ["Authentication", "Login"],
"filePath": "tests/auth/login.spec.ts",
"tags": ["smoke", "auth"],
"labels": {
"priority": "high",
"owners": ["qa", "platform"],
"category": ["smoke", "staging"]
}
}

Use tags for simple keyless categorization. Use labels when metadata has a named key or may have multiple values. Label arrays must contain at least one value. Mixed primitive arrays are valid, though producers should use one primitive type per key where practical.


Attachment Object​

The attachment object supports additional contextual information for test results, such as screenshots, logs, videos, or other artifacts. This enables better debugging and enhanced insights into test executions.

Attachment Properties​

PropertyTypeRequiredDescription
attachmentIdStringOptionalNon-empty identifier for this attachment reference. UUID is recommended and the value should be unique within the containing test or attempt.
nameStringRequiredA display name for the attachment (e.g., "failure-screenshot").
contentTypeStringRequiredThe MIME type of the attachment (e.g., image/png, text/plain, video/mp4).
pathStringRequiredThe path or URI to the attachment file.
extraObjectOptionalExtension point for arbitrary attachment-specific metadata.

Attachment Example​

{
"attachments": [
{
"attachmentId": "72d531af-9d77-4f3b-bf67-0d8ec26c2001",
"name": "failure-screenshot",
"contentType": "image/png",
"path": "./artifacts/screenshots/login-failure.png"
}
]
}

Step Object​

The step object supports Behavior-Driven Development (BDD) style testing. It provides a structured way to describe each step in a test scenario, along with its outcome.

Step Properties​

PropertyTypeRequiredDescription
nameStringRequiredThe name or description of the test step.
statusStringRequiredThe outcome of the step. Must be one of: passed, failed, skipped, pending, other.
extraObjectOptionalExtension point for arbitrary step-specific metadata.

Step Example​

"steps": [
{ "name": "Navigate to login page", "status": "passed" },
{ "name": "Enter user credentials", "status": "passed" },
{ "name": "Click submit button", "status": "failed" }
]

Retry Attempt Object​

The retryAttempts array records attempts completed before the final attempt represented by the test object. It includes the initial attempt when a retry occurs and excludes the final attempt. Entries must be ordered, unique, and contiguous from attempt number 1. When present, the array must be non-empty and retries must also be present with exactly the same count. A positive retries value requires this array; retries: 0 requires it to be absent. The final attempt number is retries + 1.

Retry Attempt Properties​

PropertyTypeRequiredDescription
attemptIntegerRequiredOriginal sequence number for this attempt. Starts at 1 and forms a contiguous sequence within retryAttempts.
attemptIdStringOptionalNon-empty identifier for this individual attempt. UUID is recommended and the value should be unique within the execution.
statusStringRequiredThe outcome of this attempt. Must be one of: passed, failed, skipped, pending, other.
durationNumberOptionalThe non-negative execution time for this attempt, in milliseconds.
messageStringOptionalError or failure message for this attempt.
traceStringOptionalStack trace for this attempt.
lineIntegerOptionalLine number associated with the failure.
snippetStringOptionalCode snippet for this attempt.
stdoutArray of StringsOptionalStandard output lines from this attempt.
stderrArray of StringsOptionalStandard error lines from this attempt.
startIntegerOptionalWhen this attempt started, in milliseconds since the Unix epoch.
stopIntegerOptionalWhen this attempt ended, in milliseconds since the Unix epoch.
attachmentsArray of ObjectsOptionalArtifacts captured during this specific attempt.
extraObjectOptionalExtension point for arbitrary attempt-specific metadata.

Retry Attempt Example​

"retryAttempts": [
{
"attempt": 1,
"attemptId": "48c3f90b-95a9-4c13-a42f-0888bb0b1001",
"status": "failed",
"duration": 500,
"message": "Element not found"
}
]

In this example, the test object contains the final attempt. With one entry in retryAttempts, retries must be 1 and the final attempt number is 2.


Parameters Object​

The parameters object supports parameterized tests by storing test-specific input values. This is an unstructured object allowing flexible key-value pairs representing parameters relevant to test execution.

Parameters Example​

"parameters": {
"username": "testUser",
"password": "testPass123",
"environment": "staging"
}

Final attempt correlation​

The Test object represents the final attempt. Its optional attemptId identifies that attempt, while executionId identifies the complete coordinated lifecycle. Earlier attempts remain in retryAttempts, retaining their original IDs. Different attempts should have different IDs within an execution. Retransmissions and raw/merged representations of the same attempt keep the same ID; consumers should correlate by execution and attempt identity without counting it twice.

For example, two coordinated raw results share executionId: "login-run-1": the initial failed result has attemptId: "login-attempt-1", and the successful retry has attemptId: "login-attempt-2". The merged result is:

{
"name": "login(alice)",
"testId": "login/alice",
"executionId": "login-run-1",
"attemptId": "login-attempt-2",
"status": "passed",
"duration": 50,
"retries": 1,
"flaky": true,
"retryAttempts": [
{ "attempt": 1, "attemptId": "login-attempt-1", "status": "failed", "duration": 100 }
]
}

Reports may omit the optional attemptId. When it is present, it identifies one attempt rather than the complete execution lifecycle. Never manufacture an attempt ID from a lifecycle-wide executionId.

Diagnostics on earlier attempts​

Earlier attempts may include their own assertionFailures and threadId. Keep failed assertions with the attempt that produced them; an earlier failure does not belong on a successful final attempt. Thread IDs identify each attempt's actual worker. Tools combining reports from different hosts should qualify IDs so that unrelated workers do not appear identical.

Assertion failure entries​

Each assertionFailures array must contain at least one entry. An entry contains at least one of message, trace, expected, actual (strings), or extra (an object). Format comparisons as strings; an empty string is valid. Omit values that the source does not provide. The same shape applies to final and earlier attempts. description supplies optional human-readable context for the test case, separate from its stable name or failure diagnostics.

See Assertion Failure Object in CTRF 0.3.0.