Skip to content

testform validate

Ventana de terminal
testform [global options] validate [options]

The testform validate command validates the syntax and consistency of your configuration files (both .feature files and main.yml). It verifies that all steps conform to the Gherkin grammar, custom fields match declared schemas, and no policy violations exist.

Validation runs locally and does not access remote APIs or verify credentials.

Option Default Description
-target=target None Targets a specific .feature file or resource for validation (e.g. -target=tests/smoke.run.feature or -target="auth/login.case.feature.@tc-1").
-scope=scope all Restricts validation to a given scope (testcase, testrun, testplan, or all).
-json false Emits validation diagnostics as a JSON object, ideal for CI linters and GitHub Checks.
-no-tests false Skips running registered quality policies.
-test-directory=dir tests Directory containing test feature files.
-query=text None Filters scenarios matching a text query.
-no-color false Disables colored console output.
Ventana de terminal
$ testform validate
Validating configuration...
Success! The configuration is valid.
Scenarios: 8
Scope: all (testcase: 6, testrun: 1, testplan: 1)
Ventana de terminal
$ testform validate -scope=testcase
Validating configuration...
Success! The configuration is valid.
Scenarios: 6
Scope: testcase

Targeted File or Resource Validation (-target)

Section titled “Targeted File or Resource Validation (-target)”
Ventana de terminal
$ testform validate -target=tests/testrun/smoke.run.feature
Validating configuration...
Success! The configuration is valid.
Scenarios: 1
Scope: testrun
Ventana de terminal
$ testform validate
╷
│ Warning: Undeclared field 'type_of_test'
│
│ in tests/cart.case.feature:
│ The field 'type_of_test' is used but not declared in main.yml schema.
╵
Success! The configuration is valid, but there were some warnings.

Error Output (Syntax or Required Policy Failure)

Section titled “Error Output (Syntax or Required Policy Failure)”
Ventana de terminal
$ testform validate
╷
│ Error: Every scenario must have an identity tag matching the configured identity pattern.
│
│ in tests/login.case.feature:14
│ Add the identity tag (e.g. @tc-1) to each scenario.
╵
Error: The configuration contains errors.

Integration in CI/CD Pre-Commit & PR Checks

Section titled “Integration in CI/CD Pre-Commit & PR Checks”

Add testform validate -json to your GitHub Actions pull request checks to prevent invalid Gherkin syntax from being merged into main branches:

- name: Validate Test-as-Code Configuration
run: testform validate -json
  • 0: Configuration is valid (warnings may be present).
  • 1: Configuration contains validation errors.