XCTestCase

associated object

  • app

    stored an associated app in XCTestCase‘s instance

    Declaration

    Swift

    var app: XCUIApplication { get set }
  • Try to force launch the application. This structure tries to ovecome the issues described at https://forums.developer.apple.com/thread/15780

    Declaration

    Swift

    func tryLaunch<T>(arguments: [T], count counter: Int = 10, wait: UInt32 = 2) where T : RawRepresentable, T.RawValue == String

    Parameters

    arguments

    An array of RawRepresentable iterms that will be passed on as arguments

    counter

    The retry counter for trying to startup the app (Default is 10)

    wait

    The number of seconds to wait. Slower test machines might require a longer wait

  • Declaration

    Swift

    func tryLaunch(count counter: Int = 10)
  • kill App And Relaunch

    Declaration

    Swift

    func killAppAndRelaunch()
  • Try to force closing the application

    Declaration

    Swift

    func tryTearDown(wait: UInt32 = 2)

    Parameters

    wait

    The number of seconds to wait. Slower test machines might require a longer wait

  • Declaration

    Swift

    func isSimulator() -> Bool
  • take a Screenshot

    Declaration

    Swift

    func takeScreenshot(activity: XCTActivity, name: String = "Screenshot")

    Parameters

    activity

    XCTContext.runActivity

    name

    the name of attachment

  • defalut a Screenshot

    Declaration

    Swift

    func takeScreenshot(groupName: String = "--- Screenshot ---", name: String = "Screenshot")

    Parameters

    groupName

    groupName description

    name

    attachment name

  • swifty UITest syntactic sugar

    Declaration

    Swift

    func group(text: String = "Group", closure: (_ activity: XCTActivity) -> ())

    Parameters

    text

    group text description

    closure

    group content code

  • hide the system’s and app’s alerts

    Declaration

    Swift

    func hideAlertsIfNeeded()
  • only apply real iOS machine