3

I have about 300 UI XCTest tests which i want run in every pull request.
I use some command, like it:

xcodebuild \
  -project App.xcodeproj \
  -scheme App \
  -sdk iphonesimulator \
  -destination 'platform=iOS Simulator,name=iPhone 8,OS=15.0' \
  test

But i want stopping after first failed (for save time in build server). Have any way to do it?

Update:
xcodebuild have't any flag for this.
Now i try get result stream, and check that one test is failed.

Eysner
  • 584
  • 4
  • 15

1 Answers1

-1

Add this lines to your script:

if test $? -eq 0
then
   echo "xcodebuild succeeded"
else
   echo "xcodebuild failed with " + $?
   exit 1
fi
ToninoF
  • 1
  • 3
  • Can you pls add more description about how it work? – Eysner Mar 23 '22 at 08:11
  • $? is a global variable with the result code of the last executed command. Have a look here: https://stackoverflow.com/questions/7363459/how-to-get-the-return-value-of-xcodebuild – ToninoF Mar 24 '22 at 17:40
  • 1
    But it wait result all tests, i want stop run after first fail – Eysner Mar 25 '22 at 04:40