Tutorial: Data-Driven Testing
Build one login test that repeats across selected rows in an environment-linked test data profile, without duplicating test cases.
Who is this for? Testers and SDETs who want one ContextQA test to cover several approved data rows without copying the workflow.
Data-driven testing separates the workflow from its input values. The test case contains the actions; a test data profile contains reusable columns and environment-specific rows. ContextQA repeats the selected steps across the row range you choose.
Business use case: Validate the same registration flow for several user records in staging, then reuse the shared profile structure with different values in another environment.
Prerequisites
A test case containing the input and verification steps you want to repeat.
An environment for the target application.
Safe, fictional or approved non-production data.
Permission to edit environment data and the test case.
Step 1: Create the environment
Open Environment & Data → Environments.
Select New environment and enter a purpose-based name, such as
Stage Environment.Save and open the environment.
On Environment variables, select Add variable.
Create a String variable named
baseURLwith a non-production URL.Save the variable.
Use the test editor's data picker to insert this value. ContextQA displays it as *|baseURL|*.
Step 2: Create the test data profile
Return to Environment & Data and open Test Data Profiles.
Select New test data profile and enter
Login Scenarios.Assign it to Stage Environment and save.
Open the profile and select Manage columns.
Add these example columns:
ColumnTypePurposeusernameString
Test account name
passwordPassword
Masked test-only password
expectedTitleString
Expected page heading after login
Apply the column changes.
On the Stage Environment tab, add one row for each approved scenario. Give each row a clear name such as
admin_userorviewer_user.
The column structure can be shared with other assigned environments, while each environment keeps its own row values.
Step 3: Bind the profile to the test case
Open the login test case and edit its configuration.
Select Stage Environment as the execution environment.
Enable data-driven execution.
Select Login Scenarios as the test data profile.
Choose the start and end row that should participate in the run.
Save the test case.
If the profile is missing, confirm that it is assigned to the selected environment.
Step 4: Create the profile loop
In the step editor, select the input and verification steps that should repeat for each data row.
Choose Loop, then select Test data profile as the source.
Confirm the environment, profile, and row range.
Select Create steps.
Edit each relevant step and use the Parameter picker to map the correct profile column:
Email or username input →
usernamePassword input →
passwordHeading verification →
expectedTitle
Save the steps and review their order before running.
Use the picker instead of typing variable syntax manually. This prevents spelling, case, and source-selection mistakes.
Step 5: Run and review
Run the test directly for a focused check, or include it in a suite and plan when you need scheduling, notifications, or a device/browser matrix.
For each selected row, confirm:
The expected row supplied the input values.
Password values remain masked in the interface and evidence.
The repeated steps ran in the intended order.
The expected title or business outcome was verified.
A failing row can be identified without exposing its secret values.
When to use each data type
One intermediate value used only by this test
Local variable
One approved value shared by many tests
Global data
A value that changes between staging and production
Environment variable
Several related input rows that repeat one workflow
Test data profile
Related pages
Last updated
Was this helpful?
