SlideShare a Scribd company logo
An introduction
  to unit testing
      for iOS
   applications
STEWART GLEADOW
    @stewgleadow
      Thoughtwor
Unit
Testing
Unit
 Testing
OCUnit
Unit
 Testing
OCUnit
 Kiwi
Unit
 Testing
OCUnit
 Kiwi
 Comma
 nd Line
Have we
     been here
      before?

http://sgleadow.github.com/
       talks.html#frank
http://sgleadow.github.com/
     talks.html#agileios
UI


                     Integration


                          Unit
http://sgleadow.github.com/
     talks.html#agileios
UI


                     Integration


   OCUnit GHUnit GTM
                          Unit
http://sgleadow.github.com/
     talks.html#agileios
UI


                      Integration

       Kiwi   Cedar

   OCUnit GHUnit GTM
                          Unit
http://sgleadow.github.com/
     talks.html#agileios
Why test in units?
We only care if the
whole app works.
Write your tests first.
 Use tests to design
      your code
Write your tests first.
 Use tests to design
        your code
   “Classes typically resist the
    transition from one user to
    two, then the rest are easy”
                          - Kent
            Beck, c2.wiki
Fast feedback
Red


Green     Refact
but we’re making
    iOS apps
THE TOOLS AREN’T
 GOOD ENOUGH
THE TOOLS AREN’T
 GOOD ENOUGH
  there are too many
 frameworks to fit here
NO ONE PAYS YOU TO
    WRITE TESTS
NO ONE PAYS YOU TO
    WRITE TESTS
  they pay you to write
   software that works
SHOULD YOU ALWAYS
 TEST EVERYTHING ?
SHOULD YOU ALWAYS
 TEST EVERYTHING ?
  “it depends”, says the
       consultant
Fibonacci,
  really?
Apple
  design
award here
 we come
Getting
Started
Getting
                                Started
                             or, if you’ve
                             already started...
http://sgleadow.github.com/blog/2011/10/30/adding-unit-
tests-to-an-existing-ios-project
OCUnit
OCUnit

Application     Logic
#import <SenTestingKit/SenTestingKit.h>
@interface FibCounterTests : SenTestCase
@end
- (void)testExample {
    STFail(@"epic fail");
}
- (void)setUp {

}

- (void)tearDown {

}
Controller
  Tests
- (void)test_the_fibonacci_number_is_zero_after_reset {




}
- (void)test_the_fibonacci_number_is_zero_after_reset {
    ourCounter = [[UILabel alloc] init];




}
- (void)test_the_fibonacci_number_is_zero_after_reset {
    ourCounter = [[UILabel alloc] init];

    controller = [[SGViewController alloc]
                            initWithNibName:nil
                                     bundle:nil];




}
- (void)test_the_fibonacci_number_is_zero_after_reset {
    ourCounter = [[UILabel alloc] init];

    controller = [[SGViewController alloc]
                            initWithNibName:nil
                                     bundle:nil];

    controller.counter = ourCounter;




}
- (void)test_the_fibonacci_number_is_zero_after_reset {
    ourCounter = [[UILabel alloc] init];

    controller = [[SGViewController alloc]
                            initWithNibName:nil
                                     bundle:nil];

    controller.counter = ourCounter;

    [controller resetCounter];




}
- (void)test_the_fibonacci_number_is_zero_after_reset {
    ourCounter = [[UILabel alloc] init];

    controller = [[SGViewController alloc]
                            initWithNibName:nil
                                     bundle:nil];

    controller.counter = ourCounter;

    [controller resetCounter];

    STAssertEqualObjects(ourCounter.text,
                         @"0",
                         nil);

}
- (void)test_the_fibonacci_number_is_zero_after_reset {

    ourCounter = [[UILabel alloc] init];

    controller = [[SGViewController alloc]
                            initWithNibName:nil
                                     bundle:nil];

    controller.counter = ourCounter;

    [controller resetCounter];

    STAssertEqualObjects(ourCounter.text,
                         @"0",
                         nil);

}
'(null)' should be equal
           to '0'
WRITE THE
SIMPLEST CODE TO
  MAKE THE TEST
      PASS
WRITE THE
   SIMPLEST CODE TO
     MAKE THE TEST
         PASS

- (void)resetCounter {
   self.counter.text = @"0";
}
WRITE THE
   SIMPLEST CODE TO
     MAKE THE TEST
         PASS

- (void)resetCounter {
   self.counter.text = [NSString
stringWithFormat:@"%u", current];
}
TEST DRIVE OUR
  FIBONACCI
  ALGORITHM
TEST DRIVE OUR
      FIBONACCI
     ALGORITHM 21
