Examine Console Output
To experiment with test life cycles, we need a way to go beyond test results. We’ll need to examine detailed test logs, the information the tests write to the console output. Let’s go over how to see these logs.
Add a second test, test_methodTwo, that invokes methodTwo:
| func test_methodTwo() { |
| let sut = MyClass() |
| |
| sut.methodTwo() |
| |
| // Normally, assert something |
| } |
With two tests in our suite, press ⌘-U to run tests. Then let’s go find the log so we can read the nitty-gritty details of this test run.
You can see the console output of the latest run by going to the Xcode menu and selecting View ▶ Debug Area ▶ Activate Console. But we can do one better. ...
Get iOS Unit Testing by Example 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.