我有一个ios项目,在这里我编写了我的ios测试用例。
现在,我已经创建了另一个osx(迅速)命令行工具,在主文件中,我想运行我的ios项目ui测试。
为此,我使用以下命令:
xcodebuild test -project /Users/usernamer/Desktop/Xocde/ios-ui-automation-demo-master/ios-ui-automation-demo.xcodeproj -scheme ios-ui-automation-demo -destination 'platform=iOS Simulator,name=iPad Air'如果我从终端运行此命令,则ios项目ui测试将正常运行。
但是,如果我从我的osx命令行工具快捷文件(在一个新的OSX项目中)运行这个命令,这将显示一个错误。代码是
import Foundation
func shell(args: String...) -> Int32 {
let task = NSTask()
task.launchPath = "/usr/bin/xcodebuild"
task.arguments = args
task.launch()
task.waitUntilExit()
return task.terminationStatus
}
print("This is test version edit")
shell("xcodebuild test -project /Users/username/Desktop/Xocde/ios-ui-automation-demo-master/ios-ui-automation-demo.xcodeproj -scheme ios-ui-automation-demo -destination 'platform=iOS Simulator,name=iPad Air'")此代码显示以下错误:
xcodebuild: error: The directory /Users/username/Library/Developer/Xcode/DerivedData/automationProject-brxvyfplrimnekchsaaenmecydkp/Build/Products/Debug does not contain an Xcode project.
Program ended with exit code: 9这里,automationProject是osx项目的名称,我从这里运行我的主文件来运行ios测试。
请帮助我什么是我的错误。
发布于 2016-06-14 13:47:44
使用task.launchPath如下所示:
task.launchPath = "/usr/bin/env"最后,使用如下函数:
shell("xcodebuild", "test","-project","/Users/username/Desktop/Xocde/ios-ui-automation-demo-master/ios-ui-automation-demo.xcodeproj","-scheme","ios-ui-automation-demo","-destination","platform=iOS Simulator,name=iPad Air")https://stackoverflow.com/questions/37790288
复制相似问题