I like to use launch arguments with my UITesting. I have seen / used a few solutions that expose internal architecture to the UITest framework to do this. I'd like to pass arguments just like I would on the command line and parse them appropriately. TSCUtility has this built in but does not currently work for iOS, tvOS, watchOS.
It appears to be very straight forward to include all apple OSs
// Platform-specific flags.
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
public static let first: DLOpenFlags = DLOpenFlags(rawValue: RTLD_FIRST)
public static let deepBind: DLOpenFlags = DLOpenFlags(rawValue: 0)
#else
public static let first: DLOpenFlags = DLOpenFlags(rawValue: 0)
public static let deepBind: DLOpenFlags = DLOpenFlags(rawValue: RTLD_DEEPBIND)
#endif
#endif
@available(macOS 10.14, iOS 12, tvOS 12, watchOS 12, *)
// ------
#available(macOS 10.14, iOS 12, tvOS 12, watchOS 12, *)
Use Case:
func testExample() {
// UI tests must launch the application that they test.
let app = XCUIApplication()
let arguments: [LaunchArgument] = [
.debug
,.logLevel(.debug)
]
app.launchArguments = arguments.strings
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
XCTAssert( app.staticTexts["Hello World"].exists )
}
Where
try Configuration.parse(self.arguments)
logger = Logger.bootstrap(with: Configuration.loggingConfiguration)
I've created a pull-request