2

Introducing the Red-Green-Refactor Workflow

This chapter introduces the Red-Green-Refactor workflow, which is at the heart of Test-Driven Development (TDD). You’ll use it to write a first Svelte component, including a unit-test suite that specifies the behavior of the component.

This workflow benefits you because it provides a structure for implementing software. It makes it less likely that you’ll implement the wrong thing. It also helps you to avoid overcomplicating solutions.

This chapter covers the following topics:

  • Understanding the Red-Green-Refactor workflow
  • Thinking ahead with up-front design
  • Writing a failing test
  • Making it pass
  • Refactoring the tests
  • Adding styles to the component

By the end of the chapter, you’ll have written your ...

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.