© Gio Lodi 2021
G. LodiTest-Driven Development in Swifthttps://doi.org/10.1007/978-1-4842-7002-8_1

1. Why Test-Driven Development?

Gio Lodi1  
(1)
Mount Martha, VIC, Australia
 

What Is a Test?

The Oxford English Dictionary defines the noun test as: “a procedure intended to establish the quality, performance, or reliability of something, especially before it is taken into widespread use.”

In the context of software development, we can adapt the definition to: “a procedure intended to establish the software quality, performance, or reliability, especially before it is shipped to the users.”

To test our software essentially means to run it and verify it behaves as desired.

Take this “Hello, world!” script, for example:
#!/usr/bin/env xcrun swift
func main

Get Test-Driven Development in Swift: Compile Better Code with XCTest and TDD 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.