diff --git a/features/BDD_TAGS.md b/features/BDD_TAGS.md index 8b75c15..b2099e3 100644 --- a/features/BDD_TAGS.md +++ b/features/BDD_TAGS.md @@ -47,6 +47,26 @@ Scenario: JWT authentication with multiple secrets Then I should receive a valid JWT token ``` +### Command-Line Tag Override +You can override the default tag filtering by setting the `GODOG_TAGS` environment variable when running tests. + +**Usage:** +```bash +# Run only @wip scenarios +GODOG_TAGS="@wip" go test ./features/jwt/... + +# Run smoke tests only +GODOG_TAGS="@smoke" go test ./features/... + +# Run specific combination +GODOG_TAGS="@jwt && ~@todo" go test ./features/... + +# Combine with other environment variables +DLC_DATABASE_HOST=localhost GODOG_TAGS="@wip" go test ./features/jwt/... +``` + +**Default Behavior:** If `GODOG_TAGS` is not set, the test uses the default tag filter: `~@flaky && ~@todo && ~@skip && @wip` + ## Usage Examples ### Running Smoke Tests diff --git a/features/auth/auth_test.go b/features/auth/auth_test.go index b2b28e6..5e27f8d 100644 --- a/features/auth/auth_test.go +++ b/features/auth/auth_test.go @@ -13,6 +13,13 @@ func TestAuthBDD(t *testing.T) { // Set FEATURE environment variable for feature-specific configuration os.Setenv("FEATURE", "auth") + // Allow tag override via environment variable + tags := os.Getenv("GODOG_TAGS") + if tags == "" { + // Default tags if not overridden + tags = "~@flaky && ~@todo && ~@skip && @wip" + } + suite := godog.TestSuite{ Name: "dance-lessons-coach BDD Tests - Auth Feature", TestSuiteInitializer: bdd.InitializeTestSuite, @@ -24,7 +31,7 @@ func TestAuthBDD(t *testing.T) { Strict: true, Randomize: -1, StopOnFailure: true, - Tags: "~@flaky && ~@todo && ~@skip && @wip", + Tags: tags, }, } diff --git a/features/config/config_test.go b/features/config/config_test.go index 0e4eaaa..1dfdfd4 100644 --- a/features/config/config_test.go +++ b/features/config/config_test.go @@ -13,6 +13,13 @@ func TestConfigBDD(t *testing.T) { // Set FEATURE environment variable for feature-specific configuration os.Setenv("FEATURE", "config") + // Allow tag override via environment variable + tags := os.Getenv("GODOG_TAGS") + if tags == "" { + // Default tags if not overridden + tags = "~@flaky && ~@todo && ~@skip && @wip" + } + suite := godog.TestSuite{ Name: "dance-lessons-coach BDD Tests - Config Feature", TestSuiteInitializer: bdd.InitializeTestSuite, @@ -24,7 +31,7 @@ func TestConfigBDD(t *testing.T) { Strict: true, Randomize: -1, StopOnFailure: false, - Tags: "~@flaky && ~@todo && ~@skip && @wip", + Tags: tags, }, } diff --git a/features/greet/greet_test.go b/features/greet/greet_test.go index 0be53e9..f370ec6 100644 --- a/features/greet/greet_test.go +++ b/features/greet/greet_test.go @@ -13,6 +13,13 @@ func TestGreetBDD(t *testing.T) { // Set FEATURE environment variable for feature-specific configuration os.Setenv("FEATURE", "greet") + // Allow tag override via environment variable + tags := os.Getenv("GODOG_TAGS") + if tags == "" { + // Default tags if not overridden + tags = "~@flaky && ~@todo && ~@skip && @wip" + } + suite := godog.TestSuite{ Name: "dance-lessons-coach BDD Tests - Greet Feature", TestSuiteInitializer: bdd.InitializeTestSuite, @@ -24,7 +31,7 @@ func TestGreetBDD(t *testing.T) { Strict: true, Randomize: -1, StopOnFailure: true, - Tags: "~@flaky && ~@todo && ~@skip && @wip", + Tags: tags, }, } diff --git a/features/health/health_test.go b/features/health/health_test.go index 6ca35d5..a07bee3 100644 --- a/features/health/health_test.go +++ b/features/health/health_test.go @@ -13,6 +13,13 @@ func TestHealthBDD(t *testing.T) { // Set FEATURE environment variable for feature-specific configuration os.Setenv("FEATURE", "health") + // Allow tag override via environment variable + tags := os.Getenv("GODOG_TAGS") + if tags == "" { + // Default tags if not overridden + tags = "~@flaky && ~@todo && ~@skip && @wip" + } + suite := godog.TestSuite{ Name: "dance-lessons-coach BDD Tests - Health Feature", TestSuiteInitializer: bdd.InitializeTestSuite, @@ -24,7 +31,7 @@ func TestHealthBDD(t *testing.T) { Strict: true, Randomize: -1, StopOnFailure: true, - Tags: "~@flaky && ~@todo && ~@skip && @wip", + Tags: tags, }, } diff --git a/features/jwt/jwt_secret_rotation.feature b/features/jwt/jwt_secret_rotation.feature index 04b6d05..b439ed5 100644 --- a/features/jwt/jwt_secret_rotation.feature +++ b/features/jwt/jwt_secret_rotation.feature @@ -4,7 +4,7 @@ Feature: JWT Secret Rotation I want to rotate JWT secrets without disrupting users So that we can maintain security while ensuring continuous service - @todo + @wip Scenario: Authentication with multiple valid JWT secrets Given the server is running with multiple JWT secrets And a user "multiuser" exists with password "testpass123" diff --git a/features/jwt/jwt_test.go b/features/jwt/jwt_test.go index 25a0038..b48a026 100644 --- a/features/jwt/jwt_test.go +++ b/features/jwt/jwt_test.go @@ -13,6 +13,13 @@ func TestJWTBDD(t *testing.T) { // Set FEATURE environment variable for feature-specific configuration os.Setenv("FEATURE", "jwt") + // Allow tag override via environment variable + tags := os.Getenv("GODOG_TAGS") + if tags == "" { + // Default tags if not overridden + tags = "~@flaky && ~@todo && ~@skip && @wip" + } + suite := godog.TestSuite{ Name: "dance-lessons-coach BDD Tests - JWT Feature", TestSuiteInitializer: bdd.InitializeTestSuite, @@ -24,7 +31,7 @@ func TestJWTBDD(t *testing.T) { Strict: true, Randomize: -1, StopOnFailure: true, - Tags: "~@flaky && ~@todo && ~@skip && @wip", + Tags: tags, }, }