Testing behaviors

To write some code, I have an Xcode tab called Coding. Usually, in this tab, the test is open on the left-hand side, and in the Assistant Editor, which is on the right-hand side; there is the code to be tested (or in the case of TDD, the code to be written). It looks like the following:

When the test starts, we want to see the code editor again. So, we add a behavior to show the Coding tab. In addition to this, we want to see the Test Navigator and debugger with the console view.

When the test succeeds, Xcode should show a bezel to notify us that all tests have passed. Navigate to the Testing | Succeeds stage and check the Notify using bezel or system notification setting. In addition to this, it should hide the navigator and the debugger, because we want to concentrate on refactoring or writing the next test.

In case the testing fails (which happens a lot in TDD), Xcode should show a bezel again. I like to hide the debugger, because usually, it is not the best place to figure out what is going on in the case of a failing test. In most of the cases in TDD, we already know what the problem is.

You can even make your Mac speak the announcements. Check Speak announcements using and select the voice you like, but be careful not to annoy your coworkers. You might need their help in the future.

Now, the project and Xcode are set up, and we can start our TDD journey.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.147.20