Skip to main content

Logic Tests (aka Unit Tests) and Application Tests (aka Integration Tests) with Jenkins and xcode

Motivation

Apple Developer: About Unit Testing

Logic Tests

  1. Apple Developer: Setting Up Unit-Testing in a Project
  2. Download convert OCUnit command line output to JUnit XML: OCUnit2JUnit and put it in your project
  3. Setup Freestyle project in Jenkins
  4. Add Execute shell step:
    • chmod +x ./pathtoscript/ocunit2junit.rb
    • xcodebuild -target myTarget -configuration myConfig -sdk iphonesimulator clean build | ./pathtoscript/ocunit2junit.rb
  5. Add post build action Publish JUnit Test Results with location:
    • test-reports/*.xml

Application Tests

  1. Apple Developer: Setting Up Unit-Testing in a Project
  2. Download the patched RunPlatformUnitTests script and put in your project
  3. Open the Build Phases - Run Script setting and change script path to "${PROJECT_DIR}/pathtoscript/RunPlatformUnitTests"
    • Download convert OCUnit command line output to JUnit XML: OCUnit2JUnit and put it in your project
    • Setup Freestyle project in Jenkins
    • Add Execute shell step:
      • chmod +x ./pathtoscript/ocunit2junit.rb
      • xcodebuild -target myTarget -configuration myConfig -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build | ./pathtoscript/ocunit2junit.rb
    • Add post build action Publish JUnit Test Results with location:
      • test-reports/*.xml

    UI Automation Tests

    Upcoming...

    Comments

    Popular posts from this blog

    Pattern: Riblets vs. VIPER

    Engineering the architecture behind Uber's new rider app

    Not being held back by our extensive codebase and previous design choices gave us the freedom where we otherwise would have made compromises. The outcome is the sleek new app you see today, which implements a new mobile architecture across both iOS and Android. Read on to learn why we felt the need to create this new architecture pattern, called Riblets, and how it helps us reach our goals.

    The platforms share:

    Core architectureClass namesInheritance relationships between business logic unitsHow business logic is dividedPlugin points (names, existence, structure, etc.)Reactive programming chainsUnified platform components
    Each Riblet is made up of one Router, Interactor, and Builder with its Component (hence the name), and optional Presenters and Views. The Router and Interactor handle the business logic, while the Presenter and View handle the view logic.

    Uber

    Stetho - A Chrome debug bridge for Android applications

    Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature natively part of the Chrome desktop browser. Developers can also choose to enable the optional dumpapp tool which offers a powerful command-line interface to application internals.

    Facebook Github

    WireMock

    WireMock is a flexible library for stubbing and mocking web services. Unlike general purpose mocking tools it works by creating an actual HTTP server that your code under test can connect to as it would a real web service.

    It supports HTTP response stubbing, request verification, proxy/intercept, record/playback of stubs and fault injection, and can be used from within a unit test or deployed into a test environment.

    Although it’s written in Java, there’s also a JSON API so you can use it with pretty much any language out there.

    WireMock.org