Data-Driven Testing
Data-driven testing in xyva separates test logic from test data. Instead of hardcoding values in your specs, you define Variables and Datasets in the Test Hub and bind them to test runs.
Core Concepts
| Concept | Purpose | Example |
|---|---|---|
| Variable | Single key-value pair injected at runtime | BASE_URL = https://staging.example.com |
| Dataset | Tabular collection of rows, each row is a test iteration | User table with name, email, role columns |
| Run Matrix | Cartesian product of selected tests and dataset rows | 5 tests x 10 user rows = 50 executions |
How It Works
1. Define Variables (env URLs, credentials, flags)
2. Create or import a Dataset (CSV, JSON, or manual entry)
3. Select tests in the Catalog
4. Bind Variables + Dataset to generate a Run Matrix
5. Launch — the Runner iterates through every combinationNo Code Changes Needed
Variables are exposed as process.env entries. Your existing process.env.BASE_URL references work without modification.
Variables vs. Datasets
Variables are scalar — one key, one value per run. Use them for environment configuration:
BASE_URL— target environmentTEST_USER_EMAIL— login credentialsFEATURE_FLAG_DARK_MODE— toggle a feature on/off
Datasets are tabular — multiple rows, each creating a separate test iteration. Use them for input variation:
- Login with 20 different user roles
- Form submission with valid and invalid field combinations
- Search queries across multiple languages
Parameterized Execution
When you bind a Dataset to a test selection, xyva generates a Run Matrix:
Dataset "checkout-users" (3 rows) x 2 selected specs
= 6 total test executions
checkout.spec.ts — row 1 (admin)
checkout.spec.ts — row 2 (guest)
checkout.spec.ts — row 3 (blocked-user)
payment.spec.ts — row 1 (admin)
payment.spec.ts — row 2 (guest)
payment.spec.ts — row 3 (blocked-user)Execution Time
Large matrices multiply execution time. A 50-row dataset bound to 20 specs produces 1,000 runs. Use the Preview Matrix button to review before launching.
Storage
All Variables and Datasets live in .xyva/test-data/ inside your project directory. They are excluded from version control by the default .gitignore entry that xyva creates.
For team sharing, export as JSON and distribute through your preferred channel, or commit the .xyva/test-data/ folder explicitly.
Related Pages
- Variables & Datasets Editor — detailed UI reference
- Test Catalog — selecting tests for data binding
- Runner — executing parameterized runs
