Files
cleveragents-core/features/wf02_test_generation.feature
T
brent.edwards 183fe363bf
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 3m50s
CI / quality (pull_request) Successful in 4m15s
CI / typecheck (pull_request) Successful in 4m35s
CI / security (pull_request) Successful in 4m46s
CI / unit_tests (pull_request) Successful in 9m49s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 13m13s
CI / e2e_tests (pull_request) Successful in 19m12s
CI / integration_tests (pull_request) Successful in 24m56s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 55m21s
test(integration): workflow example 2 — automated test generation for a module (trusted profile)
Add a dedicated WF02 Robot integration suite plus helper tooling to validate trusted-profile automated test generation under mocked providers. The tests assert lifecycle gating behavior, deterministic artifact-only test generation for a low-coverage module, and coverage validation fail/pass enforcement without modifying production source paths.

ISSUES CLOSED: #766
2026-04-01 01:18:47 +00:00

70 lines
3.6 KiB
Gherkin

@wf02 @test_generation @trusted
Feature: WF02 automated test generation for a module (trusted profile)
As a developer using the trusted automation profile
I want the system to generate tests for an under-covered module
So that coverage improves without modifying production source code
# --------------------------------------------------------------------------
# AC1: Trusted profile lifecycle gating (auto-run strategize + execute,
# human gate on apply)
# --------------------------------------------------------------------------
Scenario: Trusted profile auto-runs strategize and execute phases
Given a WF02 lifecycle service with mock providers
And the WF02 action "local/generate-tests" is registered
And a trusted-profile plan for module "src/auth" with coverage target 80
When I auto-run the WF02 plan
Then the plan should be in the execute phase
And the plan processing state should be complete
And the plan automation profile should be "trusted"
# --------------------------------------------------------------------------
# AC2: Action definition carries correct invariants
# --------------------------------------------------------------------------
Scenario: WF02 action carries production-code and naming invariants
Given a WF02 lifecycle service with mock providers
And the WF02 action "local/generate-tests" is registered
And a trusted-profile plan for module "src/auth" with coverage target 80
Then the plan should carry an invariant containing "Do not modify any production code"
And the plan should carry an invariant containing "test file naming convention"
And the plan should carry an invariant containing "test fixtures and conftest.py patterns"
# --------------------------------------------------------------------------
# AC3: Path safety guardrails reject unsafe output destinations
# --------------------------------------------------------------------------
Scenario: Path guardrail rejects absolute paths
Given a temporary WF02 fixture repository
When I validate the generated path "/tmp/test_abs.py"
Then the path should be rejected with reason "must be relative"
Scenario: Path guardrail rejects traversal paths
Given a temporary WF02 fixture repository
When I validate the generated path "../tests/test_escape.py"
Then the path should be rejected with reason "escapes fixture root"
Scenario: Path guardrail rejects non-test destinations
Given a temporary WF02 fixture repository
When I validate the generated path "src/test_not_allowed.py"
Then the path should be rejected with reason "must stay in tests/"
Scenario: Path guardrail accepts valid test paths
Given a temporary WF02 fixture repository
When I validate the generated path "tests/test_auth_new.py"
Then the path should be accepted
# --------------------------------------------------------------------------
# AC4: Generated artifacts follow naming and scope conventions
# --------------------------------------------------------------------------
Scenario: Generated test files follow project conventions
Given a WF02 lifecycle service with mock providers
And the WF02 action "local/generate-tests" is registered
And a trusted-profile plan for module "src/auth" with coverage target 80
When I generate tests from the mock provider with coverage suite
Then all generated file paths should start with "tests/"
And all generated file paths should end with ".py"
And all generated file names should start with "test_"
And no generated file path should start with "src/"