13

Adding Cucumber Tests

Up until now, you have seen two types of automated tests: Vitest unit tests and Playwright end-to-end tests. This chapter adds a third type of test: Cucumber (https://cucumber.io).

Just like Playwright, Cucumber has its own test runner, which is typically set up to drive your application in the same way as Playwright does. The difference is that Cucumber tests are not written in JavaScript code.

Cucumber tests are contained within feature files that contain tests formatted in a special syntax known as Gherkin. These tests, known as features and organized into scenarios, read like plain English. That has a couple of advantages.

First, they can be written and understood by the whole team, not just developers. That means ...

Get Svelte with Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.