Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting started TDD on iOS Apps Development

yashigani
February 15, 2014

Getting started TDD on iOS Apps Development

Cocoa勉強会関西 #54 でTDDについて発表したときのスライドです.

yashigani

February 15, 2014
Tweet

More Decks by yashigani

Other Decks in Programming

Transcript

  1. TDD

  2. BDD

  3. - (void)testHREClient { TRVSMonitor *monitor = TRVSMonitor.monitor; [_client getStations:@"৽॓" completionHandler:^(NSArray

    *res, NSError *e) { XCTAssertNil(e, @":("); XCTAssertNotNil(res, @":("); [monitor signal]; }]; [monitor wait]; ! [_client getStations:@"ైԦொ" completionHandler:^(NSArray *res, NSError *e) { XCTAssertNotNil(e, @":("); XCTAssertNotNil(e.userInfo[@"error"], @":("); XCTAssertNil(res, @":("); [monitor signal]; }]; [monitor wait]; }
  4. it(@“should found stations", ^{! TRVSMonitor *monitor = TRVSMonitor.monitor;! [client getStations:@"৽॓"!

    completionHandler:^(NSArray *res, NSError *e) {! [[e should] beNil];! [[res should] beNonNil];! [monitor signal];! }];! [monitor wait];! });! it(@“should not found stations", ^{! TRVSMonitor *monitor = TRVSMonitor.monitor;! [client getStations:@"ైԦொ"! completionHandler:^(NSArray *res, NSError *e) {! [[e should] beNonNil];! [[e.userInfo[@"error"] should] beNonNil];! [[res should] beNil];! [monitor signal];! }];! [monitor wait];! });
  5. it(@"should found stations", ^AsyncBlock {! [client getStations:@"৽॓"! completionHandler:^(NSArray *res, NSError

    *e) {! expect(e).to.beNil();! expect(res).notTo.beNil();! done();! }];! });! it(@"should not found stations", ^AsyncBlock {! [client getStations:@"ైԦொ"! completionHandler:^(NSArray *res, NSError *e) {! expect(e).notTo.beNil();! expect(e.userInfo[@"error"]).notTo.beNil();! expect(res).to.beNil();! done();! }];! });