Data-Driven Testing
Learn how to parameterize declarative test cases and author multidimensional validation matrices.
Scenario Outline and Examples Tables
Section titled “Scenario Outline and Examples Tables”The standard Gherkin syntax for data-driven testing relies on Scenario Outline:
@priority-high @component-billingFeature: Pricing and Volume Tier Discount Calculator
@tc-pricing-calculator-001 Scenario Outline: Volume tier discounts based on purchased license count Given an active subscription on plan "<plan>" When the customer requests to purchase <quantity> seats Then the system applies a discount rate of "<discount>" And the final calculated unit price is "<unit_price>"
Examples: | plan | quantity | discount | unit_price | | Starter | 1 | 0% | $29.00 | | Starter | 5 | 5% | $27.55 | | Enterprise | 10 | 15% | $24.65 | | Enterprise | 50 | 25% | $21.75 | | Enterprise | 100 | 35% | $18.85 |State Ledger Reconciliation
Section titled “State Ledger Reconciliation”By default, Testform manages the entire Scenario Outline as a single declarative resource (@tc-pricing-calculator-001), computing a hash across both the scenario steps and the Examples table.
Modifying or appending rows to the Examples matrix:
- Prompts
testform planto indicate an in-place update (~ update). - Avoids creating duplicate issues in GitHub or Jira; the existing issue is updated cleanly with the expanded dataset.
Dynamic Cases with @unique
Section titled “Dynamic Cases with @unique”If rather than consolidating all rows into a single test case you need each row of the Examples table to exist as an independent testcase resource with its own lifecycle and remote issue, combine the @unique tag with a <column> placeholder in the identity tag:
Feature: Role-Based Authentication
@unique @tc-login-<role> Scenario Outline: System access by role <role> Given the user navigates to "/login" When entering credentials for role "<role>" Then the corresponding main view is displayed
Examples: | role | | admin | | auditor | | candidate |During reconciliation (testform plan or apply):
- Testform dynamically substitutes the column value for each row, generating
@tc-login-admin,@tc-login-auditor, and@tc-login-candidate. - It automatically strips the
@uniquetag from final metadata. - Each variation is stored as an independent, fully trackable
testcaseresource in the state ledger.