Chapter 18: Working with Testing and Integration

Unit testing is a powerful software engineering technique that’s supported in Xcode. This chapter outlines the technique so you can understand the theory behind unit testing, and it explains how to use unit testing in practice.

Introducing Unit Testing

You can test software in many ways, and software engineering has evolved formal processes that can simplify design and improve project efficiency.

Software can fail in five ways:

  • The conceptual model for the user interface is misleading, incorrect, or inconsistent. If typical users make wrong assumptions about the software, the developer has made wrong assumptions about how users think and how they expect the software to work. Failures at this level may not be critical, but they frustrate users and waste their time.
  • The UI is fragile. Common and inevitable user errors—such as whitespace in text, null entries, misspellings or invalid characters, or accidental mouse clicks—cause the application to fail.
  • The UI or underlying model isn’t secure. Deliberate hacking attempts can open an application’s internal features to outsiders in an uncontrolled way.
  • The underlying logic is flawed. Code may contain incorrect assumptions about interfaces, contracts, and processing requirements.
  • The underlying logic is fragile. Memory or file errors, API inconsistencies and bugs, threading ...

Get Xcode 5 Developer Reference 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.