🧪 fix: standardize BDD test execution across all feature suites
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 10s
CI/CD Pipeline / CI Pipeline (push) Failing after 3m12s

- Fixed path resolution in test setup to handle both feature-specific and multi-feature execution
- Standardized stopOnFailure=false for all feature tests to ensure consistent behavior
- Removed @todo tag from implemented Configuration validation scenario
- Ensured GODOG_TAGS=todo go test ./features/X/... and FEATURE=X go test ./features/ run identical tests

All feature suites (jwt, auth, greet, health, config) now behave consistently regardless of execution method.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-04-10 11:04:09 +02:00
parent aa4823eb11
commit 4df20585b8
6 changed files with 23 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ import (
)
func TestAuthBDD(t *testing.T) {
config := testsetup.NewFeatureConfig("auth", "progress", true)
config := testsetup.NewFeatureConfig("auth", "progress", false)
suite := testsetup.CreateTestSuite(t, config, "dance-lessons-coach BDD Tests - Auth Feature")
if suite.Run() != 0 {

View File

@@ -7,7 +7,7 @@ import (
)
func TestGreetBDD(t *testing.T) {
config := testsetup.NewFeatureConfig("greet", "progress", true)
config := testsetup.NewFeatureConfig("greet", "progress", false)
suite := testsetup.CreateTestSuite(t, config, "dance-lessons-coach BDD Tests - Greet Feature")
if suite.Run() != 0 {

View File

@@ -7,7 +7,7 @@ import (
)
func TestHealthBDD(t *testing.T) {
config := testsetup.NewFeatureConfig("health", "progress", true)
config := testsetup.NewFeatureConfig("health", "progress", false)
suite := testsetup.CreateTestSuite(t, config, "dance-lessons-coach BDD Tests - Health Feature")
if suite.Run() != 0 {

View File

@@ -83,7 +83,6 @@ Feature: JWT Secret Retention Policy
And the old token should still be valid during retention period
And both tokens should work until retention period expires
@todo
Scenario: Configuration validation
Given I set retention factor to 0.5
When I try to start the server

View File

@@ -7,7 +7,7 @@ import (
)
func TestJWTBDD(t *testing.T) {
config := testsetup.NewFeatureConfig("jwt", "pretty", true)
config := testsetup.NewFeatureConfig("jwt", "pretty", false)
suite := testsetup.CreateTestSuite(t, config, "dance-lessons-coach BDD Tests - JWT Feature")
if suite.Run() != 0 {

View File

@@ -14,6 +14,15 @@ import (
"github.com/cucumber/godog"
)
// getWorkingDir returns the current working directory
func getWorkingDir() string {
dir, err := os.Getwd()
if err != nil {
return "unknown"
}
return dir
}
// FeatureConfig holds configuration for a feature test
type FeatureConfig struct {
FeatureName string
@@ -141,13 +150,22 @@ func CreateTestSuite(t *testing.T, config *FeatureConfig, suiteName string) godo
stopOnFailure, _ = strconv.ParseBool(envStop)
}
// Determine the correct path for feature files
// When running from within a feature directory, use "." to find feature files in current dir
// When running from outside, use the feature name as a relative path
featurePath := "."
if workingDir := getWorkingDir(); !strings.HasSuffix(workingDir, "/"+config.FeatureName) && !strings.HasSuffix(workingDir, "\\"+config.FeatureName) {
// Not running from within the feature directory, use feature name
featurePath = config.FeatureName
}
return godog.TestSuite{
Name: suiteName,
TestSuiteInitializer: bdd.InitializeTestSuite,
ScenarioInitializer: bdd.InitializeScenario,
Options: &godog.Options{
Format: config.Format,
Paths: []string{"."},
Paths: []string{featurePath},
TestingT: t,
Strict: true,
Randomize: -1,