I am running a UI test and in the setUp() method I set a launch argument:
self.app = XCUIApplication()
self.app.launch()
self.app.launchArguments.append("UITesting")
Then later in the testI try to read the launch argument this way:
if ProcessInfo.processInfo.arguments.contains("UITesting") {
// do something
}
But the code inside the if is never executed. How to make it work?
You cannot set launch arguments after the app is already launched.
You shall set the launch arguments and environment variables, and then launch the app
app.launchArguments.append("UITesting")
app.launch()