Data-Driven Testing with Parameters
Data-driven testing in SmoothDeploy. Run the same test against multiple data sets with a JSON array of parameter rows.
Test parameters let you run the same test against multiple data sets without duplicating steps. Each object in the array is one row, and each row is one execution of the test.
Editing Parameters
- Open the test in the Test Editor.
- Click the Parameters tab, then Test Parameters.
Enter a JSON array of objects:
[
{ "username": "testuser", "email": "testuser@test.com" },
{ "username": "testuser2", "email": "testuser2@test.com" }
]Each object is the params fixture for one execution of the test. If the array is empty, or the editor is empty, the test runs once with an empty params object.
Values can be any JSON: strings, numbers, booleans, null, arrays, and nested objects. A value that is not an array, or a row that is not an object, is rejected.
The rows are static. Every run uses the saved rows.
Limits
| Limit | Value |
|---|---|
| Size | 64 KB of JSON |
Saving
Click Save Parameters & Variables. Invalid JSON, or a value with the wrong shape, shows an error under the editor and blocks the save. The button is disabled until you make a change.
Navigating away with unsaved changes triggers a confirmation prompt.
How Rows Run
Each row runs as its own Playwright project. With more than one row, the project is named after the test with the row number, for example Login [1] and Login [2]. With one row or none, the project name is the test name. Results show each project separately, and the arrows on a test result step through them.
Script tests read rows through the same params fixture. Declare it in your spec:
import { test as base, expect } from '@playwright/test';
const test = base.extend<{ params: Record<string, unknown> }>({ params: [{}, { option: true }] });
test('Login', async ({ page, params }) => {
await page.getByTestId('email').fill(String(params['email']));
});You cannot set projects in a test's Playwright config. SmoothDeploy generates them from the rows.
Missing Parameters
When a run starts, SmoothDeploy checks that every row has each parameter your steps read. If a row is missing one, the run does not start and the error names the parameter, the step, and the row.
Referencing Parameters in Steps
Any step field with a reference picker supports parameter tokens. Open the picker, choose a parameter name, and it inserts {{params.key}} into the field.
In the generated Playwright script, {{params.key}} compiles to a lookup on params:
await page.getByTestId('email').fill(params['username']);Using Secrets in Steps
Secrets are not substituted inside parameter values. To use a secret in a step, open the reference picker and select from the Secrets group. This inserts {{secrets.NAME}}, which reads from an environment variable at run time. See Secrets.
Next Steps
Revisions
Create and inspect revisions to track how a test has changed over time. Each revision captures the steps, config, and parameters at a point in time.
Test Variables
Define named starting values for a visual test so steps can read and update them at run time using the {{vars.key}} syntax in any step field.