Chapter 8

Testing and Test-Driven Development

Although rarely covered in introductory programming tutorials, automated testing is one of the most important subjects in modern software development. Accordingly, this chapter includes an introduction to testing in Ruby, including a first look at test-driven development, or TDD.

Test-driven development came up briefly in Section 6.3.3, which promised that we would use testing techniques to add an important capability to finding palindromes, namely, being able to detect complicated palindromes such as “A man, a plan, a canal—Panama!” (Figure 6.7) or “Madam, I’m Adam.” (Figure 8.1).1 This chapter fulfills that promise.

1“The Temptation of Adam” by Tintoretto. Image courtesy of Album/Alamy Stock Photo. ...

Get Learn Enough Ruby to Be Dangerous: Write Programs, Publish Gems, and Develop Sinatra Web Apps with Ruby 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.