From 28cd42613d8abb2bb4b0e096ceb1159a9c235fe4 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Mon, 17 Jul 2023 12:06:19 +0200 Subject: [PATCH] added stop running tests after first failure option (#6786) --- docs/ocis/development/testing.md | 6 ++++++ tests/acceptance/run.sh | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 4b3c9e6d9..da4eb1f3a 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -255,6 +255,12 @@ A specific scenario from a feature can be run by adding `:` at the > > STORAGE_DRIVER=owncloudsql +`STOP_ON_FAILURE`: to stop running tests after the first failure + +> Example: +> +> STOP_ON_FAILURE=true + ### Use Existing Tests for BDD As a lot of scenarios from `test-acceptance-from-core-api` are written for oC10, we can use those tests for Behaviour driven development in oCIS. diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh index 0b79ffea4..a896c6f8c 100755 --- a/tests/acceptance/run.sh +++ b/tests/acceptance/run.sh @@ -22,6 +22,11 @@ then STEP_THROUGH_OPTION="--step-through" fi +if [ -n "${STOP_ON_FAILURE}" ] +then + STOP_OPTION="--stop-on-failure" +fi + if [ -n "${PLAIN_OUTPUT}" ] then # explicitly tell Behat to not do colored output @@ -180,6 +185,7 @@ fi # --------------- # $UNEXPECTED_FAILED_SCENARIOS array of scenarios that failed unexpectedly # $UNEXPECTED_PASSED_SCENARIOS array of scenarios that passed unexpectedly (while running with expected-failures.txt) +# $STOP_ON_FAILURE - aborts the test run after the first failure declare -a UNEXPECTED_FAILED_SCENARIOS declare -a UNEXPECTED_PASSED_SCENARIOS @@ -195,7 +201,7 @@ function run_behat_tests() { fi echo "Using behat config '${BEHAT_YML}'" - ${BEHAT} ${COLORS_OPTION} --strict ${STEP_THROUGH_OPTION} -c ${BEHAT_YML} -f pretty ${BEHAT_SUITE_OPTION} --tags ${BEHAT_FILTER_TAGS} ${BEHAT_FEATURE} -v 2>&1 | tee -a ${TEST_LOG_FILE} + ${BEHAT} ${COLORS_OPTION} ${STOP_OPTION} --strict ${STEP_THROUGH_OPTION} -c ${BEHAT_YML} -f pretty ${BEHAT_SUITE_OPTION} --tags ${BEHAT_FILTER_TAGS} ${BEHAT_FEATURE} -v 2>&1 | tee -a ${TEST_LOG_FILE} BEHAT_EXIT_STATUS=${PIPESTATUS[0]}