Pipeline YAML Schema Reference

This document provides a complete technical reference for the Test Pipeline YAML schema. For usage examples and best practices, see Test Pipeline Writing Guideline and Samples.

Schema Version

Testany currently supports both rule/v1.2 and rule/v1.3.

ℹ️

For all new pipelines, Testany explicitly recommends rule/v1.3. rule/v1.2 is retained only for backward compatibility and does not provide case-level parallel execution.

Version Selection Guidance

VersionStatusDescription
rule/v1.3RecommendedUse for all new pipelines; supports case-level parallel execution while keeping whenPassed / whenFailed / expect / relay semantics
rule/v1.2Compatibility onlyExisting pipelines continue to run; no case-level parallel execution
rule/v1.1Compatibility onlyBackward compatibility for older legacy pipelines

Default Concurrency in rule/v1.3

When a pipeline uses rule/v1.3, the platform decides the default actual concurrency by instance type:

  • Community Edition defaults to 2
  • Paid Community users default to 4
  • Enterprise Edition defaults to 8

If the number of semantically parallel-ready cases is greater than the concurrency available to the current workspace, the platform queues and refills slots instead of starting everything at once. When slots are limited, dispatch order within the same ready wave follows YAML order.

Top-Level Structure

YAML
kind: rule/v1.3
spec:
  rules:
    - run: <TEST-CASE-KEY>
      # ... rule fields
FieldTypeRequiredDescription
kindstringYesSchema version identifier. rule/v1.3 is recommended for new pipelines. rule/v1.2 is supported only for backward compatibility.
specobjectYesPipeline specification container.
spec.rulesarrayYesList of rule objects defining the pipeline execution flow. Must contain at least one rule.

Rule Object

Each rule in the rules array defines a Test Case to execute and its conditions.

YAML
- run: AC2F5A50
  whenPassed: 9686C618
  expect: fail
  relay:
    - key: ACCESS_TOKEN
      refKey: 9686C618/ACCESS_TOKEN
      nonSecret: true

Rule Fields

FieldTypeRequiredDefaultDescription
runstringYes-The Test Case Key to execute. Must be unique within the pipeline.
whenPassedstringNo-Condition: Execute this rule only when the specified case passes.
whenFailedstringNo-Condition: Execute this rule only when the specified case fails.
expectstringNopassExpected result. Use fail when the test case is expected to fail (e.g., negative testing).
relayarrayNo[]List of relay configurations for passing variables between cases. Available in both rule/v1.2 and rule/v1.3.

Condition Fields: whenPassed vs whenFailed

⚠️

whenPassed and whenFailed are mutually exclusive. You cannot use both on the same rule.

FieldTrigger Condition
whenPassedThe referenced case reported Passed to the pipeline. Note: A case with expect: fail always reports Passed regardless of actual result.
whenFailedThe referenced case reported Failed, Aborted, or Timeout to the pipeline. Note: This will never trigger for a case with expect: fail.

Validation Rules:

  • The referenced Test Case Key must be defined in a preceding rule.
  • If neither whenPassed nor whenFailed is specified, the rule executes unconditionally (or after the test script that provides relay data finishes, if relay is defined).

The expect Field

The expect field changes how the test result is reported to the pipeline.

ValueBehavior
pass (default)The case reports its actual result to the pipeline.
failThe case always reports Passed to the pipeline, regardless of actual execution result. This is useful when you expect a test to fail but don't want it to fail the pipeline.

Key Point: A case with expect: fail always reports Passed to the pipeline. Therefore, subsequent cases should use whenPassed (not whenFailed) to follow it.

YAML
- run: A1B2C3D4             # Test case: validate setup
- run: E5F6A7B8             # Test case: test invalid input
  whenPassed: A1B2C3D4
  expect: fail              # Always reports "Passed" to pipeline
- run: C9D0E1F2             # Test case: next step
  whenPassed: E5F6A7B8      # Use whenPassed, not whenFailed

Relay Object

The relay field enables Output Relay - passing environment variables from one case to another.

YAML
relay:
  - key: ACCESS_TOKEN
    refKey: 5DC1106D/ACCESS_TOKEN
    nonSecret: true

Relay Fields

