Accessing user defined variables passed in from xcodebuild command line

后端 未结 3 952
不知归路
不知归路 2021-01-01 19:01

I am running my xctests using xcodebuild and need to pass in some environment variables. In the example below ACCOUNT_ID and HOS

3条回答
  •  不知归路
    2021-01-01 19:17

    What I did for my case is I used the xcodebuild build-for-testing command and create the xctestrun file then using xcodebuild test-without-building to run the test . in this case you can change the xctestrun file which has the environment variables in its plist before running your test .

    so you need to run a script by using PlistBuddy to change your plist environment keys . for example to add a key :

    /usr/libexec/PlistBuddy -c "add :APPNAME-TARGETNAME:EnvironmentVariables:KEYNAME string 'VALUE'" "(Path to XCTestRun file)"
    

提交回复
热议问题