can cause a key piece of your app to break, test it. » When testing core data, test the NSInMemoryStoreType so you always have a clean database. » Version your databases!
Thing { override func methodBeingStubbed() -> String { //Don't call super! return "A Known String!" } } let stub = StubbedThing() let tested = ObjectUnderTest() objectUnderTest.thing = stubbed let result = tested.doSomethingThatEventuallyCallsMethodBeingStubbed() XCTAssertTrue(result == "A Known String!") }
Test the end result, not necessarily how you got there. » Use the XCTest methods you already know. » Use comments if you need the structure of given/ when/then.
» Uses Accessibility, so you make your app accessible in the bargain » Get to the bit you need to test » The most widely used library » Very backwards compatible
delegate for tests, make sure you put it back for UI tests » Centralize your localized strings in a convenience class to make strings easier to test » UI and non-UI tests should be separate targets » Add -AppleLanguages "\(en\)" arguments to the test bit of your application's scheme » Duplicate your scheme and update for every language you support
Testing helps you find out immediately when you broke something so it's easier to fix. » Test as much as you can, however much that is. » Find the testing ideology that works best for you. » UI Testing can give you a great opportunity to see how all the pieces of your app work together. » Have both humans and robots test your app.
» Robot by Logan Ingalls: https://www.flickr.com/ photos/plutor/847695350 » Lock ("Hodgepodged") by David Goehring https:// www.flickr.com/photos/carbonnyc/4740626368/ » All images of Kif from Futurama used without permission. Sorry, Fox.