Skip to content

Data-Driven Testing

Learn how to parameterize declarative test cases and author multidimensional validation matrices.

The standard Gherkin syntax for data-driven testing relies on Scenario Outline:

@priority-high @component-billing
Feature: 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 |

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 plan to indicate an in-place update (~ update).
  • Avoids creating duplicate issues in GitHub or Jira; the existing issue is updated cleanly with the expanded dataset.

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 @unique tag from final metadata.
  • Each variation is stored as an independent, fully trackable testcase resource in the state ledger.