Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode command line test with argument passed at launch

I have small problem with implementing xcodebuild command test at CI. I have tests related to specific device language, in xcode I can set "Arguments Passed On Launch" to -AppleLanguages (language). Can I pass that argument using xcodebuild?

My script looks like this

xcodebuild -workspace MyApp.xcworkspace -scheme "MyAppTests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test

Thanks!

like image 353
MichalMoskala Avatar asked Jul 14 '15 14:07

MichalMoskala


People also ask

What is a launch argument?

Launch arguments are probably most commonly used as input to command line tools. Whether we're creating a new folder using mkdir , running a custom build using xcodebuild , or performing network requests using curl - launch arguments provide an easy way to pass string-based input into a command line program.

What is Allowprovisioningupdates?

Aug 14, 2020. Since Xcode 9, Apple provides automatic code signing identity management from the command line by using the xcodebuild command. Using the “allowprovisioningupdates” flag, you can enable code signing; however you may get errors like: Your session has expired.


1 Answers

xcodebuild is for build your app. You can use this command to run your app with specific language.

xcrun simctl launch <deviceid> <appid> -AppleLanguages "(pt-BR)"

Hera a sample with all steps to buil and run your app:

xcodebuild -sdk iphonesimulator8.4 -arch i386 install DSTROOT=YourAppFolder
xcrun instruments -w "iPhone 6 (8.4 Simulator)"
xcrun simctl install booted YourAppFolder/Applications/YourApp.app
xcrun simctl launch booted com.yourdomain.yourapp -AppleLanguages "(pt-BR)"
like image 128
Haroldo Gondim Avatar answered Sep 28 '22 12:09

Haroldo Gondim