🧪 test: add JWT secret rotation BDD scenarios and step implementations #12
@@ -32,6 +32,21 @@ Used to exclude tests from execution:
|
|||||||
- `@todo` - Tests with pending step implementations
|
- `@todo` - Tests with pending step implementations
|
||||||
- `@skip` - Tests that should be skipped entirely
|
- `@skip` - Tests that should be skipped entirely
|
||||||
|
|
||||||
|
### Work In Progress Tag
|
||||||
|
Used to override exclusions for active development:
|
||||||
|
- `@wip` - Work In Progress - overrides exclusion tags to allow focused development
|
||||||
|
|
||||||
|
**Usage:** Add `@wip` to scenarios you're actively working on, even if they have other exclusion tags like `@todo` or `@skip`. The `@wip` tag takes precedence and allows the scenario to run.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```gherkin
|
||||||
|
@todo @wip
|
||||||
|
Scenario: JWT authentication with multiple secrets
|
||||||
|
Given the server is running with multiple JWT secrets
|
||||||
|
When I authenticate with valid credentials
|
||||||
|
Then I should receive a valid JWT token
|
||||||
|
```
|
||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
### Running Smoke Tests
|
### Running Smoke Tests
|
||||||
@@ -159,6 +174,7 @@ Feature: Health Endpoint
|
|||||||
| `@flaky` | Exclude flaky tests | `@flaky` on unstable scenarios |
|
| `@flaky` | Exclude flaky tests | `@flaky` on unstable scenarios |
|
||||||
| `@todo` | Exclude pending tests | `@todo` on unimplemented scenarios |
|
| `@todo` | Exclude pending tests | `@todo` on unimplemented scenarios |
|
||||||
| `@skip` | Exclude tests entirely | `@skip` on disabled scenarios |
|
| `@skip` | Exclude tests entirely | `@skip` on disabled scenarios |
|
||||||
|
| `@wip` | Work in progress | `@wip` on actively developed scenarios |
|
||||||
|
|
||||||
## Future Enhancements
|
## Future Enhancements
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestAuthBDD(t *testing.T) {
|
|||||||
Strict: true,
|
Strict: true,
|
||||||
Randomize: -1,
|
Randomize: -1,
|
||||||
StopOnFailure: true,
|
StopOnFailure: true,
|
||||||
Tags: "~@flaky && ~@todo && ~@skip",
|
Tags: "~@flaky && ~@todo && ~@skip && @wip",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestConfigBDD(t *testing.T) {
|
|||||||
Strict: true,
|
Strict: true,
|
||||||
Randomize: -1,
|
Randomize: -1,
|
||||||
StopOnFailure: false,
|
StopOnFailure: false,
|
||||||
Tags: "~@flaky && ~@todo && ~@skip",
|
Tags: "~@flaky && ~@todo && ~@skip && @wip",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestGreetBDD(t *testing.T) {
|
|||||||
Strict: true,
|
Strict: true,
|
||||||
Randomize: -1,
|
Randomize: -1,
|
||||||
StopOnFailure: true,
|
StopOnFailure: true,
|
||||||
Tags: "~@flaky && ~@todo && ~@skip",
|
Tags: "~@flaky && ~@todo && ~@skip && @wip",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestHealthBDD(t *testing.T) {
|
|||||||
Strict: true,
|
Strict: true,
|
||||||
Randomize: -1,
|
Randomize: -1,
|
||||||
StopOnFailure: true,
|
StopOnFailure: true,
|
||||||
Tags: "~@flaky && ~@todo && ~@skip",
|
Tags: "~@flaky && ~@todo && ~@skip && @wip",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestJWTBDD(t *testing.T) {
|
|||||||
Strict: true,
|
Strict: true,
|
||||||
Randomize: -1,
|
Randomize: -1,
|
||||||
StopOnFailure: true,
|
StopOnFailure: true,
|
||||||
Tags: "~@flaky && ~@todo && ~@skip",
|
Tags: "~@flaky && ~@todo && ~@skip && @wip",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ run_tests_with_tags() {
|
|||||||
set +e
|
set +e
|
||||||
|
|
||||||
if [ -n "$tags" ]; then
|
if [ -n "$tags" ]; then
|
||||||
# Use godog directly for tag filtering with exclusion
|
# Use godog directly for tag filtering with exclusion and WIP inclusion
|
||||||
echo "🚀 Running: godog $tags --tags=~@flaky --tags=~@todo --tags=~@skip features/"
|
echo "🚀 Running: godog $tags --tags=~@flaky --tags=~@todo --tags=~@skip --tags=@wip features/"
|
||||||
test_output=$(godog $tags --tags=~@flaky --tags=~@todo --tags=~@skip features/ 2>&1)
|
test_output=$(godog $tags --tags=~@flaky --tags=~@todo --tags=~@skip --tags=@wip features/ 2>&1)
|
||||||
else
|
else
|
||||||
# Use go test for full test suite with tag exclusion
|
# Use go test for full test suite with tag exclusion and WIP inclusion
|
||||||
echo "🚀 Running: go test ./features/... -tags=~@flaky,~@todo,~@skip"
|
echo "🚀 Running: go test ./features/... -tags=~@flaky,~@todo,~@skip,@wip"
|
||||||
test_output=$(go test ./features/... -tags=~@flaky,~@todo,~@skip -v -cover -coverpkg=./... -coverprofile=coverage.out 2>&1)
|
test_output=$(go test ./features/... -tags=~@flaky,~@todo,~@skip,@wip -v -cover -coverpkg=./... -coverprofile=coverage.out 2>&1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_exit_code=$?
|
test_exit_code=$?
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ run_feature_test() {
|
|||||||
docker exec dance-lessons-coach-postgres createdb -U postgres "${DLC_DATABASE_NAME}"
|
docker exec dance-lessons-coach-postgres createdb -U postgres "${DLC_DATABASE_NAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the feature tests with tag exclusion
|
# Run the feature tests with tag exclusion and WIP inclusion
|
||||||
cd "features/${feature_name}"
|
cd "features/${feature_name}"
|
||||||
FEATURE=${feature_name} DLC_DATABASE_NAME="${DLC_DATABASE_NAME}" go test -v . -tags="~@flaky && ~@todo && ~@skip" 2>&1 | grep -E "(PASS|FAIL|RUN)" || true
|
FEATURE=${feature_name} DLC_DATABASE_NAME="${DLC_DATABASE_NAME}" go test -v . -tags="~@flaky && ~@todo && ~@skip && @wip" 2>&1 | grep -E "(PASS|FAIL|RUN)" || true
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ run_feature_tests() {
|
|||||||
|
|
||||||
# Run tests with proper coverage measurement and tag exclusion
|
# Run tests with proper coverage measurement and tag exclusion
|
||||||
set +e
|
set +e
|
||||||
test_output=$(go test ./features/${FEATURE}/... -tags=~@flaky,~@todo,~@skip -v -cover -coverpkg=./... -coverprofile=coverage-${FEATURE}.out 2>&1)
|
test_output=$(go test ./features/${FEATURE}/... -tags=~@flaky,~@todo,~@skip,@wip -v -cover -coverpkg=./... -coverprofile=coverage-${FEATURE}.out 2>&1)
|
||||||
test_exit_code=$?
|
test_exit_code=$?
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user