Skip to main content

Data-Driven Testing

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/

Override in .restlynrc:

[test]
data = 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!

โžก๏ธ Next: Advanced Tags & Control