Under the Bridge

Xcode 6: Usable Testing

If you’d overlooked the improvements to testing in Xcode 6, understandably enough what with the new language and all, they’re definitely worth taking a look at:

XCTest​Case / XCTest​Expectation / measure​Block()

New in Xcode 6 is the ability to benchmark the performance of code

Perhaps the most exciting feature added in Xcode 6 is built-in support for asynchronous testing…

Xcode 6 seems to have fulfilled all of the needs of a modern test-driven developer. Well, perhaps save for one: mocking … However, this may not actually be necessary in Swift, due to its less-constrained syntax.

In Swift, classes can be declared within the definition of a function, allowing for mock objects to be extremely self-contained. Just declare a mock inner-class, override and necessary methods:

With Xcode 6, we’ve finally arrived: the built-in testing tools are now good enough to use on their own.

Which means we can hopefully look forward to Xcode 6 hosted CI services that can run a decent test suite easily. No more messing with Jenkins or whatever, w00t! Here’s a list of the various CI services we’ve noted here and there compatible with iOS/OS X projects so far:

Travis CI is free for open source, paid for private

Hosted CI is an iOS and OS X focused service, with free open source and cheap indie plans

Ship.io used to be called cisimple, and whilst being rebranded it’s totally free

Greenhouse CI is fresh out of beta: they support Android as well, and have a free 2-app plan

Cloudbees has virtualized OS X environments for continuous integration with Jenkins.

Continuous Integration With Xcode Server

(And also check out previous discussions of testing.)

UPDATES:

Unit Testing in Swift; How to write unit tests in Swift with XCTest; Write your first Unit Test in Swift; Test Driven Development in Swift

iOS8 Day-by-Day :: Day 6 :: Profiling Unit Tests

iOS8 Day-by-Day :: Day 11 :: Asynchronous Testing; Asynchronous Testing With Xcode 6; Xcode 6.0.1 Asynchronous Tests

objc.io #15: Testing

Snapshots: Xcode Plugin And Library For Easier User Interface Testing Using Snapshots

Andrew Bancroft’s Swift Unit Testing Resources, and his own:

Natasha the Robot:

Unit Testing ViewControllers In Swift With IOS 8 And Xcode 6

AssertEqualOptional inspired by Extending XCTestCase – Testing Swift Optionals

An Overview of Calabash iOS; Introduction to Calabash; Automated UI Testing with Cucumber and Calabash; Calabash IOS Tutorial [Laxma Reddy]; Calabash iOS Tutorial [@natashatherobot]; Testing Vim iOS Mobile App with Cucumber & Calabash; How to run a ruby calabash-cucumber test on a real iOS device; Calabash-ing iOS [Swift] applications; Hello Calabash Swift iOS; How to Get Started with Calabash [and TestDroid]

Sleipnir: BDD-style testing in Swift with Sleipnir “…highly inspired by Cedar.“

Quick: “The Swift (and Objective-C) testing framework … Inspired by RSpec, Specta, and Ginkgo.”; Testing in Swift [with Quick]

Fox: “the property-based testing tool for Objective-C” [like Haskell QuickCheck]

XCTest: The Good Parts

The state of iOS testing in 2015

XcodeCoverage: “Code coverage for Xcode projects.”

We’ve Got You Covered: “One of Xcode 7’s new features is in-line display of code coverage metrics.”

0