????swift??iOS??????????????????????swift????iOS??δ??????objc?л???swift??????????????????????objc???????????????????2??3????????????objc?????swift???????????????
????????????????????????swift???????????????????????????????????????target??????????????????????????target????????????????У??????????????????swift??hooray??????
?????????????д??????????Щ????????????????????????????д?????????о???????????????????????????Щ???:
????· ?????????????
????· ??????????????????????????bug?????????????bug??
????· ????????????????????д?????????
????· ???????????????????????????????????????á?
????????????????????????????????????AFNetworking??swift?汾??Alamofire??д?????????????

???????????????????firefox-ios?????д?Щ???????

?????????????е??????????????????????????????
????????????е????????
????TDD
????TDD(Test Drive Development)??????????????????????????????????д?????????????????д?????????TDD??????????д?????????????д???????????
????TDD????????red??green??refactor????衣????????д????????????δ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????TDD???????е?????????????????????ü??д??????????????????????????????????????????д???????????????
????BDD
????BDD(Behavior Drive Development)???????????????????????????????????????????Given...When...Then??????????????????????д????????磬Alamofire???????????
func testDownloadClassMethodWithMethodURLHeadersAndDestination() {
// Given
let URLString = "https://httpbin.org/"
let destination = Request.suggestedDownloadDestination(directory: searchPathDirectory?? domain: searchPathDomain)
// When
let request = Alamofire.download(.GET?? URLString?? headers: ["Authorization": "123456"]?? destination: destination)
// Then
XCTAssertNotNil(request.request?? "request should not be nil")
XCTAssertEqual(request.request?.HTTPMethod ?? ""?? "GET"?? "request HTTP method should be GET")
XCTAssertEqual(request.request?.URLString ?? ""?? URLString?? "request URL string should be equal")
let authorizationHeader = request.request?.valueForHTTPHeaderField("Authorization") ?? ""
XCTAssertEqual(authorizationHeader?? "123456"?? "Authorization header is incorrect")
XCTAssertNil(request.response?? "response should be nil")
}
????Mock
????Mock????????????????£?????????????????????????????????????????磬viewDidLoad()???Щ????????????
????objc????????OCMock??mock?????????????swift??runtime????????????swift?????????дmock??
????Stub
??????????????Э???????????????黹????????????????????????飬?????????Stub?????磬??????δ?????????????????????Stub????α????????????????
????ojbc????????OHHTTPStubs??α???????????????swift?£???????дstub??
???????Quick+Nimble???BDD
??????????Quick
????????Alamofire???????У??????????????XCTest???????????????д????????????????Assert?????滹?д?????????
??????Quick??д??????????????

????????????BDD??????????Nimble???expect??????????????д????????????????????????????
?????????????????BDD???????swiftд?????????????????????objc????swift????
???????????к???????????????????BDD?????XCTest????????????XCTest??????????????????????????????
???????Cocoapods?????
????????????Quick??Nimble?????????Cocoapods???й??????Podfile????????′???
????use_frameworks!
????def testing_pods
????pod 'Quick'?? '~> 0.9.0'
????pod 'Nimble'?? '3.0.0'
????end
????target 'MyTests' do
????testing_pods
????end
?????: swift????Podfile?У???????? use_frameworks!???????Cocoapods??????????£???????е???????????Frameworks????????????????????????????????.a???????????????????????С?
????Quick???
????Quick????ú??????????????????????????????????????????????£?
????describe("a dolphin") {
????describe("its click") {
????context("when the dolphin is near something interesting") {
????it("is emitted three times") {
????// expect...
????}
????}
????}
????}
?????????????group?????????beforeEach??afterEach????????setup??teardown????????????????????е????????