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
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!
โก๏ธ Next: Advanced Tags & Control