🧪 test: add GODOG_STOP_ON_FAILURE environment variable support
- Add GODOG_STOP_ON_FAILURE environment variable to all test suites - Maintain feature-specific defaults for stop on failure behavior - JWT, Greet, Auth, Health: stop on failure by default (true) - Config, All Features: continue after failures by default (false) - Allow runtime override via environment variable - Update BDD_TAGS.md with usage examples and defaults - Support boolean values: true, false, 1, 0 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistralai.com>
This commit is contained in:
@@ -65,7 +65,26 @@ GODOG_TAGS="@jwt && ~@todo" go test ./features/...
|
||||
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`
|
||||
### Stop On Failure Control
|
||||
You can control whether tests stop on first failure using the `GODOG_STOP_ON_FAILURE` environment variable.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
# Stop on first failure (strict mode)
|
||||
GODOG_STOP_ON_FAILURE="true" go test ./features/jwt/...
|
||||
|
||||
# Continue after failures (lenient mode)
|
||||
GODOG_STOP_ON_FAILURE="false" go test ./features/jwt/...
|
||||
|
||||
# Combine with tag filtering
|
||||
GODOG_TAGS="@wip" GODOG_STOP_ON_FAILURE="true" go test ./features/jwt/...
|
||||
```
|
||||
|
||||
**Default Behavior:**
|
||||
- If `GODOG_TAGS` is not set, the test uses the default tag filter: `~@flaky && ~@todo && ~@skip`
|
||||
- If `GODOG_STOP_ON_FAILURE` is not set, each feature uses its default:
|
||||
- `jwt`, `greet`, `auth`, `health`: `true` (stop on failure)
|
||||
- `config`, `all features`: `false` (continue after failures)
|
||||
|
||||
## Usage Examples
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ func TestAuthBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := true // Default for auth tests
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: "dance-lessons-coach BDD Tests - Auth Feature",
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -30,7 +36,7 @@ func TestAuthBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@ func TestBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := false // Default for all features test (don't stop on failure)
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: suiteName,
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -49,7 +55,7 @@ func TestBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ func TestConfigBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := false // Default for config tests (don't stop on failure)
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: "dance-lessons-coach BDD Tests - Config Feature",
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -30,7 +36,7 @@ func TestConfigBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ func TestGreetBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := true // Default for greet tests
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: "dance-lessons-coach BDD Tests - Greet Feature",
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -30,7 +36,7 @@ func TestGreetBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ func TestHealthBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := true // Default for health tests
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: "dance-lessons-coach BDD Tests - Health Feature",
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -30,7 +36,7 @@ func TestHealthBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ func TestJWTBDD(t *testing.T) {
|
||||
tags = "~@flaky && ~@todo && ~@skip"
|
||||
}
|
||||
|
||||
// Allow stop on failure override via environment variable
|
||||
stopOnFailure := true // Default for JWT tests
|
||||
if envStop := os.Getenv("GODOG_STOP_ON_FAILURE"); envStop != "" {
|
||||
stopOnFailure = envStop == "true" || envStop == "1"
|
||||
}
|
||||
|
||||
suite := godog.TestSuite{
|
||||
Name: "dance-lessons-coach BDD Tests - JWT Feature",
|
||||
TestSuiteInitializer: bdd.InitializeTestSuite,
|
||||
@@ -30,7 +36,7 @@ func TestJWTBDD(t *testing.T) {
|
||||
TestingT: t,
|
||||
Strict: true,
|
||||
Randomize: -1,
|
||||
StopOnFailure: false,
|
||||
StopOnFailure: stopOnFailure,
|
||||
Tags: tags,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user