FieldTypeRequiredDefaultDescription
keystringYes-The environment variable name to define for the current case.
refKeystringYes-Reference to the source variable. Format: <SOURCE-CASE-KEY>/<VARIABLE-NAME>.
nonSecretbooleanNofalseIf true, the value can be printed in logs. If false (default), the value is treated as sensitive and masked in logs.

Relay Validation Rules

⚠️

The following configurations will cause validation errors:

  1. Missing fields: Both key and refKey are required.
  2. Undefined source: The source case (refKey prefix) must be defined in a preceding rule.
  3. Relay with whenFailed: You cannot relay from a case that you reference with whenFailed.
  4. Parallel ambiguity: In rule/v1.3, the test script that provides relay data must be guaranteed to complete before the test script that consumes relay data starts. If both could land in the same parallel-ready wave, the configuration is rejected.

Invalid Example:

YAML
# ERROR: Cannot relay from a failed case
- run: 5385B189
- run: A3D9405F
  whenFailed: 5385B189      # This case failed
  relay:
    - key: NEW_URL
      refKey: 5385B189/NEW_URL  # Cannot relay from failed case

Implicit whenPassed Behavior

If a rule has relay defined but no explicit whenPassed or whenFailed, the system automatically adds whenPassed referencing the first test script that provides relay data.

YAML
# These two configurations are equivalent:

# Explicit
- run: 5DC1106D
- run: DE96D6A0
  whenPassed: 5DC1106D
  relay:
    - key: TOKEN
      refKey: 5DC1106D/TOKEN

# Implicit (system adds whenPassed automatically)
- run: 5DC1106D
- run: DE96D6A0
  relay:
    - key: TOKEN
      refKey: 5DC1106D/TOKEN

Complete Validation Rules

The platform validates Pipeline YAML against these rules:

RuleError Message
rules array is emptydefinition error: no rules defined
Both whenPassed and whenFailed on same rulerule N error: multiple precondition
Condition references undefined caserule N error: precondition undefined
Duplicate run valuesrule N error: duplicate run
Relay missing key or refKeyrule N error: relay must contain both a key and a refKey
Relay references undefined caserule N error: relay undefined for <refKey>
Relay from whenFailed caserule N error: The identifier <case> was used in the relay reference. The precondition for the current rule should be set to whenPassed instead of whenFailed.
Duplicate relay keys in same rulerule N error: duplicate relay

Quick Reference

Minimal Pipeline

YAML
kind: rule/v1.3
spec:
  rules:
    - run: A1B2C3D4           # Your test case key

Sequential Execution (Pass Chain)

YAML
kind: rule/v1.3
spec:
  rules:
    - run: A1B2C3D4           # Step 1
    - run: E5F6A7B8           # Step 2
      whenPassed: A1B2C3D4
    - run: C9D0E1F2           # Step 3
      whenPassed: E5F6A7B8
YAML
kind: rule/v1.3
spec:
  rules:
    - run: A1B2C3D4           # Test A
    - run: E5F6A7B8           # Test B
    - run: C9D0E1F2           # Test C
📝

In rule/v1.3, the three root cases above are semantically parallel-capable. If the current workspace does not have enough available concurrency slots, the platform starts them in YAML order as slots are refilled. The same shape in rule/v1.2 still follows legacy serial semantics.

With Output Relay

YAML
kind: rule/v1.3
spec:
  rules:
    - run: A1B2C3D4           # Login test case
    - run: E5F6A7B8           # Create order test case
      whenPassed: A1B2C3D4
      relay:
        - key: ORDER_ID
          refKey: A1B2C3D4/ORDER_ID
        - key: ITEM_COUNT
          refKey: A1B2C3D4/ITEM_COUNT
          nonSecret: true

Negative Testing

YAML
kind: rule/v1.3
spec:
  rules:
    - run: A1B2C3D4           # Test case: test invalid input
      expect: fail            # Always reports "Passed" regardless of actual result
    - run: E5F6A7B8           # Test case: next test
      whenPassed: A1B2C3D4    # Use whenPassed since expect:fail always reports Passed

See Also

Still have questions?

Our team is here to help. Get in touch and we'll get back to you as soon as possible.