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

Testing and Continuous Integration in iOS

Testing and Continuous Integration in iOS

Tiago Martinho

July 04, 2017
Tweet

More Decks by Tiago Martinho

Other Decks in Technology

Transcript

  1. Agenda (Testing) • Motivation • Unit Testing • TDD in

    iOS • Clean Architecture • UI Testing • Alternatives Frameworks • Other Types of Testing 2
  2. 6 Structure of a Unit Test func testArraySorting() { let

    input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) } https://developer.apple.com/videos/play/wwdc2017/414/
  3. 7 Structure of a Unit Test func testArraySorting() { let

    input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) } input https://developer.apple.com/videos/play/wwdc2017/414/
  4. 8 Structure of a Unit Test func testArraySorting() { let

    input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) } Array.sorted input https://developer.apple.com/videos/play/wwdc2017/414/
  5. 9 Structure of a Unit Test func testArraySorting() { let

    input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) } Array.sorted input output https://developer.apple.com/videos/play/wwdc2017/414/
  6. 11 Structure of a Unit Test Prepare input Array.sorted input

    output https://developer.apple.com/videos/play/wwdc2017/414/
  7. 12 Structure of a Unit Test Prepare input Run the

    code being tested Array.sorted input output https://developer.apple.com/videos/play/wwdc2017/414/
  8. 13 Structure of a Unit Test Prepare input Run the

    code being tested Verify output Array.sorted input output https://developer.apple.com/videos/play/wwdc2017/414/
  9. XCTest • Xcode’s testing framework • Create and run unit

    tests, performance tests, and UI tests for your Xcode project. 15
  10. 25 Characteristics of Testable Code Control over inputs Visibility into

    outputs https://developer.apple.com/videos/play/wwdc2017/414/
  11. 26 Characteristics of Testable Code Control over inputs Visibility into

    outputs No hidden state https://developer.apple.com/videos/play/wwdc2017/414/
  12. Structure of the application 31 Framework Independent Service Presenter …

    Repository Use Cases Heart of the application Essential
  13. Structure of the application 32 Framework Dependent Framework Independent Sensor

    View … Database Service Presenter … Repository ? ?
  14. Structure of the application 33 Framework Dependent Framework Independent View

    Presenter Interfaces The interfaces should be written in terms of our domain
  15. Structure of the application 34 Framework Dependent Framework Independent View

    Presenter Protocols In Swift interfaces are defined as Protocols
  16. Open source test automation framework for use with native, hybrid

    and mobile web apps. It drives iOS, Android, and Windows apps using the WebDriver protocol. 50 http://appium.io
  17. Motivation • Risk Reduction • Build and Deploy Automation •

    Tested Builds Available • Build and Test Results 60
  18. “Every 3 weeks, we polish up the Pinterest app to

    make it faster and better than ever.” “To make our app better for you, we bring updates to the App Store every 2 weeks” 61
  19. 63

  20. 66

  21. 67