【发布时间】:2019-09-17 17:17:41
【问题描述】:
我正在为 iOS 应用程序构建/测试检查构建自定义 Jenkins 构建脚本 (sh)。 但有时 UI 测试只是因为时间问题而失败,所以我希望它重新运行几次以确保问题是真实的。
for (( ATTEMPT=1; ATTEMPT<=2; ATTEMPT++ ))
do
xcodebuild [flags] test #add_result_saving_mechanism
#if failed, do smth to go to next attempt. Else - break
if SOME_KIND_OF_FAIL_CHECK; then
continue
else
break
fi
fi
我之前使用过 xcpretty,因此能够读取 $PIPESTATUS 并做出相应的反应,但由于某种原因 xcpretty 因xcodebuild test 而崩溃,所以想办法不使用它
xcodebuild [flags] test | xcpretty
STATUS="${PIPESTATUS}"
if [ "$STATUS" != "0" ]; then
FAILURE_MSG="${TARGET} (${BUILD_NAME}) failed UI/Unit testing"
#try next attempt if available
continue
else
break
fi
如何在没有管道/xcpretty 的情况下处理这些重试?
【问题讨论】:
-
如果您的问题的答案之一是正确的,您应该考虑接受它。
标签: bash jenkins xcodebuild