#!/bin/bash # Tag-Based Test Runner Script # Runs BDD tests with specific tags set -e # Check if tag is provided if [ $# -eq 0 ]; then echo "โŒ Usage: $0 [feature]" echo "Examples:" echo " $0 @smoke # Run all smoke tests" echo " $0 @critical auth # Run critical auth tests" echo " $0 @v2 greet # Run v2 greet tests" exit 1 fi TAG=$1 FEATURE="" # Check if feature is also provided if [ $# -ge 2 ]; then FEATURE=$2 fi SCRIPTS_DIR=$(dirname `realpath ${BASH_SOURCE[0]}`) cd $SCRIPTS_DIR/.. echo "๐Ÿงช Running tests with tag: $TAG" if [ -n "$FEATURE" ]; then echo "๐Ÿ“ Feature: $FEATURE" # Set feature-specific environment variables DATABASE="dance_lessons_coach_${FEATURE}_test" CONFIG="features/${FEATURE}/${FEATURE}-test-config.yaml" export DLC_DATABASE_HOST="localhost" export DLC_DATABASE_PORT="5432" export DLC_DATABASE_USER="postgres" export DLC_DATABASE_PASSWORD="postgres" export DLC_DATABASE_NAME="${DATABASE}" export DLC_DATABASE_SSL_MODE="disable" export DLC_CONFIG_FILE="${CONFIG}" # Run feature-specific tests with tag filtering echo "๐Ÿš€ Running tagged tests for ${FEATURE} feature..." cd "features/${FEATURE}" FEATURE=${FEATURE} go test -v -tags="$TAG" . else echo "๐Ÿš€ Running tagged tests for all features..." # Run all tests with tag filtering # Note: Godog tag filtering is done through the godog command line # For Go test integration, we need to use a different approach echo "โš ๏ธ Tag filtering for all features requires godog command directly" echo "๐Ÿ“ Running: godog --tags=$TAG features/" # This would require setting up the test server manually # For now, we'll show how it would work echo "โณ This functionality would require additional implementation" echo "๐Ÿ’ก Consider using: godog --tags=$TAG features/" echo " after starting the test server manually" fi