One of the biggest skills you can learn to improve in your code is by learning how to test it. Adding unit tests to your code with the XCTest
Testing framework will help you improve the quality of your code and will provide a secondary benefit of documenting how your code works. As you move from solo developer projects to multi-member teams, it becomes harder to maintain tests that are written in isolation. Automated testing, added to a continuous integration pipeline on a server, helps to address these pain points in the same way that source repositories help to manage code over larger projects.
In the first part of this chapter, we will cover Xcode Server's capabilities as a continuous integration server and how automated testing can be included to improve your testing workflow. In the second half, we will describe how to use LLDB for debugging your code on Linux.
Using server-based testing has several benefits that could justify the time investment for your team. If you're on the fence about whether going this route works for your team, make sure to consider the following in your evaluations:
A continuous integration workflow is a process that starts with developing locally on a development machine and then checking your code into a repository. Next, you migrate your project to Xcode server for processing. In order for Xcode Server to process your code, you have to provide it with some instructions in the form of bots. On your development box, you create bots with your processing rules that run on Xcode Server. The execution of a bot is called an integration, which can be run manually or according to a schedule. Once an integration finishes, the activity is reported back to your development Mac.
Without bots, you can't do anything useful with Xcode Server. Bots build your code and run your tests, using a supplied Xcode project scheme. A well-crafted bot can control when it runs and how it communicates its activity to you and your team. For instance, you could have the bot run when a new commit has occurred and have it e-mail the integration status (for example, success or failure) to you and/or your development team. You can also add pre and post integration triggers that can execute scripts to communicate with web services or to run additional performance tests based on initial integration outputs.
Once you have created your bots, you can manage and monitor them in Xcode Server. Xcode Server can be configured to push bot statuses to your development Mac, provide a web hook to view activity in a browser or third-party app (for example, Slack/HipChat), or send you an e-mail report. On your development Mac, you can see very detailed reports using the report navigator in Xcode.