Data-driven testing
Drive Restlyn scenarios with CSV or JSON datasets, dynamic variables, and row iteration.
On this page
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
testNameas the test case label if present - Inject
rowdata into the request body - Support
row.skip = trueto 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.jsoncontract
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.