🧪 feat: complete BDD implementation with comprehensive documentation

Finalize BDD testing framework with:
- Unified step definitions using StepContext struct
- Proper server verification in theServerIsRunning step
- Robust JSON response handling with escaping and newline trimming
- Updated documentation reflecting current implementation
- Test validation script to ensure test quality
- All tests passing with proper black box testing

Key files updated:
- pkg/bdd/steps/steps.go: Unified step definitions
- pkg/bdd/testserver/client.go: Robust response validation
- pkg/bdd/README.md: Godog pattern guide
- doc/BDD_GUIDE.md: Updated usage guide
- adr/0008-bdd-testing.md: Updated ADR with current approach
- scripts/run-bdd-tests.sh: Test validation script

The BDD framework is now production-ready with comprehensive
documentation and proper testing practices.
This commit is contained in:
2026-04-04 17:59:07 +02:00
parent 0daaf9bf96
commit 85b6cf82ee
5 changed files with 328 additions and 21 deletions

42
scripts/run-bdd-tests.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# BDD Test Runner Script
# Runs all BDD tests and fails if there are undefined, pending, or skipped steps
set -e
echo "🧪 Running BDD Tests..."
cd /Users/gabrielradureau/Work/Vibe/DanceLessonsCoach
# Run the BDD tests
test_output=$(go test ./features/... -v 2>&1)
test_exit_code=$?
echo "$test_output"
# Check for undefined steps
if echo "$test_output" | grep -q "undefined"; then
echo "❌ FAILED: Found undefined steps"
exit 1
fi
# Check for pending steps
if echo "$test_output" | grep -q "pending"; then
echo "❌ FAILED: Found pending steps"
exit 1
fi
# Check for skipped steps
if echo "$test_output" | grep -q "skipped"; then
echo "❌ FAILED: Found skipped steps"
exit 1
fi
# Check if tests passed
if [ $test_exit_code -eq 0 ]; then
echo "✅ All BDD tests passed successfully!"
exit 0
else
echo "❌ BDD tests failed"
exit 1
fi