Guides

  • Configures given application with provided launch options and variables. TestLauncher is a wrapper around XCUIApplication.launchArguments and XCUIApplication.launchEnvironment. By using abstract type, LaunchOption, it is possible to pass parameters to the testing application.

    AutoMate provides set of options which can set system locale, language, keyboard languages, or advanced options like CoreData SQL debug verbosity level.

    Example:

    let app = XCUIApplication()
    TestLauncher(options: [
        SystemLanguages([.English, .German]),
        SystemLocale(language: .English, country: .Canada),
        SoftwareKeyboards([.EnglishCanada, .GermanGermany])
    ]).configure(app).launch()
    

    Default options:

    It is not known which options should be added to TestLauncher by default. It depends on the application. That is why TestLauncher doesn’t provide any default set of options.

    In your application you can create an extension to TestLauncher with default list of options.

    Example:

    extension TestLauncher {
        static let defaultLaunchOptions: [LaunchOption] = [AnimationLaunchEnvironment()]
    
        public static func configureWithDefaultOptions<T: Application>(_ application: T, additionalOptions options: [LaunchOption] = []) -> T {
            return TestLauncher(options: defaultLaunchOptions + options).configure(application)
        }
    }
    

    With such extensions the XCUIApplication can be configured with default options of your choice.

    Example:

    let app = XCUIApplication()
    TestLauncher.configureWithDefaultOptions(app).launch()
    
    See more

    Declaration

    Swift

    public struct TestLauncher