Data-Driven Testing
// Definition
Running the same test logic against many input/output combinations, typically loaded from a CSV, JSON file, or database. Separates test data from test code so you can scale coverage without duplicating logic.
// Code Example
const cases = [
{ input: 'user@example.com', valid: true },
{ input: 'no-at.com', valid: false },
{ input: '', valid: false },
];
cases.forEach(({ input, valid }) => {
it(`validates "${input}" → ${valid}`, () => {
cy.visit('/signup');
cy.get('[data-testid=email]').type(input || ' ');
cy.get('[data-testid=submit]').click();
cy.get('[data-testid=email-error]').should(
valid ? 'not.exist' : 'be.visible',
);
});
});// Related terms
Test Case
A single, executable specification: preconditions, steps, expected result, and pass/fail criteria for one verification.
Test Suite
A collection of related test cases organised for execution together — usually grouped by feature, layer (unit, integration, e2e), or test type (smoke, regression).
Equivalence Partitioning
Dividing the input space into groups where the system should behave identically, then testing one representative value per group. Reduces redundant test cases dramatically without losing coverage.
Learn more · TestNG
Chapter 3 · Lesson 1: @DataProvider Basics