diff --git a/features/auth/auth_test.go b/features/auth/auth_test.go index 39e698a..e627aa0 100644 --- a/features/auth/auth_test.go +++ b/features/auth/auth_test.go @@ -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 { diff --git a/features/greet/greet_test.go b/features/greet/greet_test.go index 2208fdc..f1f482d 100644 --- a/features/greet/greet_test.go +++ b/features/greet/greet_test.go @@ -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 { diff --git a/features/health/health_test.go b/features/health/health_test.go index 536630c..621fa25 100644 --- a/features/health/health_test.go +++ b/features/health/health_test.go @@ -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 { diff --git a/features/jwt/jwt_secret_retention.feature b/features/jwt/jwt_secret_retention.feature index 1905a0e..f915cd5 100644 --- a/features/jwt/jwt_secret_retention.feature +++ b/features/jwt/jwt_secret_retention.feature @@ -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 diff --git a/features/jwt/jwt_test.go b/features/jwt/jwt_test.go index e1fb5e2..8c9472e 100644 --- a/features/jwt/jwt_test.go +++ b/features/jwt/jwt_test.go @@ -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 { diff --git a/pkg/bdd/testsetup/testsetup.go b/pkg/bdd/testsetup/testsetup.go index 611c52d..85756ee 100644 --- a/pkg/bdd/testsetup/testsetup.go +++ b/pkg/bdd/testsetup/testsetup.go @@ -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,