Objective: The pattern “same check, different data” — and how a spreadsheet becomes tests with YOUR IDs on them.
⏱ ≈4 min full lesson · Converted from the B-10 module deck · English edition — Español · العربية · বাংলা in translation
In ~4 minutes: the pattern “same check, different data” — and how a spreadsheet becomes tests with YOUR IDs on them.
Separate steps from inputs: Beginners copy-paste a test and change a word. Professionals notice the shape: the STEPS are identical; only the INPUTS differ. Split them: one template, a table of rows, the template runs once per row.
The pattern inside one test: Data-driven at its smallest scale, inside TC-002: the list is data, the loop body is the template. New page on the site → add one string → coverage grows. Code: const hrefs = ["/", "/privacy.html", "/terms.html"]; | for (const href of hrefs) { | expect(domPaths).toContain(href); | // …request the target, expect status < 400… | }
The pattern at suite scale: Give TestGen a sheet (ID, Page, Check — from Excel, Sheets, Jira, Trello) and it generates one test per row, titled with YOUR ID. TC-S001 came from the sheet — not from TestGen. Code: test("[TC-S001] Welcome heading is visible", async ({ page }) => { | await page.goto("/"); | await expect(page.getByText("Welcome heading is visible").first()).toBeVisible(); | });
Where rows can live: Data can live in the framework, a sheet, a database, or a test-management tool (Xray/Qmetry). TestGen treats these as MODULES the customer turns on. The template doesn't care which source feeds it rows — template thinks, data varies.
Plug & chug: template + table: Take a check you do by hand with 3 different inputs (3 search terms, 3 usernames). Write the template as ONE sentence and the inputs as a table. You just designed a data-driven test — it's a spreadsheet away from running.
Rows understood. Next: API testing — talking to the machine directly.