For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  1. Open Environment & Data → Environments.

  2. Select New environment and enter a purpose-based name, such as Stage Environment.

  3. Save and open the environment.

  4. On Environment variables, select Add variable.

  5. Create a String variable named baseURL with a non-production URL.

  6. 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

  1. Return to Environment & Data and open Test Data Profiles.

  2. Select New test data profile and enter Login Scenarios.

  3. Assign it to Stage Environment and save.

  4. Open the profile and select Manage columns.

  5. Add these example columns:

    Column
    Type
    Purpose

    username

    String

    Test account name

    password

    Password

    Masked test-only password

    expectedTitle

    String

    Expected page heading after login

  6. Apply the column changes.

  7. On the Stage Environment tab, add one row for each approved scenario. Give each row a clear name such as admin_user or viewer_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

  1. Open the login test case and edit its configuration.

  2. Select Stage Environment as the execution environment.

  3. Enable data-driven execution.

  4. Select Login Scenarios as the test data profile.

  5. Choose the start and end row that should participate in the run.

  6. Save the test case.

If the profile is missing, confirm that it is assigned to the selected environment.

Step 4: Create the profile loop

  1. In the step editor, select the input and verification steps that should repeat for each data row.

  2. Choose Loop, then select Test data profile as the source.

  3. Confirm the environment, profile, and row range.

  4. Select Create steps.

  5. Edit each relevant step and use the Parameter picker to map the correct profile column:

    • Email or username input → username

    • Password input → password

    • Heading verification → expectedTitle

  6. 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

Need
Use

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

Last updated

Was this helpful?