【发布时间】:2016-05-25 20:02:17
【问题描述】:
我正在我的 iOS 应用程序中进行一些 UI 测试,但我看到了一些奇怪的行为。
在我的setUp() 方法中,我向XCUIApplication().launchArguments 添加了一些值,但是当我查询以查看启动参数时,我得到了一个空数组。
这就是我的setUp() 方法的样子:
override func setUp() {
super.setUp()
let application = XCUIApplication()
application.launchArguments = ["USE_SERVER_DEBUG"]
application.launch()
}
这是调用Process.arguments 来检索参数的函数
func checkArguments(){
let launchArguments = Process.arguments
for index in 0 ..< launchArguments.count {
let argument = launchArguments[index] as String
if argument.compare("USE_DEBUG_SERVER") == NSComparisonResult.OrderedSame {
// Do something
}
}
return true
}
【问题讨论】:
-
我对自动化一无所知,但请查看此答案。看来您可能没有访问正确的进程。 stackoverflow.com/a/33335994/1671729
标签: ios swift unit-testing xcode-ui-testing