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

[self shouldTest:@"iOS"]

[self shouldTest:@"iOS"]

From Codemash 2014!

Amber Conville

January 09, 2014
Tweet

More Decks by Amber Conville

Other Decks in Programming

Transcript

  1. –Michael Feathers “Code without tests is bad code. It doesn’t

    matter how well written it is; it doesn’t matter how pretty or object-oriented or well- encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.”
  2. don’t • do it all at once, all the way,

    100% • do it just to do it • not cheat to make progress
  3. why kiwi? describe(@“Your Face”, ^{
 
 it(@“your face is amazing”,

    ^{
 Face *yourFace = [[Face alloc] init];
 [yourFace should] equal:@“amazing”];
 };
 
 context(@“You are happy”, ^{
 
 it(@“is smiling”, ^{
 Face *yourFace = [[Face alloc] init];
 [yourFace setMood:@“Happy”];
 [yourFace.expression should] equal:@“smiling”];
 });
 });
 };
  4. helpful kiwi anatomy describe
 context
 it
 beforeEach
 nullMock
 should receive:


    theValue()
 stub:
 stub:andReturn:
 stub:withBlock:
 captureArgument:atIndex:
  5. this is taking forever do small changes, if you realize

    you've been doing it for a long time, revert and start with a smaller chunk
  6. i have no idea what it is doing characterization tests

    like whut.
 
 to the contrived example!
  7. this method is huge extract method where logical to test

    that, with an eye towards future collaborator
  8. great, i cheated a lot, f u once you have

    a good suite of tests, you can stop cheating! extract your collaborators out with their tests. SRP, dawg!