Testing in XCode 5

download Testing in XCode 5

of 149

description

How to use new feature in Xcode 5

Transcript of Testing in XCode 5

  • 5/27/2018 Testing in XCode 5

    1/149

    These are confidential sessionsplease refrain from streaming, blogging, or taking pictures

    Session 409

    Testing in Xcode 5

    Mike SwinglerXcode Engineer

  • 5/27/2018 Testing in XCode 5

    2/149

    Why Test?

  • 5/27/2018 Testing in XCode 5

    3/149

    Why Test?

    Catch crashes

  • 5/27/2018 Testing in XCode 5

    4/149

    Why Test?

    Catch crashes Catch logic errors

  • 5/27/2018 Testing in XCode 5

    5/149

    Why Test?

    Catch crashes Catch logic errors

    Help you write your code

  • 5/27/2018 Testing in XCode 5

    6/149

    Why Test?

    Catch crashes Catch logic errors

    Help you write your code

    Catch regressions

  • 5/27/2018 Testing in XCode 5

    7/149

    Why Test?

    Catch crashes Catch logic errors

    Help you write your code

    Catch regressions

    Cover more configurations

  • 5/27/2018 Testing in XCode 5

    8/149

    Why Test?

    Catch crashes Catch logic errors

    Help you write your code

    Catch regressions

    Cover more configurations

    Cover everyone, all the time

  • 5/27/2018 Testing in XCode 5

    9/149

    Overview

  • 5/27/2018 Testing in XCode 5

    10/149

    Overview

    What is a unit test?

  • 5/27/2018 Testing in XCode 5

    11/149

    Overview

    What is a unit test? Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    12/149

    Overview

    What is a unit test? Introducing XCTest

    Writing, running and debugging tests

  • 5/27/2018 Testing in XCode 5

    13/149

    Overview

    What is a unit test?

    Introducing XCTest

    Writing, running and debugging tests

    Continuous integration

  • 5/27/2018 Testing in XCode 5

    14/149

    Overview

    What is a unit test?

    Introducing XCTest

    Writing, running and debugging tests

    Continuous integration

    Advanced setups

  • 5/27/2018 Testing in XCode 5

    15/149

    Unit Testing

  • 5/27/2018 Testing in XCode 5

    16/149

    Tests ONEthing

    ! Single unit of functionality

    ! Pass/Fail

    ! Small, fast, isolated

    1What Is a Unit Test?

  • 5/27/2018 Testing in XCode 5

    17/149

    Tests ONEthing

    ! Single unit of functionality

    ! Pass/Fail

    ! Small, fast, isolated

    Unit tests dont cover

    ! Performance 1What is a Unit Test?

  • 5/27/2018 Testing in XCode 5

    18/149

    Tests ONEthing

    ! Single unit of functionality

    ! Pass/Fail

    ! Small, fast, isolated

    Unit tests dont cover

    ! Performance

    ! UI interaction 1What is a Unit Test?

  • 5/27/2018 Testing in XCode 5

    19/149

    Tests ONEthing

    ! Single unit of functionality

    ! Pass/Fail

    ! Small, fast, isolated

    Unit tests dont cover

    ! Performance

    ! UI interaction

    ! Whole system integration 1What is a Unit Test?

  • 5/27/2018 Testing in XCode 5

    20/149

    Where to start testing

    Your App

  • 5/27/2018 Testing in XCode 5

    21/149

    Where to start testing

    Your App

    Model

    Controller

    View Server

    Database

  • 5/27/2018 Testing in XCode 5

    22/149

    Where to start testing

    Your App

    Model

  • 5/27/2018 Testing in XCode 5

    23/149

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    24/149

    XCTest.framework

    iOS and OS X

  • 5/27/2018 Testing in XCode 5

    25/149

    XCTest.framework

    iOS and OS X Requires Xcode 5

  • 5/27/2018 Testing in XCode 5

    26/149

    XCTest.framework

    iOS and OS X Requires Xcode 5

    Derived from OCUnit

    ! Modernized

    ! Migration tool

  • 5/27/2018 Testing in XCode 5

    27/149

    XCTest.framework

    iOS and OS X Requires Xcode 5

    Derived from OCUnit

    ! Modernized

    ! Migration tool

    Builds .xctest bundles

  • 5/27/2018 Testing in XCode 5

    28/149

    XCTest.framework

    iOS and OS X Requires Xcode 5

    Derived from OCUnit

    ! Modernized

    ! Migration tool

    Builds .xctest bundles

    Test runner injected in your app

  • 5/27/2018 Testing in XCode 5

    29/149

    XCTest.framework

    iOS and OS X Requires Xcode 5

    Derived from OCUnit

    ! Modernized

    ! Migration tool

    Builds .xctest bundles

    Test runner injected in your app

    Test rig loads libraries and test bundles

  • 5/27/2018 Testing in XCode 5

    30/149

    Test Code

  • 5/27/2018 Testing in XCode 5

    31/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    Test Code

  • 5/27/2018 Testing in XCode 5

    32/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    Test Code

    SubclassXCTestCase XCTest

    d

  • 5/27/2018 Testing in XCode 5

    33/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    - (void) testExample {

    }

    Test Code

    SubclassXCTestCase

    test = method

    T C d

  • 5/27/2018 Testing in XCode 5

    34/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    Test Code

    SubclassXCTestCase

    test = method

    Prefixed test

    test

    T C d

  • 5/27/2018 Testing in XCode 5

    35/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    Test Code

    SubclassXCTestCase

    test = method

    Prefixed test

    No arguments, returns void void

    T t C d

  • 5/27/2018 Testing in XCode 5

    36/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    XCTAssertTrue(2 + 2 == 4)

    Test Code

    SubclassXCTestCase

    test = method

    Prefixed test

    No arguments, returns void

    Makes assertions

    T t C d

  • 5/27/2018 Testing in XCode 5

    37/149

    @interface ExampleTests : XCTest

    @end

    @implementation ExampleTests

    - (void) testExample {

    XCTAssertTrue(2 + 2 == 4);

    }

    @end

    Test Code

    SubclassXCTestCase

    test = method

    Prefixed test

    No arguments, returns void

    Makes assertions

    Built into test target

    T t N i t

  • 5/27/2018 Testing in XCode 5

    38/149

    Test Navigator

    T t N i t

  • 5/27/2018 Testing in XCode 5

    39/149

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    40/149

    Test bundle targets

    !Test classes

    !Test methods

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    41/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    42/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    43/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    44/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    45/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    46/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    47/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    48/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    49/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Filter failures

    Test Navigator

    Test Navigator

  • 5/27/2018 Testing in XCode 5

    50/149

    Test bundle targets

    !Test classes

    !Test methods

    Click to run

    Results inline

    Filter failures

    Test Navigator

    Editor Test Indicators

  • 5/27/2018 Testing in XCode 5

    51/149

    Editor Test Indicators

    Editor Test Indicators

  • 5/27/2018 Testing in XCode 5

    52/149

    Editor Test Indicators

    Editor Test Indicators

  • 5/27/2018 Testing in XCode 5

    53/149

    Editor Test Indicators

    Editor Test Indicators

  • 5/27/2018 Testing in XCode 5

    54/149

  • 5/27/2018 Testing in XCode 5

    55/149

    Demo

    Making your first unit test in Xcode 5

    Mike SwinglerXcode Engineer

    Overview

  • 5/27/2018 Testing in XCode 5

    56/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Overview

  • 5/27/2018 Testing in XCode 5

    57/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Overview

  • 5/27/2018 Testing in XCode 5

    58/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Overview

  • 5/27/2018 Testing in XCode 5

    59/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Overview

  • 5/27/2018 Testing in XCode 5

    60/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Overview

  • 5/27/2018 Testing in XCode 5

    61/149

    Creating a test target is easy

    Add a new test by adding a method

    Easy to run tests

    !Test navigator

    ! Editor

    Making your first unit test in Xcode 5

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    62/149

    XCTestAssertions.h

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    63/149

    XCTestAssertions.h

    XCTFail

    XCTAssertNil

    XCTAssertNotNil

    XCTAssertTrue

    XCTAssertTrueNoThrow

    XCTAssertFalse

    XCTAssertFalseNoThrow

    XCTAssertEqualObjects

    XCTAssertEquals

    XCTAssertEqualsWithAccura

    XCTAssertThrows

    XCTAssertThrowsSpecific

    XCTAssertThrowsSpecificNamed

    XCTAssertNoThrow

    XCTAssertNoThrowSpecific

    XCTAssertNoThrowSpecificNamed

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    64/149

    XCTestAssertions.h

    XCTAssertNotNil

    XCTAssertTrue

    XCTAssertFalse

    XCTAssertEqualObjects

    XCTAssertThrows

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    65/149

    XCTestAssertions.h

    XCTAssertNot

    XCTAssertTrue

    XCTAssertFalse

    XCTAssertEqualObjects

    XCTAssertThrows

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    66/149

    XCTestAssertions.h

    XCTAssertNotNil

    XCTAssertTrueXCTAssertFalse

    XCTAssertEqualObjects

    XCTAssertThrows

    h

    Assert the Expected

  • 5/27/2018 Testing in XCode 5

    67/149

    XCTestAssertions.h

    XCTAssertNotNil

    XCTAssertTrue

    XCTAssertFalse

    XCTAssertEqualObjects

    XCTAssertThrows

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    68/149

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    69/149

    Expected success

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    70/149

    Expected success

    ! Can come first

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    71/149

    Expected success

    ! Can come first

    Regressions

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    72/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    73/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    ! Overflow,!, NaN

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    74/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    ! Overflow,!, NaN

    ! Nil

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    75/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    ! Overflow,!, NaN

    ! Nil! Empty collections

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    76/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    ! Overflow,!, NaN

    ! Nil! Empty collections

    ! Unexpected types in collections

    Expect the Unexpected

  • 5/27/2018 Testing in XCode 5

    77/149

    Expected success

    ! Can come first

    Regressions

    Expected failure

    ! Overflow,!, NaN

    ! Nil! Empty collections

    ! Unexpected types in collections

    ! NSError

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    78/149

    -setUp

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    79/149

    setUp

    Runs before every test method

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    80/149

    setUp

    Runs before every test method

    Create shim objects

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    81/149

    setUp

    Runs before every test method

    Create shim objects

    Load data from .xctest bundle

    ! [NSBundle bundleForClass:[MyTestClass class]]

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    82/149

    setUp

    Runs before every test method

    Create shim objects

    Load data from .xctest bundle

    ! [NSBundle bundleForClass:[MyTestClass class]]

    anything you need to setup the world

    -setUp

    Set Up a Test

  • 5/27/2018 Testing in XCode 5

    83/149

    setUp

    Runs before every test method

    Create shim objects

    Load data from .xctest bundle

    ! [NSBundle bundleForClass:[MyTestClass class]]

    anything you need to setup the world

    Use -tearDownto perform any cleanup

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    84/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    85/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    XCTestCase

    - (void) test

    - (void) test

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    86/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    87/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    88/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    89/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    90/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    91/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    92/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    93/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    Test class and methods

    How XCTest Works

  • 5/27/2018 Testing in XCode 5

    94/149

    @interface ExampleTests : XCTestCase

    @implementation ExampleTests

    + (void) setUp { /* Class set-up. */}

    + (void) tearDown { /* Class tear-down. */}

    - (void) setUp { /* Test set-up. */}

    - (void) tearDown { /* Test tear-down. */}

    - (void) testExamplePassing {

    XCTAssertTrue(YES);

    }

    - (void) testExampleFailing {

    XCTAssertTrue(NO);

    }

    OCUnit

  • 5/27/2018 Testing in XCode 5

    95/149

    OCUnit

  • 5/27/2018 Testing in XCode 5

    96/149

    Co-exists with XCTest

    OCUnit

  • 5/27/2018 Testing in XCode 5

    97/149

    Co-exists with XCTest

    You may still need it! iOS 6

    OCUnit

  • 5/27/2018 Testing in XCode 5

    98/149

    Co-exists with XCTest

    You may still need it! iOS 6

    Migration tool available

    OCUnit

  • 5/27/2018 Testing in XCode 5

    99/149

    Co-exists with XCTest

    You may still need it! iOS 6

    Migration tool available

    OCUnit

  • 5/27/2018 Testing in XCode 5

    100/149

    Co-exists with XCTest

    You may still need it! iOS 6

    Migration tool available

    OCUnit

  • 5/27/2018 Testing in XCode 5

    101/149

    Co-exists with XCTest

    You may still need it! iOS 6

    Migration tool available

  • 5/27/2018 Testing in XCode 5

    102/149

    Debugging Tests

  • 5/27/2018 Testing in XCode 5

    103/149

    Demo

    Debugging tests

    Bino GeorgeXcode Engineer

    New test debugging UI

    Overview

  • 5/27/2018 Testing in XCode 5

    104/149

    Test breakpoint

    New test debugging UI

    Overview

  • 5/27/2018 Testing in XCode 5

    105/149

    Test breakpoint

    New test debugging UI

    Overview

  • 5/27/2018 Testing in XCode 5

    106/149

    Test breakpoint

    Test assistant categories

    New test debugging UI

    b k

    Overview

  • 5/27/2018 Testing in XCode 5

    107/149

    Test breakpoint

    Test assistant categories

    New test debugging UI

    Overview

    T b k i

  • 5/27/2018 Testing in XCode 5

    108/149

    Test breakpoint

    Test assistant categoriesTest Again command

    New test debugging UI

    Overview

    T t b k i t

  • 5/27/2018 Testing in XCode 5

    109/149

    Test breakpoint

    Test assistant categoriesTest Again command

    New test debugging UI

    Overview

    T t b k i t

  • 5/27/2018 Testing in XCode 5

    110/149

    Test breakpoint

    Test assistant categoriesTest Again command

    New test debugging UI

    Overview

    Test breakpoint

  • 5/27/2018 Testing in XCode 5

    111/149

    Test breakpoint

    Test assistant categoriesTest Again command

  • 5/27/2018 Testing in XCode 5

    112/149

    Continuous Integration and Testing

    Testing Using OS X Server

  • 5/27/2018 Testing in XCode 5

    113/149

    Testing Using OS X Server

    Xcode service Bots perform integrations

  • 5/27/2018 Testing in XCode 5

    114/149

    Xcode service Bots perform integrations

    !

    Every time your commit code! On the hour

    Testing Using OS X Server

    Xcode service bots perform integrations

  • 5/27/2018 Testing in XCode 5

    115/149

    Xcode service bots perform integrations

    !

    Every time your commit code! On the hour

    Create a Scheme

    ! Bots run shared schemes

    Testing Using OS X Server

    Xcode service bots perform integrations

  • 5/27/2018 Testing in XCode 5

    116/149

    SHARED

    Xcode service bots perform integrations

    !

    Every time your commit code! On the hour

    Create a Scheme

    ! Bots run shared schemes

    Testing Using OS X Server

    Xcode service bots perform integrations

  • 5/27/2018 Testing in XCode 5

    117/149

    Xcode service bots perform integrations

    !

    Every time your commit code! On the hour

    Create a Scheme

    ! Bots run shared schemes

    Brings results to you

    Many Configurations

  • 5/27/2018 Testing in XCode 5

    118/149

    iOS devices

    Many Configurations

  • 5/27/2018 Testing in XCode 5

    119/149

    iOS devices

    iOS devices

    Many Configurations

  • 5/27/2018 Testing in XCode 5

    120/149

    iOS simulator

    iOS devices

    Many Configurations

  • 5/27/2018 Testing in XCode 5

    121/149

    iOS simulator Different OS versions

    iOS devices

    Many Configurations

  • 5/27/2018 Testing in XCode 5

    122/149

    iOS simulator Different OS versions

    OS X

  • 5/27/2018 Testing in XCode 5

    123/149

    Demo

    Continuous integration with OS X Server

    Continuous integration with OS X ServerOverview

  • 5/27/2018 Testing in XCode 5

    124/149

    Continuous integration with OS X ServerOverview

    Setup shared schemes for bot

  • 5/27/2018 Testing in XCode 5

    125/149

    Continuous integration with OS X ServerOverview

    Setup shared schemes for bot

  • 5/27/2018 Testing in XCode 5

    126/149

    Covers multiple configurations! Devices, OS versions, simulators

    Continuous integration with OS X ServerOverview

    Setup shared schemes for bot

  • 5/27/2018 Testing in XCode 5

    127/149

    Covers multiple configurations! Devices, OS versions, simulators

    Bot and test results summary

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    128/149

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    129/149

    > xcodebuild test

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    130/149

    > xcodebuild test

    -scheme MyLibrary

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    131/149

    > xcodebuild test

    -scheme MyLibrary

    -destination 'platform=OS X,arch=x86_64'

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    132/149

    > xcodebuild test

    -scheme MyLibrary

    -destination 'platform=OS X,arch=x86_64'

    -destination 'platform=iOS,name=My Development iPod Touch

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    133/149

    '

    > xcodebuild test

    -scheme MyLibrary

    -destination 'platform=OS X,arch=x86_64'

    -destination 'platform=iOS,name=My Development iPod Touch-destination 'platform=iOS Simulator,name=iPhone

    Command-line Testing

  • 5/27/2018 Testing in XCode 5

    134/149

    > xcodebuild test

    -scheme MyLibrary

    -destination 'platform=OS X,arch=x86_64'

    -destination 'platform=iOS,name=My Development iPod Touch-destination 'platform=iOS Simulator,name=iPhone,OS=6.1'

    Wrap Up

  • 5/27/2018 Testing in XCode 5

    135/149

    Wrap Up

    What is a unit test?

  • 5/27/2018 Testing in XCode 5

    136/149

    Wrap Up

    What is a unit test?

    I t d i XCT t

  • 5/27/2018 Testing in XCode 5

    137/149

    Introducing XCTest

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    138/149

    Introducing XCTest

    Writing, running and debugging tests

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    139/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    140/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    141/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    !Test failure breakpoint

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    142/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    !Test failure breakpoint

    ! Assistant categories

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    143/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    !Test failure breakpoint

    ! Assistant categories

    !Test Again command

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    144/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    !Test failure breakpoint

    ! Assistant categories

    !Test Again command

    Continuous integration, advanced setups

    Wrap Up

    What is a unit test?

    Introducing XCTest

  • 5/27/2018 Testing in XCode 5

    145/149

    Introducing XCTest

    Writing, running and debugging tests

    !Test Navigator

    ! Editor indicators

    !Test failure breakpoint

    ! Assistant categories!Test Again command

    Continuous integration, advanced setups

    Testing helps you write better, high quality apps

    More Information

    Dave DeLongDeveloper Tools Evangelistdelong@apple com

    mailto:[email protected]:[email protected]
  • 5/27/2018 Testing in XCode 5

    146/149

    [email protected]

    Xcode Documentationhttp://developer.apple.com/

    Apple Developer Forumshttp://devforums.apple.com

    Related Sessions

    Continuous Integration with Xcode 5 PresidioTuesday 3:15PM

    mailto:[email protected]://developer.apple.com/uehttp://devforums.apple.com/http://devforums.apple.com/http://devforums.apple.com/http://developer.apple.com/uehttp://developer.apple.com/uemailto:[email protected]:[email protected]
  • 5/27/2018 Testing in XCode 5

    147/149

    Related Labs

    Tools Lab

    Xcode and Continuous Integration Lab Tools Lab AThursday 9:00AM

  • 5/27/2018 Testing in XCode 5

    148/149

    Tools LabTools LabOngoing

  • 5/27/2018 Testing in XCode 5

    149/149