© Khaled El-Morabea and Hassaan El-Garem 2021
K. El-Morabea, H. El-GaremModularizing Legacy Projects Using TDDhttps://doi.org/10.1007/978-1-4842-7428-6_2

2. Unit Tests

Khaled El-Morabea1   and Hassaan El-Garem2
(1)
Giza, Egypt
(2)
Cairo, Egypt
 

As you know by now, TDD is a process in which you write a test first before writing actual code. But before jumping into TDD, you need to understand the basics of testing in iOS. Luckily, every year, Xcode and Swift are becoming more and more powerful when it comes to testing. And the testing framework “XCTest” is also evolving with them.

This chapter covers how to use XCTAssert functions to write functional tests. These are the main components of XCTest. You’ll also learn how to use expectations to test async ...

Get Modularizing Legacy Projects Using TDD: Test-Driven Development with XCTest for iOS 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.