Passing arguments to iOS tests with xcodebuild

前端 未结 2 800
忘了有多久
忘了有多久 2021-02-08 13:05

I\'d like to pass command line arguments to my iOS tests through the command line (xcodebuild). I\'m looking for the equivalent of this setting on XCode:

Simply

2条回答
  •  心在旅途
    2021-02-08 13:27

    I didn't manage to find "easy" solution. So instead I split testing in 3 steps:
    1. Run xcodebuild build-for-testing. It will generate xctestrun file in derived data, which contains list of launch arguments
    2. Add your desire launch arguments here
    3. run xcodebuild test-without-building -xctestrun <%path_to_file_here%>

    I wrote script for it. It still need some improvements, so in close time I will share its final form.

    Edit: Never had time to update script. So here ugly versions, that suit our needs. https://gist.github.com/ManWithBear/57cbabc8dcd0193d156c376d2d23ff02

提交回复
热议问题