XCODE: Set up TDD environment with xcode’s 3 Hidden Features.

KD Knowledge Diet
2 min readMar 24, 2022

--

Everyone knows how important test-driven development is as the years of development increase. To become an advanced developer, you must do TDD. There are hidden features for TDD in xcode that people don’t know about. I would like to introduce them.

[1] Enable Code Coverage

(1) Click Edit Scheme

Click Edit Scheme

(2) Tab on Test

Tab on Test

(3) Activate “Gather coverage for”

Gather coverage for

(4) Run Test

Run Test

(5) Check your test coverage

Test Coverage

50% of the code was tested. The higher the coverage, the better the tested app.

[2] Enable Unit Test Breakpoint

Enable Test Failure Breakpoint

If you enable this Test failure Breakpoint option, whenever your test code fails, it automatically stops at the breakpoint.

Breakpoint

[3] Check code coverage file by file

Enable Code Coverage File by File

If you enable Code Coverage, after you run a test, the file indicates whether the code was covered for test or not.

Red Block means code is not covered for the test.

This is really handy when developing your app with TDD!

Conclusion

  1. Enable Code Coverage on your scheme
  2. Enable Unit Test Breakpoint
  3. Enable Code Coverage for each file

If you do that, Your productivity will increase tenfold or more.

Please, leave a comment if the article was helpful !

--

--

KD Knowledge Diet
KD Knowledge Diet

Written by KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!

Responses (1)