Objective-C

An example UI testing bundle AppfigurateExampleUITests is available in AppfigurateExample. To test, ensure AppfigurateExample (ObjC 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 YES 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.

Objective-C example

[self addUIInterruptionMonitorWithDescription: @"Appfigurate" handler: ^(XCUIElement *alert) {
  [alert.buttons[@"OK"] tap];
  [alert.buttons[@"Ignore"] tap];
  return YES;
}];

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.

Objective-C example

ExampleConfiguration* c = [ExampleConfiguration new];
c.boolean = NO;
c.string_Textfield = @"thursday";

Apply configuration to XCUIApplication

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

  • Launch your app.

Objective-C example

app = [XCUIApplication new];
app.launchArguments = [c automationLaunchArguments];
[app launch];

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