Commit ec675954 authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon

Bug 1583435: Let mahara_behat.sh run just one particular feature file

Change-Id: Id5c9a279f257db8c2bc832ff0799682027f62518
behatnotneeded: Covered by existing tests
(cherry picked from commit b4bcce0b)
parent 647b20e1
......@@ -63,6 +63,20 @@ then
elif [ "$ACTION" = "run" -o "$ACTION" = "runheadless" -o "$ACTION" = "rundebug" -o "$ACTION" = "runfresh" -o $ACTION = 'rundebugheadless' ]
then
if [[ $2 == @* ]]; then
TAGS=$2
echo "Only run tests with the tag: $TAGS"
elif [ $2 ]; then
if [[ $2 == */* ]]; then
FEATURE="test/behat/features/$2"
else
FEATURE=`find test/behat/features -name $2 | head -n 1`
fi
echo "Only run tests in file: $FEATURE"
else
echo "Run all tests"
fi
if [ "$ACTION" = "runfresh" ]
then
echo "Drop the old test site if exist"
......@@ -73,8 +87,6 @@ then
php htdocs/testing/frameworks/behat/cli/init.php
# Run the Behat tests themselves (after any intial setup)
TAGS=$2
if is_selenium_running; then
echo "Selenium is running"
else
......@@ -119,24 +131,24 @@ then
BEHATCONFIGFILE=`php htdocs/testing/frameworks/behat/cli/util.php --config`
echo "Run Behat..."
OPTIONS=''
if [ "$TAGS" ]
if [ $ACTION = 'rundebug' -o $ACTION = 'rundebugheadless' ]
then
echo "Only run tests with the tag: $TAGS"
OPTIONS=$OPTIONS" --format=pretty"
fi
if [ "$TAGS" ]; then
OPTIONS=$OPTIONS" --tags "$TAGS
else
echo "Run all tests"
elif [ "$FEATURE" ]; then
OPTIONS=$OPTIONS" "$FEATURE
fi
echo
echo "=================================================="
echo
if [ $ACTION = 'rundebug' -o $ACTION = 'rundebugheadless' ]
then
OPTIONS=$OPTIONS" --format=pretty"
fi
echo ./external/vendor/bin/behat --config $BEHATCONFIGFILE $OPTIONS
./external/vendor/bin/behat --config $BEHATCONFIGFILE $OPTIONS
echo
......@@ -151,11 +163,15 @@ else
echo "# Run all tests:"
echo "mahara_behat run"
echo ""
echo "# Run tests in file \"example.feature\""
echo "mahara_behat run example.feature"
echo ""
echo "# Run tests with specific tag:"
echo "mahara_behat run @tagname"
echo ""
echo "# Run tests with extra debug output:"
echo "mahara_behat rundebug"
echo "mahara_behat rundebug example.feature"
echo "mahara_behat rundebug @tagname"
echo ""
echo "# Run in headless mode (requires xvfb):"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment