- Split steps into domain-specific files: - greet_steps.go: Greet API steps - health_steps.go: Health check steps - auth_steps.go: Authentication steps with full JWT implementation - common_steps.go: Shared validation steps - Add comprehensive README.md for steps organization - Implement all TODO items in auth_steps: - JWT claims verification for admin - JWT token validation and parsing - User ID extraction from tokens - Token comparison for consecutive authentications - Update main steps.go to register all domain steps Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
50 lines
1.7 KiB
Markdown
50 lines
1.7 KiB
Markdown
# BDD Steps Organization
|
|
|
|
This folder contains the step definitions for the BDD tests, organized by domain for better maintainability and scalability.
|
|
|
|
## Structure
|
|
|
|
```
|
|
pkg/bdd/steps/
|
|
├── greet_steps.go # Greet-related steps (v1 and v2 API)
|
|
├── health_steps.go # Health check and server status steps
|
|
├── auth_steps.go # Authentication and user management steps
|
|
├── common_steps.go # Shared steps used across multiple domains
|
|
├── steps.go # Main registration file that ties everything together
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Design Principles
|
|
|
|
1. **Domain Separation**: Steps are grouped by functional domain
|
|
2. **Single Responsibility**: Each file focuses on a specific area of functionality
|
|
3. **Reusability**: Common steps are shared via `common_steps.go`
|
|
4. **Scalability**: Easy to add new domains as the application grows
|
|
|
|
## Adding New Steps
|
|
|
|
1. **For new domains**: Create a new `*_steps.go` file following the existing pattern
|
|
2. **For existing domains**: Add to the appropriate domain file
|
|
3. **For shared functionality**: Add to `common_steps.go`
|
|
4. **Register all steps**: Update `steps.go` to include the new steps
|
|
|
|
## Step Naming Convention
|
|
|
|
- Use descriptive, action-oriented names
|
|
- Follow the pattern: `i[Action][Object]` or `the[Object][State]`
|
|
- Example: `iRequestAGreetingFor`, `theAuthenticationShouldBeSuccessful`
|
|
|
|
## Testing the Steps
|
|
|
|
Run BDD tests with:
|
|
```bash
|
|
go test ./features/... -v
|
|
```
|
|
|
|
## Future Domains
|
|
|
|
As the application grows, consider adding:
|
|
- `payment_steps.go` - Payment processing steps
|
|
- `notification_steps.go` - Notification and email steps
|
|
- `admin_steps.go` - Admin-specific functionality steps
|
|
- `api_steps.go` - General API interaction patterns |