2016-06-13 5 views
0

ios 프로젝트에 ios ui 테스트 케이스를 작성했습니다.swift에서 xcodebuild 테스트 명령을 실행하십시오.

이제 다른 osx (신속한) 명령 줄 도구를 만들고 기본 파일에서 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 프로젝트에서 새로운 OSX 명령 줄 도구 swift 파일에서 명령을 실행하면 오류가 표시됩니다. 코드는 다음 코드는 다음과 같은 오류를 보여줍니다

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") 
관련 문제