Scalable XCUITests within iOS Pipelines - Shashikant Jagtap

When it comes to iOS app development, Swift is becoming the top choice among iOS developers. It’s because of speed, type safety and simplicity of the Swift programming language. Apple also launched Xcode UI testing framework a.k.a XCUITest to test those apps written in Swift. XCUITest is extension of XCTest framework which is Apple’s unit, network and performance testing framework. Using XCUITest, we can write UI Tests in Swift and put the UI Test code in the same repository as application code which makes collaboration with developers and CI/CD practices much smoother. The traditional tools like Appium and Calabash doesn’t fits well in the native app development with Swift. Although, XCUITest has recorder to get started with UI testing, we need to use some patterns to make XCUITest more scalable. Unlike the Page Object Pattern Or Screenplay Pattern in the web testing, we need to organise XCUITests using some sort of test design pattern to make them scalable.

Swift is designed to be a protocol oriented programming language and it has some awesome features like protocols, extensions, enumerations. The patterns like Page Objects or Screenplay may work somehow but they doesn’t fit in the protocol oriented way of Swift. We can use protocol oriented approach to architect XCUITests that can be scaled easily within iOS CI/CD pipelines. In this talk, we will discuss

  • Protocol Oriented architecture for XCUITest and using Swift features like protocols, extensions and enumerations to write XCUITests.
  • How to organise XCUIElements using Swift extensions for better reuse
  • How to architect XCUITests for both iPhone and iPads without code duplication
  • Setting up XCUITests within iOS CI/CD pipelines
  • Tips for writing CI friendly XCUITests. e.g Stubs, Accessibility Identifiers, Real Device Tests, Xcode scheme strategy for UI Tests etc