2016-06-13 4 views
0

私はiosのテストケースを書いたiosプロジェクトを持っています。swiftからxcodebuildテストコマンドを実行

私は別のosx(swift)コマンドラインツールを作成し、メインファイルからiosプロジェクトのuiテストを実行したいと思います。私は、端末からこのコマンドを実行した場合、正しく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' 

:このため

は、私は、以下のコマンドを使用します。

私のosxコマンドラインツールのswiftファイル(新しい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 

here automationProject is the osx project name from where i run my main file to run the ios ui test. 

私のエラーは何か私を助けてください。

+0

@Eric Dのおかげで、私はあなたを知っているだろう –

+0

@EricD、実際に起動パスを使って私のios xcode proj dirに切り替えることができますか?私は起動パスとして/ usr/bin/xcodebuildを使うので –

答えて

0

以下のように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") 
関連する問題