How to access launchEnvironment and launchArguments set in XCUIApplication, running UI tests in XCode?

前端 未结 8 875
陌清茗
陌清茗 2020-12-08 00:30

I\'ve tried setting attributes in the XCUIApplication instance, in my UI Tests setUp()

let app = XCUIApplication()
app.launchEnviro         


        
相关标签:
8条回答
  • 2020-12-08 01:08

    For launch arguments, pass them as two separate arguments:

    let app = XCUIApplication()  
    app.launchArguments.append("-arg")  
    app.launchArguments.append("val")  
    app.launch()
    

    Taken from here.

    0 讨论(0)
  • 2020-12-08 01:09

    Here is example with launchArguments and Objective-C:

    if ([[NSProcessInfo processInfo].arguments containsObject:@"SNAPSHOT"]) {
            //do snapshot;
    }
    

    Swift:

        let arguments = ProcessInfo.processInfo.arguments
        if arguments.contains("SNAPSHOT") {
            //do snapshot
        }
    
    0 讨论(0)
提交回复
热议问题