🧪 test: fix BDD step registration and update CI/CD workflow
- Fix step pattern escaping in pkg/bdd/steps/steps.go:80 - Update CI/CD workflow to use run-bdd-tests.sh script - Enhance run-bdd-tests.sh for both local and CI environments - Add strict validation for undefined/pending/skipped steps - Update BDD testing documentation with pattern requirements The CI/CD pipeline now properly validates BDD tests and fails on any undefined, pending, or skipped steps. All 22 BDD scenarios are passing with correct step pattern registration.
This commit is contained in:
@@ -183,10 +183,24 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run tests with coverage
|
||||
- name: Run BDD tests with strict validation
|
||||
run: |
|
||||
echo "Running tests with PostgreSQL service..."
|
||||
go test ./... -coverprofile=coverage.out -v && go tool cover -func=coverage.out > coverage.txt
|
||||
echo "Running BDD tests with strict validation..."
|
||||
# Use the run-bdd-tests.sh script which fails on undefined/pending steps
|
||||
# In CI environment, PostgreSQL is already running as a service
|
||||
export DLC_DATABASE_HOST=postgres
|
||||
export DLC_DATABASE_PORT=5432
|
||||
export DLC_DATABASE_USER=postgres
|
||||
export DLC_DATABASE_PASSWORD=postgres
|
||||
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
|
||||
export DLC_DATABASE_SSL_MODE=disable
|
||||
./scripts/run-bdd-tests.sh
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
run: |
|
||||
echo "Running unit tests with PostgreSQL service..."
|
||||
# Run unit tests excluding BDD tests (already run above)
|
||||
go test ./pkg/... ./cmd/... -coverprofile=coverage.out -v && go tool cover -func=coverage.out > coverage.txt
|
||||
|
||||
# Extract coverage percentage
|
||||
COVERAGE=$(grep "total:" coverage.txt | grep -oP '\d+\.\d+' | head -1)
|
||||
|
||||
Reference in New Issue
Block a user