0, 1, 1, 2, 3, 5, 8, 13,
TEST DRIVE OUR
         FIBONACCI
        ALGORITHM 21
   0, 1, 1, 2, 3, 5, 8, 13,
test_the_first_fibonacci_num
ber_is_zero

test_the_seond_fibonacci_nu
mber_is_one

test_the_third_fibonacci_nu
mber_is_one
TEST DRIVE OUR
         FIBONACCI
        ALGORITHM 21
   0, 1, 1, 2, 3, 5, 8, 13,
test_the_first_fibonacci_num
ber_is_zero
                             -
test_the_seond_fibonacci_nu
mber_is_one

test_the_third_fibonacci_nu
mber_is_one
TEST DRIVE OUR
         FIBONACCI
        ALGORITHM 21
   0, 1, 1, 2, 3, 5, 8, 13,
test_the_first_fibonacci_num
ber_is_zero
                                -
test_the_seond_fibonacci_nu [controller
mber_is_one                next];

test_the_third_fibonacci_nu
mber_is_one
TEST DRIVE OUR
         FIBONACCI
        ALGORITHM 21
   0, 1, 1, 2, 3, 5, 8, 13,
test_the_first_fibonacci_num
ber_is_zero
                                -
test_the_seond_fibonacci_nu [controller
mber_is_one                next];
                           [controller
test_the_third_fibonacci_nu next];
                           [controller
mber_is_one                next];
'0' should be equal to '1'
DO THE
SIMPLEST
THING TO
 MAKE IT
KEEP BUILDING YOUR
 TESTS UNTIL YOU
 HAVE THE ENTIRE
MAKE IT AWESOME
MAKE IT AWESOME
 (aka - there is a step 3)
MAKE IT AWESOME
 (aka - there is a step 3)
(defun fib (n)
  (if (< n 2)
    n
    (+ (fib (- n 1)) (fib (- n 2)))))




   MAKE IT AWESOME
        (aka - there is a step 3)
SGViewController


- (void)next;
- (void)resetCounter;
SGViewController


- (void)next;
- (void)resetCounter;




                                Fibber

                        - (NSUInteger)current;
                        - (NSUInteger)next;
                        - (NSUInteger)reset;
UIButton
 SGViewController


- (void)next;                         UILabel
- (void)resetCounter;




                                Fibber

                        - (NSUInteger)current;
                        - (NSUInteger)next;
                        - (NSUInteger)reset;
More
Controller
  Tests
It is possible to
      test your
UIViewController
lifecycle and XIB
from your “unit”
        tests
controller.
         view
* check for non-nil outlets *
[button actionsForTarget:controll

forControlEvent:UIControlEventTo
chUpInside] for correct action
      * check
           selectors *
[controller
didReceiveMemoryWarning]
    * check for nil outlets *
WHAT ABOUT KIWI?
RSpec Style vs xUnit
       Style
SPEC_BEGIN(SGViewControllerSpec
)




SPEC_END
SPEC_BEGIN(SGViewControllerSpec
)
   describe(@"fibonacci number", ^{

         context(@"when reset", ^{




         });
   });

