Outputs
Output Values in Testform allow you to extract and export data generated during test execution (remote IDs, report URLs, execution metrics, tokens) for downstream consumption in CI/CD pipelines or across modules.
Directly mirroring Terraform’s output block, outputs are persisted in the state ledger (testform.state) upon successful testform apply.
Declaring Outputs
Section titled “Declaring Outputs”Outputs can be declared in output.yml or root main.yml:
# main.yml or output.ymloutput: login_case_title: description: "Title of the authentication scenario" value: "${testcase.auth/login.case.feature.@tc-1.title}"
smoke_run_id: description: "Remote Run ID from execution provider" value: "${testrun.suites/smoke.run.feature.@tr-1.remoteId}"
report_url: description: "Direct URL to generated HTML report" value: "${local.base_url}/reports/${testrun.suites/smoke.run.feature.@tr-1.remoteId}"CLI Command: testform output
Section titled “CLI Command: testform output”Query stored outputs from the state ledger at any time:
1. Listing all outputs
Section titled “1. Listing all outputs”testform outputlogin_case_title = "Successful login"smoke_run_id = "local:15"report_url = "https://app.com/reports/local:15"2. Extracting raw scalar values (-raw)
Section titled “2. Extracting raw scalar values (-raw)”Perfect for shell scripts or CI/CD environment exports:
export RUN_ID=$(testform output smoke_run_id -raw)3. Machine-readable JSON output (-json)
Section titled “3. Machine-readable JSON output (-json)”Process outputs programmatically with tools like jq:
testform output -jsonConsuming Module Outputs
Section titled “Consuming Module Outputs”When consuming child modules via @module, their outputs are scoped under module.<name>.<output> and can be referenced in consumer scenarios or root output: blocks:
Scenario: Reusing session token from auth module Given request header is set to "Authorization: Bearer ${module.auth_module.auth_token}" When user queries protected endpoint Then response status is 200 OK