How to stop xcodebuild tests execute after first fail

Viewed 223

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.

1 Answers

Add this lines to your script:

if test $? -eq 0
then
   echo "xcodebuild succeeded"
else
   echo "xcodebuild failed with " + $?
   exit 1
fi
Related