Skip to content

Commit a016e82

Browse files
authored
Merge pull request #7647 from woocommerce/save-test-result-as-artifacts
Make sure test results are archived when test suites fail
2 parents 700c2fa + 0dcfec0 commit a016e82

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.buildkite/commands/run-ui-tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ install_cocoapods
3535
echo "--- 🧪 Testing"
3636
xcrun simctl list >> /dev/null
3737
rake mocks &
38+
set +e
3839
bundle exec fastlane test_without_building name:"$TEST_NAME" device:"$DEVICE" ios_version:"$IOS_VERSION"
40+
TESTS_EXIT_STATUS=$?
41+
set -e
42+
43+
if [[ "$TESTS_EXIT_STATUS" -ne 0 ]]; then
44+
# Keep the (otherwise collapsed) current "Testing" section open in Buildkite logs on error. See https://buildkite.com/docs/pipelines/managing-log-output#collapsing-output
45+
echo "^^^ +++"
46+
echo "UI Tests failed!"
47+
fi
3948

4049
echo "--- 📦 Zipping test results"
4150
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -
51+
52+
exit $TESTS_EXIT_STATUS

.buildkite/commands/run-unit-tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ echo "--- :rubygems: Setting up Gems"
1616
install_gems
1717

1818
echo "--- 🧪 Testing"
19+
set +e
1920
bundle exec fastlane test_without_building name:UnitTests
21+
TESTS_EXIT_STATUS=$?
22+
set -e
23+
24+
if [[ "$TESTS_EXIT_STATUS" -ne 0 ]]; then
25+
# Keep the (otherwise collapsed) current "Testing" section open in Buildkite logs on error. See https://buildkite.com/docs/pipelines/managing-log-output#collapsing-output
26+
echo "^^^ +++"
27+
echo "Unit Tests failed!"
28+
fi
2029

2130
echo "--- 📦 Zipping test results"
2231
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -
32+
33+
exit $TESTS_EXIT_STATUS

0 commit comments

Comments
 (0)