An example UI testing bundle AppfigurateExampleUITests is available in AppfigurateExample. To test AppfigurateExample (Swift iOS) is selected as the scheme, then long tap the run button to show more options and tap Test (⌘U).

As your target app links AppfigurateLibrary.xcframework, Xcode will automatically make the framework available for the testing target.

Add APLConfiguration subclass to UI testing bundle

Tap on your APLConfiguration subclass in the project navigator. In File inspector ‣ Target membership, tick on your UI testing bundle.

Ensure allowInvalidSignatures returns YES

In your APLConfiguration subclass, ensure that your allowInvalidSignatures method returns true when running automation tests. (Test schemes are by default run with a DEBUG build).

Add a UIInterruptionMonitor

When the configuration is applied to the application on launch, the standard Appfigurate 'Configuration applied' alert is displayed. You can optionally add an UIInterruptionMonitor to your XCTestCase to automatically dismiss this alert.

Swift example

addUIInterruptionMonitor(withDescription: "Appfigurate") { alert -> Bool in
  return true

Create instance of APLConfiguration subclass

  • Create an instance of your APLConfiguration subclass in your XCTestCase. A good place to do this in the setUp method.

  • Set the properties required to be applied to your app to allow it to be tested correctly.

Swift example

let c = ExampleConfiguration()
c.boolean = false
c.string_Textfield = "thursday"

Apply configuration to XCUIApplication

  • Apply the result of APLConfiguration automationLaunchArguments method to XCUIApplication launchArguments property.

  • Launch your app.

Swift example

app = XCUIApplication()
app.launchArguments = c.automationLaunchArguments()

Once your app is launched, the configuration you set in Create instance of APLConfiguration subclass will be applied before executing each test case.

Additional automation launch methods

See also automationLaunchArgumentsReset and automationLaunchArgumentsWithAction methods of APLConfiguration.

Last updated