SPEC_END
SPEC_BEGIN(SGViewControllerSpec
)
   describe(@"fibonacci number", ^{

         context(@"when reset", ^{
               beforeEach(^{ // set up code });

            it(@"should be zero", ^{
              [controller resetCounter];
              [[[ourCounter text] should]
          equal:@"0"];
            });
         });
   });

SPEC_END
Is it just a change of
       wording?
Kiwi comes
  with mocks
and stubs built
       in
UIButton
 SGViewController


- (void)next;                         UILabel
- (void)resetCounter;




                                Fibber

                        - (NSUInteger)current;
                        - (NSUInteger)next;
                        - (NSUInteger)reset;
TESTS ARE
EFFECTIVELY
TESTING THE
 PLUMBING
TESTS ARE
       EFFECTIVELY
       TESTING THE
          PLUMBING
it(@"should update label using fibber", ^{
   id ourFibber = [Fibber mock];
   [[ourFibber should] receive:@selector(next)
andReturn:theValue(3)];

      controller.fibber = ourFibber;

      [controller next];

      [[[ourCounter text] should] equal:@"3"];
});
WHAT ABOUT
RUNNING TESTS
  FROM THE
COMMAND LINE
xcodebuild is your
     friend...
xcodebuild is your
     friend...
   until it unfriends you
xcodebuild
   -project
FibCounter.xcodeproj
   -target
FibCounterTests
   -configuration
Debug
   -sdk
iphonesimulator
and hack this file:
  "${SYSTEM_DEVELOPER_DIR}/Tools/
RunUnitTests"
and hack this file:
   "${SYSTEM_DEVELOPER_DIR}/Tools/
 RunUnitTests"




http://longweekendmobile.com/
2011/04/17/xcode4-running-application-
tests-from-the-command-line-in-ios/
Resources
Resources
iDeveloper TV Unit Testing
Course (Graham Lee)
   http://ideveloper.tv/video/
   unittestingcourse.html
Resources
iDeveloper TV Unit Testing
Course (Graham Lee)
   http://ideveloper.tv/video/
   unittestingcourse.html
TDD for iOS Tutorials (Doug
Sjoquist)
   http://www.sunetos.com/items/
   2011/10/24/tdd-ios-part-1
Resources
iDeveloper TV Unit Testing
Course (Graham Lee)
   http://ideveloper.tv/video/
   unittestingcourse.html
TDD for iOS Tutorials (Doug
Sjoquist)
   http://www.sunetos.com/items/
   2011/10/24/tdd-ios-part-1

Prag Prog Magazine
   http://pragprog.com/magazines/2010-07/
   tdd-on-iphone-diy
Resources
iDeveloper TV Unit Testing
Course (Graham Lee)
   http://ideveloper.tv/video/
   unittestingcourse.html
TDD for iOS Tutorials (Doug
Sjoquist)
   http://www.sunetos.com/items/
   2011/10/24/tdd-ios-part-1

Prag Prog Magazine
   http://pragprog.com/magazines/2010-07/
   tdd-on-iphone-diy

Shameless Shameless Plug
   http://sgleadow.github.com
THANKS
STEWART
          GLEADOW
       Thoughtworks


           sgleadow.github.c
 Talks:
           om/talks
Twitter:
           @stewgleadow
 Email:
           sgleadow@though
iOS Unit Testing
iOS Unit Testing

More Related Content

What's hot

Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmine
Gil Fink
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using Jasmine
Gil Fink
 
Tdd & unit test
Tdd & unit testTdd & unit test
Tdd & unit test
GomathiNayagam S
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
Jim Lynch
 
Testing React Applications
Testing React ApplicationsTesting React Applications
Testing React Applications
stbaechler
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
ICS
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
Lars Thorup
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & Jasmine
Anup Singh
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
Humberto Marchezi
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
Harry Potter
 
Automated testing in Python and beyond
Automated testing in Python and beyondAutomated testing in Python and beyond
Automated testing in Python and beyond
dn
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG
Greg.Helton
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
Arvind Vyas
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It's
Jim Lynch
 
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
Nick Belhomme
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karma
Adam Klein
 
Unit Testing RPG with JUnit
Unit Testing RPG with JUnitUnit Testing RPG with JUnit
Unit Testing RPG with JUnitGreg.Helton
 
Embrace Unit Testing
Embrace Unit TestingEmbrace Unit Testing
Embrace Unit Testing
alessiopace
 

What's hot (19)

Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmine
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using Jasmine
 
Tdd & unit test
Tdd & unit testTdd & unit test
Tdd & unit test
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 
Testing React Applications
Testing React ApplicationsTesting React Applications
Testing React Applications
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & Jasmine
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
 
Automated testing in Python and beyond
Automated testing in Python and beyondAutomated testing in Python and beyond
Automated testing in Python and beyond
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It's
 
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karma
 
Unit Testing RPG with JUnit
Unit Testing RPG with JUnitUnit Testing RPG with JUnit
Unit Testing RPG with JUnit
 
Embrace Unit Testing
Embrace Unit TestingEmbrace Unit Testing
Embrace Unit Testing
 

Viewers also liked

Mobile: more than just an app
Mobile: more than just an appMobile: more than just an app
Mobile: more than just an app
sgleadow
 
Frank iOS Testing
Frank iOS TestingFrank iOS Testing
Frank iOS Testing
sgleadow
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPTsuhasreddy1
 
iOS Testing
iOS TestingiOS Testing
iOS Testing
Sunil Sharma
 
Automated Xcode 7 UI Testing
Automated Xcode 7 UI TestingAutomated Xcode 7 UI Testing
Automated Xcode 7 UI Testing
Jouni Miettunen
 
Building mobile teams and getting a product to market
Building mobile teams and getting a product to marketBuilding mobile teams and getting a product to market
Building mobile teams and getting a product to market
sgleadow
 
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Jesse Collis
 
iOS Unit Testing Like a Boss
iOS Unit Testing Like a BossiOS Unit Testing Like a Boss
iOS Unit Testing Like a Boss
Salesforce Developers
 
Agile iOS
Agile iOSAgile iOS
Agile iOS
sgleadow
 
iOS Application Testing
iOS Application TestingiOS Application Testing
iOS Application Testing
Mreetyunjaya Daas
 

Viewers also liked (12)

Mobile: more than just an app
Mobile: more than just an appMobile: more than just an app
Mobile: more than just an app
 
Frank iOS Testing
Frank iOS TestingFrank iOS Testing
Frank iOS Testing
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
iOS Testing
iOS TestingiOS Testing
iOS Testing
 
iOS Testing
iOS TestingiOS Testing
iOS Testing
 
Automated Xcode 7 UI Testing
Automated Xcode 7 UI TestingAutomated Xcode 7 UI Testing
Automated Xcode 7 UI Testing
 
Building mobile teams and getting a product to market
Building mobile teams and getting a product to marketBuilding mobile teams and getting a product to market
Building mobile teams and getting a product to market
 
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
 
iOS Unit Testing Like a Boss
iOS Unit Testing Like a BossiOS Unit Testing Like a Boss
iOS Unit Testing Like a Boss
 
Agile iOS
Agile iOSAgile iOS
Agile iOS
 
iOS Application Testing
iOS Application TestingiOS Application Testing
iOS Application Testing
 
Ios operating system
Ios operating systemIos operating system
Ios operating system
 

Similar to iOS Unit Testing

Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockRobot Media
 
Tdd iPhone For Dummies
Tdd iPhone For DummiesTdd iPhone For Dummies
Tdd iPhone For Dummies
Giordano Scalzo
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting stared
Liyao Chen
 
Unit Testing: Special Cases
Unit Testing: Special CasesUnit Testing: Special Cases
Unit Testing: Special Cases
Ciklum Ukraine
 
Re-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large reportRe-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large report
PVS-Studio
 
Test driven development
Test driven developmentTest driven development
Test driven development
christoforosnalmpantis
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
John Wilker
 
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio
 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for free
BenotCaron
 
Python and Ruby implementations compared by the error density
Python and Ruby implementations compared by the error densityPython and Ruby implementations compared by the error density
Python and Ruby implementations compared by the error density
PVS-Studio
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon Galicia
Robot Media
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
Fwdays
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
PVS-Studio
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
Dror Helper
 
Intro to ReactiveCocoa
Intro to ReactiveCocoaIntro to ReactiveCocoa
Intro to ReactiveCocoa
kleneau
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-Studio
Andrey Karpov
 
2011 py con
2011 py con2011 py con
2011 py conEing Ong
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
Sameh El-Ashry
 
How to Vim - for beginners
How to Vim - for beginnersHow to Vim - for beginners
How to Vim - for beginners
Marcin Rogacki
 

Similar to iOS Unit Testing (20)

Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
Tdd iPhone For Dummies
Tdd iPhone For DummiesTdd iPhone For Dummies
Tdd iPhone For Dummies
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting stared
 
Unit Testing: Special Cases
Unit Testing: Special CasesUnit Testing: Special Cases
Unit Testing: Special Cases
 
Re-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large reportRe-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large report
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...
 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for free
 
Python and Ruby implementations compared by the error density
Python and Ruby implementations compared by the error densityPython and Ruby implementations compared by the error density
Python and Ruby implementations compared by the error density
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon Galicia
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
 
Intro to ReactiveCocoa
Intro to ReactiveCocoaIntro to ReactiveCocoa
Intro to ReactiveCocoa
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-Studio
 
2011 py con
2011 py con2011 py con
2011 py con
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
 
How to Vim - for beginners
How to Vim - for beginnersHow to Vim - for beginners
How to Vim - for beginners
 

More from sgleadow

Evolving Mobile Architectures @ Mi9
Evolving Mobile Architectures @ Mi9Evolving Mobile Architectures @ Mi9
Evolving Mobile Architectures @ Mi9
sgleadow
 
Evolving for Multiple Screens
Evolving for Multiple ScreensEvolving for Multiple Screens
Evolving for Multiple Screens
sgleadow
 
Evolving Mobile Architectures
Evolving Mobile ArchitecturesEvolving Mobile Architectures
Evolving Mobile Architectures
sgleadow
 
iOS app case study
iOS app case studyiOS app case study
iOS app case study
sgleadow
 
iOS View Coordinators
iOS View CoordinatorsiOS View Coordinators
iOS View Coordinators
sgleadow
 
Multithreaded Data Transport
Multithreaded Data TransportMultithreaded Data Transport
Multithreaded Data Transport
sgleadow
 
A few design patterns
A few design patternsA few design patterns
A few design patterns
sgleadow
 
GPU Programming
GPU ProgrammingGPU Programming
GPU Programming
sgleadow
 
Cocoa Design Patterns
Cocoa Design PatternsCocoa Design Patterns
Cocoa Design Patterns
sgleadow
 
Beginning iPhone Development
Beginning iPhone DevelopmentBeginning iPhone Development
Beginning iPhone Development
sgleadow
 

More from sgleadow (10)

Evolving Mobile Architectures @ Mi9
Evolving Mobile Architectures @ Mi9Evolving Mobile Architectures @ Mi9
Evolving Mobile Architectures @ Mi9
 
Evolving for Multiple Screens
Evolving for Multiple ScreensEvolving for Multiple Screens
Evolving for Multiple Screens
 
Evolving Mobile Architectures
Evolving Mobile ArchitecturesEvolving Mobile Architectures
Evolving Mobile Architectures
 
iOS app case study
iOS app case studyiOS app case study
iOS app case study
 
iOS View Coordinators
iOS View CoordinatorsiOS View Coordinators
iOS View Coordinators
 
Multithreaded Data Transport
Multithreaded Data TransportMultithreaded Data Transport
Multithreaded Data Transport
 
A few design patterns
A few design patternsA few design patterns
A few design patterns
 
GPU Programming
GPU ProgrammingGPU Programming
GPU Programming
 
Cocoa Design Patterns
Cocoa Design PatternsCocoa Design Patterns
Cocoa Design Patterns
 
Beginning iPhone Development
Beginning iPhone DevelopmentBeginning iPhone Development
Beginning iPhone Development
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 

iOS Unit Testing

Editor's Notes

  1. \n
  2. - what is unit testing\n- introduction to ocunit in general\n
  3. - what is unit testing\n- introduction to ocunit in general\n
  4. - what is unit testing\n- introduction to ocunit in general\n
  5. - what is unit testing\n- introduction to ocunit in general\n
  6. - Frank talk at the first cocoaheads of the year in February\n- thanks to Oliver for editing and uploading video\n
  7. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  8. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  9. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  10. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  11. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  12. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  13. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  14. - balance your tests (Kevin doesn&amp;#x2019;t like this picture)\n- the unit tests are the work horse of your test suite\n- unit = translation unit in compiler speak\n- unit tests don&amp;#x2019;t talk to network, disk, database, Interface Builder\n(the unit testing tools can also be used to write tests for these things,\nbut let&amp;#x2019;s not call them unit tests)\n- xUnit v RSpec style tests\n
  15. - this is partly true, but it&amp;#x2019;s hard to effectively test the whole app\n- need to look at the cost of testing\n-&gt; time to write a test, time to fix a bug when it breaks\n-&gt; want small, focused tests (understand 10 lines of code to fix the bug)\n- unit test boundary conditions / error cases (eg server rubbish)\n- can test things that are unlikely to come up in normal usage but are possible\n
  16. - fallacy of unit testing is that it&amp;#x2019;s just about asserting behaviour or preventing bugs\n-&gt; bigger benefit is about the design of your code\n- need to write your tests first to leverage this\n- want code with low coupling and high cohesion (that makes it easy to test)\n- doesn&amp;#x2019;t magically make you write good code, but bad code is hard to test\n- want reusable code (code fights being reused a second time)\n- keeps you from writing unnecessary code\n
  17. - entire unit test suite should take seconds to run\n- if you can&amp;#x2019;t hold your breath while your test suite runs, don&amp;#x2019;t hold your breath that anyone will run it\n- specific errors, right after they occur\n- in context\n
  18. - see them fail first: it is possible to have bugs in your tests\n- get them passing, only what&amp;#x2019;s needed\n- clean up after yourself while the tests are green (leverage tests)\n- a codebase not only well tested, but well maintained\n(easy to make changes - tests are there to help you)\n- refactor to make it easy to read\n- refactor your tests... but keep them easy to read (bit of duplication is ok)\n- he thought he was being pragmatic, you think he&amp;#x2019;s an idiot\n
  19. \n
  20. - true in the past, but not anymore\n- definitely not for unit testing frameworks\n- TDD/CI have been hard but getting better\n- how complicated is a testing framework anyway?\n\n
  21. - true in the past, but not anymore\n- definitely not for unit testing frameworks\n- TDD/CI have been hard but getting better\n- how complicated is a testing framework anyway?\n\n
  22. - true in the past, but not anymore\n- definitely not for unit testing frameworks\n- TDD/CI have been hard but getting better\n- how complicated is a testing framework anyway?\n\n
  23. - that&amp;#x2019;s US dollars\n- I don&amp;#x2019;t have time to write tests\n- 90% of the life of a piece of code is later, more up front = less later\n- if your tests aren&amp;#x2019;t helping you write better software faster, change something\n- tests are easier to write than the main code, but they also make your real code easier\n- confidence to change things: once you&amp;#x2019;re comfortable with working in this way, I find it quicker than not writing tests\n
  24. - that&amp;#x2019;s US dollars\n- I don&amp;#x2019;t have time to write tests\n- 90% of the life of a piece of code is later, more up front = less later\n- if your tests aren&amp;#x2019;t helping you write better software faster, change something\n- tests are easier to write than the main code, but they also make your real code easier\n- confidence to change things: once you&amp;#x2019;re comfortable with working in this way, I find it quicker than not writing tests\n
  25. - that&amp;#x2019;s US dollars\n- I don&amp;#x2019;t have time to write tests\n- 90% of the life of a piece of code is later, more up front = less later\n- if your tests aren&amp;#x2019;t helping you write better software faster, change something\n- tests are easier to write than the main code, but they also make your real code easier\n- confidence to change things: once you&amp;#x2019;re comfortable with working in this way, I find it quicker than not writing tests\n
  26. - testing is ultimately about pragmatism\n- plenty of good programmers don&amp;#x2019;t TDD, I&amp;#x2019;m not dogmatic about it\n- test the most important bits: separation of concerns is important\n- test parts with the most logic / more prone to change more (not less)\n* Models? Yes. Controllers? Probably. IB plumbing? Maybe. Views? Unlikely.\n- can even test position of views and memory, but what does that get you?\n- I want to show you the basics of some things you _can_ test, and how you can test them. It&amp;#x2019;s up to you\n
  27. - testing is ultimately about pragmatism\n- plenty of good programmers don&amp;#x2019;t TDD, I&amp;#x2019;m not dogmatic about it\n- test the most important bits: separation of concerns is important\n- test parts with the most logic / more prone to change more (not less)\n* Models? Yes. Controllers? Probably. IB plumbing? Maybe. Views? Unlikely.\n- can even test position of views and memory, but what does that get you?\n- I want to show you the basics of some things you _can_ test, and how you can test them. It&amp;#x2019;s up to you\n
  28. - testing is ultimately about pragmatism\n- plenty of good programmers don&amp;#x2019;t TDD, I&amp;#x2019;m not dogmatic about it\n- test the most important bits: separation of concerns is important\n- test parts with the most logic / more prone to change more (not less)\n* Models? Yes. Controllers? Probably. IB plumbing? Maybe. Views? Unlikely.\n- can even test position of views and memory, but what does that get you?\n- I want to show you the basics of some things you _can_ test, and how you can test them. It&amp;#x2019;s up to you\n
  29. - I know what you&amp;#x2019;re thinking (boring, or reminds you of project estimation)\n- simple enough that none of us really have to think about how it works\n- algorithmically complex enough that we might screw it up\n(and it takes more than one test to drive a full implementation)\n
  30. - I know what you&amp;#x2019;re thinking (boring, or reminds you of project estimation)\n- simple enough that none of us really have to think about how it works\n- algorithmically complex enough that we might screw it up\n(and it takes more than one test to drive a full implementation)\n
  31. - I know what you&amp;#x2019;re thinking (boring, or reminds you of project estimation)\n- simple enough that none of us really have to think about how it works\n- algorithmically complex enough that we might screw it up\n(and it takes more than one test to drive a full implementation)\n
  32. - not going to do a live coding demo\n(but hopefully appears on github and my blog soon)\n- create a new &amp;#x201C;Single View Application&amp;#x201D;, style up the NIB\n- design skills?\n(this is why I&amp;#x2019;ve been asking questions about Interface Builder)\n\n
  33. - not going to do a live coding demo\n(but hopefully appears on github and my blog soon)\n- create a new &amp;#x201C;Single View Application&amp;#x201D;, style up the NIB\n- design skills?\n(this is why I&amp;#x2019;ve been asking questions about Interface Builder)\n\n
  34. - not going to do a live coding demo\n(but hopefully appears on github and my blog soon)\n- create a new &amp;#x201C;Single View Application&amp;#x201D;, style up the NIB\n- design skills?\n(this is why I&amp;#x2019;ve been asking questions about Interface Builder)\n\n
  35. - comes with unit tests by default\n- OCUnit is as easy as a check box, but other tools are easy too\n- used to be called SenTest or SenTestingKit, came bundled since Xcode 2\n- sets up applications tests / logic tests -&gt; why?\n- application tests run in the context of your app (UI environment), can run on device)\n- Run with Cmd U -&gt; shortcuts talk\n- but the example test fails\n
  36. - comes with unit tests by default\n- OCUnit is as easy as a check box, but other tools are easy too\n- used to be called SenTest or SenTestingKit, came bundled since Xcode 2\n- sets up applications tests / logic tests -&gt; why?\n- application tests run in the context of your app (UI environment), can run on device)\n- Run with Cmd U -&gt; shortcuts talk\n- but the example test fails\n
  37. - comes with unit tests by default\n- OCUnit is as easy as a check box, but other tools are easy too\n- used to be called SenTest or SenTestingKit, came bundled since Xcode 2\n- sets up applications tests / logic tests -&gt; why?\n- application tests run in the context of your app (UI environment), can run on device)\n- Run with Cmd U -&gt; shortcuts talk\n- but the example test fails\n
  38. - comes with unit tests by default\n- OCUnit is as easy as a check box, but other tools are easy too\n- used to be called SenTest or SenTestingKit, came bundled since Xcode 2\n- sets up applications tests / logic tests -&gt; why?\n- application tests run in the context of your app (UI environment), can run on device)\n- Run with Cmd U -&gt; shortcuts talk\n- but the example test fails\n
  39. - fail\n- imagine this is a build light\n- or one of those evil build bunnies\n\n
  40. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  41. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  42. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  43. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  44. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  45. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  46. - let&amp;#x2019;s have a look at the example test file\n- SenTest is OCUnit, didn&amp;#x2019;t both to rename everything (like NSObject from NextStep)\n- subclass SenTestCase (like JUnit 3 days)\n- test methods return void and take no arguments, dynamically detected\n- extract code into common setUp/tearDown\n- remember to add these classes to the test bundle only\n
  47. Controller Tests\n- 2 types: logic and IB plumbing\n- shouldn&amp;#x2019;t be much logic anyway, but start here and extract as needed\n(for simple apps, maybe it&amp;#x2019;s ok, but we&amp;#x2019;ve all seen almost entire apps implemented in a couple of UIViewControllers)\n- can test IB plumbing if you really want (much longer than dragging connections, but if people don&amp;#x2019;t look at their commits, can easily screw up and have pretty large effects)\n- large effect, should notice quickly, wont be a subtle bug\n
  48. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  49. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  50. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  51. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  52. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  53. - let&amp;#x2019;s look at some example tests\n- long descriptive name, not camel case\n-- dual purpose (what&amp;#x2019;s being done, should happen)\n- set up without the NIB, independent of IB (our environment)\n(talk about tests that do use the NIB later)\n- feed in our own label for testing against (could use mock/fake, but can use real)\n- call method and assert outcome\n\n
  54. - have a look at the code as a whole\n-&gt; everything fails, doesn&amp;#x2019;t even compile (a test doesn&amp;#x2019;t have to fail to run)\n-&gt; sometimes quicker to write interface/empty implementation first\n(get autocompletion)\n-&gt; add label property and reset action (IBOutlet/IBAction or do this later)\n- should be enough to build and run\n- press Cmd U again and run your tests\n
  55. - that&amp;#x2019;s fine, we haven&amp;#x2019;t written the implementation yet\n- important to see your tests fail first, so you know they work\n
  56. - that&amp;#x2019;s pretty simple\n- always a judgment call how simple is too simple\n- could introduce an ivar, convert to string\n(we know we&amp;#x2019;ll need to set that current variable back to zero at some stage)\n
  57. - that&amp;#x2019;s pretty simple\n- always a judgment call how simple is too simple\n- could introduce an ivar, convert to string\n(we know we&amp;#x2019;ll need to set that current variable back to zero at some stage)\n
  58. - that&amp;#x2019;s pretty simple\n- always a judgment call how simple is too simple\n- could introduce an ivar, convert to string\n(we know we&amp;#x2019;ll need to set that current variable back to zero at some stage)\n
  59. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  60. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  61. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  62. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  63. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  64. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  65. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  66. - don&amp;#x2019;t need more than that - if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n
  67. - again, expect the test to fail\n- test failures are not always a bad thing\n
  68. - brown madza\n- simplest thing for now, we&amp;#x2019;ll come back later\n
  69. - don&amp;#x2019;t need more than that if you&amp;#x2019;re estimating\n- usually write one test at a time\n- if pair programming, ping pong between them\n-&gt; tests are easy, move all the set up code to set up\njust call next 0, 1 or 2 times\n- next method won&amp;#x2019;t exist, go and create it, empty implementation\n- eventually, the algorithm will be complete no matter how far you count\n
  70. - once your tests are passing, always look to improve your code\n- step 3: refactor\n- you&amp;#x2019;ll never do it later, do it now...\n(don&amp;#x2019;t take on technical debt)\n- probably not as awesome as an old english sports car\n
  71. - once your tests are passing, always look to improve your code\n- step 3: refactor\n- you&amp;#x2019;ll never do it later, do it now...\n(don&amp;#x2019;t take on technical debt)\n- probably not as awesome as an old english sports car\n
  72. - once your tests are passing, always look to improve your code\n- step 3: refactor\n- you&amp;#x2019;ll never do it later, do it now...\n(don&amp;#x2019;t take on technical debt)\n- probably not as awesome as an old english sports car\n
  73. - once your tests are passing, always look to improve your code\n- step 3: refactor\n- you&amp;#x2019;ll never do it later, do it now...\n(don&amp;#x2019;t take on technical debt)\n- probably not as awesome as an old english sports car\n
  74. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  75. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  76. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  77. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  78. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  79. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  80. controller has two main methods, but don&amp;#x2019;t really want all the algorithm code there\n- controllers get too busy, so separate out those details into a model\n- controller is left just plumbing things together, dealing with lifecycle\n- most iOS apps have almost the entire app written in UIViewController classes\n
  81. - Interface Builder plumbing\n
  82. - Interface Builder plumbing\n
  83. - they&amp;#x2019;re written in Kiwi or OCUnit, but let&amp;#x2019;s not call them unit tests\n- it&amp;#x2019;s an interesting testing problem to try\n-&gt; how good is it in practice?\n (everyone says no, but no one has tried it... the only team I know that tried it thinks they were the most valuable tests in the suite)\n- for an individual developer, or a team who actually reads git diffs before committing?\n
  84. - let&amp;#x2019;s take a look at a few potential Interface Builder and NIB test\n- might want to check that you&amp;#x2019;ve set all your outlets correctly\n
  85. - let&amp;#x2019;s take a look at a few potential Interface Builder and NIB test\n- might want to check that you&amp;#x2019;ve set all your outlets correctly\n
  86. - might want to check your actions are correct\n
  87. - might want to check your actions are correct\n
  88. - check that your view gets cleaned up on low memory conditions\n- this one is potentially valuable\n- something we often forget, or get wrong but don&amp;#x2019;t often manually test\n-&gt; could use screenshot based testing before and after as well\n
  89. - check that your view gets cleaned up on low memory conditions\n- this one is potentially valuable\n- something we often forget, or get wrong but don&amp;#x2019;t often manually test\n-&gt; could use screenshot based testing before and after as well\n
  90. - didn&amp;#x2019;t get a really good chance to look at it yet\n- it&amp;#x2019;s a wrapper around OCUnit, so it runs within Xcode\n- heavily uses macros and blocks to make your tests nicer\n- only been out a few months, but actively worked on\n
  91. - series of nested blocks to describe behaviour in certain context\n(in some ways it&amp;#x2019;s a bunch of different works for a similar function)\n- installation: static library, or cocoapods... vendor?\n
  92. - series of nested blocks to describe behaviour in certain context\n- reads a lot more like plain English (but with ObjC syntax noise)\n\n
  93. - series of nested blocks to describe behaviour in certain context\n- reads a lot more like plain English (but with ObjC syntax noise)\n\n
  94. - series of nested blocks to describe behaviour in certain context\n- reads a lot more like plain English (but with ObjC syntax noise)\n\n
  95. - in some ways it&amp;#x2019;s a bunch of different works for a similar function\n-&gt; but these small changes actually change the way you think about your tests\n- Spec, not Test. &amp;#x201C;it should&amp;#x201D;, not &amp;#x201C;testThat&amp;#x201D;\n-&gt; start describing the behaviour of your code, not testing the functionality\n- promotes test-first thinking\n
  96. - Kiwi comes with its own mocking/stubbing capability\n(nicer syntax than OCMock, haven&amp;#x2019;t looked at LRMocky)\n
  97. - look at our refactored code\n- controller is just passing messages between views and models\n
  98. \n
  99. - command line tooling is always an afterthought with Apple tools\n(surprising, given the Unix history)\n- need command line for running in CI without human intervention\n
  100. xcodebuild -project FibCounter.xcodeproj -target FibCounterTests -configuration Debug -sdk iphonesimulator build\n
  101. - xcode build specifies workspaces and schemes as well\n- workspaces and schemes seem worthwhile\n- the build step will run your unit \n
  102. \n
  103. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  104. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  105. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  106. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  107. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  108. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  109. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  110. - training course is $70 or so, really worth while\n- Doug Sjoquist - idevblogaday, part 2 is out, more coming\n- Prag Prog had a few articles over the last year or two\n
  111. \n
  112. \n
  113. \n
  114. \n