Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match on success message for instrumented tests #6541

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion android/scripts/run-instrumented-tests-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"/..
./gradlew assembleOssProdAndroidTest
./gradlew app:assembleOssProdDebug
"$SCRIPT_DIR"/run-instrumented-tests.sh app
REPORT_DIR=$(mktemp -d)
export REPORT_DIR
"$SCRIPT_DIR"/run-instrumented-tests.sh --test-type app --infra-flavor prod --billing-flavor oss

10 changes: 5 additions & 5 deletions android/scripts/run-instrumented-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cd "$SCRIPT_DIR"
AUTO_FETCH_TEST_HELPER_APKS=${AUTO_FETCH_TEST_HELPER_APKS:-"false"}

APK_BASE_DIR=${APK_BASE_DIR:-"$SCRIPT_DIR/.."}
LOG_FAILURE_MESSAGE="FAILURES!!!"
LOG_SUCCESS_REGEX="OK \([0-9]+ tests\)"

ORCHESTRATOR_URL=https://dl.google.com/android/maven2/androidx/test/orchestrator/1.5.0/orchestrator-1.5.0.apk
TEST_SERVICES_URL=https://dl.google.com/android/maven2/androidx/test/services/test-services/1.5.0/test-services-1.5.0.apk
Expand Down Expand Up @@ -226,15 +226,15 @@ adb uninstall androidx.test.services || echo "Test services package not installe
adb uninstall androidx.test.orchestrator || echo "Test orchestrator package not installed"
echo ""

echo "### Checking logs for failures ###"
if grep -q "$LOG_FAILURE_MESSAGE" "$INSTRUMENTATION_LOG_FILE_PATH"; then
echo "### Checking logs for success message ###"
if grep -q -E "$LOG_SUCCESS_REGEX" "$INSTRUMENTATION_LOG_FILE_PATH"; then
echo "Success, no failures!"
else
echo "One or more tests failed, see logs for more details."
echo "Collecting report..."
adb pull "$DEVICE_SCREENSHOT_PATH" "$LOCAL_SCREENSHOT_PATH" || echo "No screenshots"
adb logcat -d > "$LOGCAT_FILE_PATH"
exit 1
else
echo "No failures!"
fi

if [[ -n ${TEMP_DOWNLOAD_DIR-} ]]; then
Expand Down
Loading