Skip to content

In this article we will do an in-depth examination of Code Design Patterns for UI automated tests on iOS and Android.

Patterns we will cover

  • Screen Flow Pattern
  • Robot Pattern

Screen Flow Pattern

The Screen objects are written in an fluent interface manner in which methods can be cascaded or chained in a flow of calls. This is achieved by making the methods return a Screen object required to continue the flow.

The verification of the Screen is always done within the type's constructor or init method.

Example of how test method would look like if using Screen Flow Pattern:

func testDeactivatingAccountAfterLogin() {
    XCUIApplication().launch()

    WelcomeScreen()
        .tapOnLoginButton()
        .submitLoginForm(username: "demo@appelium", password: "App3l1um")
        .navigateToSettings()
        .tapOnDeactivateAccount()
}
TODO

Robot Pattern