官术网_书友最值得收藏!

TDD in Xcode

In 1998, the Swiss company Sen:te developed OCUnit, a testing framework for Objective-C (hence, the OC prefix). OCUnit was a port of SUnit, a testing framework that Kent Beck had written for Smalltalk in 1994.

With Xcode 2.1, Apple added OCUnit to Xcode. One reason for this step was that they used it to develop Core Data at the same time that they developed Tiger, the OS with which Core Data was shipped. Bill Bumgarner, an Apple engineer, wrote this later in a blog post:

"Core Data 1.0 is not perfect, but it is a rock solid product that I'm damned proud of. The quality and performance achieved could not have been done without the use of unit testing. Furthermore, we were able to perform highly disruptive operations to the codebase very late in the development cycle. The end result was a vast increase in performance, a much cleaner codebase, and rock solid release."

Apple realized how valuable unit tests can be when developing complex systems in a changing environment. They wanted third-party developers to benefit from unit tests as well. OCUnit could be (and has been) added to Xcode by hand before version 2.1. But by including it into the IDE, the investment in time that was needed to start unit testing was reduced a lot, and as a result, more people started to write tests.

In 2008, OCUnit was integrated into the iPhone SDK 2.2 to allow unit testing of iPhone apps.

Finally, in 2013, unit testing became a first-class citizen in Xcode 5 with the introduction of XCTest. With XCTest, Apple added specific user interface elements to Xcode that helped with testing, which allowed running specific tests, finding failing tests quickly, and getting an overview of all the tests. We will go over the testing user interface in Xcode later in this chapter. But, first, we will take a look at TDD using Xcode in action.

主站蜘蛛池模板: 五常市| 日喀则市| 马龙县| 包头市| 黄陵县| 盐边县| 枣强县| 武功县| 布拖县| 云安县| 宁城县| 禹州市| 刚察县| 萝北县| 新建县| 崇文区| 井冈山市| 黑山县| 依兰县| 盘山县| 富裕县| 乾安县| 紫阳县| 朝阳市| 沭阳县| 泰兴市| 砀山县| 广德县| 通化县| 阿城市| 郎溪县| 锡林浩特市| 许昌市| 平湖市| 杂多县| 宝丰县| 临泉县| 留坝县| 洞口县| 壶关县| 清水县|