It has thousands of libraries and can help you scale your projects elegantly.” Not yet fully working for Swift: https://github.com/CocoaPods/CocoaPods/issues/2272 https://github.com/CocoaPods/CocoaPods/pull/2222
you need to install gem then… • Download from https://rubygems.org/pages/ download • Requires git version 1.7.5 or newer See http://guides.cocoapods.org/using/getting-started.html#getting-started
Uses AFNetwork (Objective- C) via Cocoapods • pod install • bridging header • build setting • But should use Swift library • https://github.com/Alamofire/ Alamofire
application • Focus on smallest parts of code • Separate to integration tests • How to run tests… • “Product” -> “Test” menu • ⌘U : Run All Tests • ⌃⌥⌘U : Run Current Test Class
test into setUp() • Create new testThemeParagraphAlignment test. It should verify… • Initially… • [“alignment”: “right”] sets the default paragraph style to NSTextAlignment.RightTextAlignment • Continue with other possible values… • “center”: NSTextAlignment.CenterTextAlignment • “justified”: NSTextAlignment.JustifiedTextAlignment • “natural”: NSTextAlignment.NaturalTextAlignment
per XCTextCase • Can’t easily specify pending tests • Tests can only be structured by classes • Tests often need to be augmented with comments (or assertions with strings) to make purpose clear
and afterSuite • Define “examples” using it • Example groups using describe and context • Define group specific setup & teardown using beforeEach and afterEach • Disable Pending examples and groups • Possible to share sets of example for objects using sharedExamples and itBehavesLike
as a git sub-module ! mkdir Vendor git submodule add https://github.com:Quick/Quick.git Vendor/Quick git submodule add https://github.com:Quick/Nimble.git Vendor/Nimble git submodule update --init --recursive • Add Quick.xcodeproj and Nimble.xcodeproj to test target • Link Quick.framework and Nimble.framework • Note, these are already included in the BDDExample project. So use: ! git submodule sync git submodule update --init --recursive
(line 29) • beforeEach and afterEach (lines 64 & 74) • How to read test file from bundle (line 55) • sampleJSON function and how it merges dictionaries (operator overloading) (line 85) • createThemeWithSilentLogging closure (line 16) • “alignment” group which have for loops with inner if (line 127)
which… • Verifies “tailIndent” double value can be read from JSON and is stored in theme.defaultParagraphStyle.tailIndent • Verifies if “tailIndent” has invalid string value in JSON then theme.defaultParagraphStyle.tailIndent defaults to 0.0 • Create “writing direction” group (similar to “"line break mode”) which… • Verifies “writingDirection” string in JSON can map string to theme.defaultParagraphStyle.baseWritingDirection. Possible mappings of JSON string value to NSWritingDirection are: • “natural”: NSWritingDirection.Natural • “leftToRight”: NSWritingDirection.LeftToRight • “rightToLeft”: NSWritingDirection.RightToLeft • Verifies if “writingDirection” has invalid string value or double in the JSON then defaults theme.defaultParagraphStyle.baseWritingDirection to .Natural