Gabriel Radureau 0daaf9bf96 feat: implement BDD testing with Godog
Implement comprehensive BDD testing framework using Godog:
- Added feature files for greet and health endpoints
- Created test server that runs on port 9191
- Implemented step definitions using Godog's exact patterns
- Fixed undefined step warnings by following Godog conventions
- All tests passing with proper response validation
- Maintained black box testing principles

Key files:
- pkg/bdd/steps/steps.go - Step definitions using StepContext struct
- pkg/bdd/testserver/ - Test server implementation
- features/*.feature - BDD feature files
- pkg/bdd/README.md - Documentation for proper step patterns

The implementation follows Godog's exact pattern suggestions to avoid
undefined step warnings and provides comprehensive API testing.
2026-04-04 17:43:57 +02:00
2026-04-04 17:43:57 +02:00
2026-04-04 17:43:57 +02:00

DanceLessonsCoach

A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.

Features

  • Greet function with default behavior
  • Command-line interface
  • JSON API with versioned endpoints
  • Chi router integration
  • Zerolog for high-performance logging
  • Viper for configuration management
  • Graceful shutdown with context
  • Readiness endpoint for Kubernetes/service mesh integration
  • OpenTelemetry integration with Jaeger support
  • Unit tests
  • Go 1.26.1 compatible

Installation

# Clone the repository
git clone https://github.com/yourusername/DanceLessonsCoach.git
cd DanceLessonsCoach

# Build and run
go run ./cmd/greet

Configuration

Basic configuration options:

# Start with default configuration
./scripts/start-server.sh start

# Custom port
export DLC_SERVER_PORT=9090
./scripts/start-server.sh start

# JSON logging
export DLC_LOGGING_JSON=true
./scripts/start-server.sh start

See AGENTS.md for comprehensive configuration guide including:

  • File-based configuration
  • Environment variables
  • Configuration priority rules
  • OpenTelemetry setup
  • Advanced scenarios

Usage

CLI

# Default greeting
go run ./cmd/greet
# Output: Hello world!

# Custom greeting
go run ./cmd/greet John
# Output: Hello John!

Web Server

Using the server control script (recommended):

# Start the server
./scripts/start-server.sh start

# Test API endpoints
./scripts/start-server.sh test

# Stop the server
./scripts/start-server.sh stop

Manual server management:

# Start the server
go run ./cmd/server

# Test API endpoints
curl http://localhost:8080/api/health
# Output: {"status":"healthy"}

curl http://localhost:8080/api/ready
# Output: {"ready":true}

curl http://localhost:8080/api/v1/greet
# Output: {"message":"Hello world!"}

curl http://localhost:8080/api/v1/greet/John
# Output: {"message":"Hello John!"}

Testing

# Run all tests
go test ./...

# Run specific package tests
go test ./pkg/greet/

Project Structure

DanceLessonsCoach/
├── adr/                    # Architecture Decision Records
├── cmd/                    # Entry points (greet CLI, server)
├── pkg/                    # Core packages (config, greet, server, telemetry)
├── config.yaml             # Configuration file
├── scripts/                # Management scripts
└── go.mod                   # Go module definition

See AGENTS.md for detailed structure and component explanations.


## Architecture

This project uses Architecture Decision Records (ADRs) to document key technical choices. See [adr/](adr/) for complete documentation including decisions on Go 1.26.1, Chi router, Zerolog, OpenTelemetry, interface-based design, graceful shutdown, configuration management, and testing strategies.

**Adding new decisions?** See [adr/README.md](adr/README.md) for guidelines.

## License

MIT
Description
No description provided
Readme 57 MiB
Languages
Go 71.2%
Shell 21.7%
Gherkin 3.9%
TypeScript 1.4%
Vue 0.5%
Other 1.2%