Data-driven testing

Drive Restlyn scenarios with CSV or JSON datasets, dynamic variables, and row iteration.

Restlyn supports dynamic test generation from CSV or JSON files to cover multiple test cases in a single scenario.


๐Ÿงช Gherkin Format

Use this syntax in your .feature file:

When I POST "/login" using data from "loginData.csv"

Restlyn will look inside the data/ folder by default.


๐Ÿ“ Default Data Folder

data/

Set the root-level testData value before any INI section in .restlynrc:

testData = my-test-data

๐Ÿ“„ Supported Formats

โœ… CSV

email,password,testName
user1@example.com,pass123,Valid user
user2@example.com,wrong,Invalid password

โœ… JSON

[
  { "email": "user1@example.com", "password": "pass123", "testName": "Valid user" },
  { "email": "user2@example.com", "password": "wrong", "testName": "Invalid password" }
]

๐Ÿš€ Output Behavior

Restlyn will:

  • Create a looped test block
  • Use testName as the test case label if present
  • Inject row data into the request body
  • Support row.skip = true to skip specific entries

๐Ÿ’ก Inline vs File-based

If both a Gherkin data table and file are specified:

  • File takes precedence
  • A warning will be logged to avoid confusion

๐Ÿงฌ Combining with Schema Validation

Each iteration will:

  • Be validated against the expected response status
  • Optionally validate against a .schema.json contract

Data-driven tests help you validate edge cases, boundaries, and regressions โ€” fast!

Migrated from the Restlyn documentation, with reviewed example and configuration corrections. Original Restlyn documentation.