Skip to content

Cucumber-style E2E scenarios covering consumer-shape and edge cases#36

Merged
vedanthvdev merged 1 commit intomasterfrom
feat/cucumber-e2e-scenarios
Apr 23, 2026
Merged

Cucumber-style E2E scenarios covering consumer-shape and edge cases#36
vedanthvdev merged 1 commit intomasterfrom
feat/cucumber-e2e-scenarios

Conversation

@vedanthvdev
Copy link
Copy Markdown
Owner

Summary

Adds a Gherkin-based E2E test layer on top of the existing unit/integration
suite so the plugin's decision matrix, situation/action resolution, and
consumer-facing DSL are exercised via real Gradle TestKit builds. Each
scenario spins up a temporary JGit-managed project, commits a baseline,
layers a canned diff, runs affectedTest --explain via TestKit, and asserts
against the header lines in the --explain trace — so regressions in the
resolved decision, not just supporting matrix text, are caught.

Coverage — 44 scenarios, 0 failures, ~15s wall time

Feature file Scenarios What it pins
01-pilot-scenarios.feature 10 Pilot situations: EMPTY_DIFF, DISCOVERY_SUCCESS, UNMAPPED_FILE, ALL_FILES_IGNORED, ALL_FILES_OUT_OF_SCOPE, DISCOVERY_EMPTY
02-mode-situation-matrix.feature 21 (7×3 outline) Full mode/situation matrix — every situation across LOCAL, CI, STRICT
03-security-service-shape.feature 4 Shape of a real consumer: nested outOfScopeTestDirs globs, custom testSuffixes, transitiveDepth, multi-module routing
04-dsl-migration-errors.feature 4 v1→v2 migration hints: runAllIfNoMatches, runAllOnNonJavaChange, excludePaths, negative gradlewTimeoutSeconds
05-edge-cases.feature 5 Rename detection, uncommitted vs staged vs committed diff tiers, STRICT on EMPTY_DIFF

Harness design

  • TestProject — JGit-backed consumer project. Passes baseRef via
    -PaffectedTestsBaseRef rather than baking it into build.gradle, so
    build-script rewrites never leak into the diff.
  • World — PicoContainer-injected per-scenario state; handles lazy
    project init and cleanup.
  • CommonSteps — Thin Given/When/Then glue that delegates Git/Gradle
    operations to TestProject and asserts against --explain header
    lines (Situation:, Action:, Outcome:) instead of the matrix
    explanation block — so assertions pin the resolved decision, not
    unrelated boilerplate.
  • Baseline .gitignore — The baseline project ignores .gradle/ and
    build/ so TestKit's own scratch output never surfaces in
    includeUncommitted=true / includeStaged=true scenarios as
    unmapped files.

CI integration

check already depends on functionalTest in
affected-tests-gradle/build.gradle, so .github/workflows/ci.yml
picks this up for free on every PR to master.

Test plan

  • Local run: ./gradlew :affected-tests-gradle:functionalTest → 44 passed, 0 failed
  • CI green on this PR before merge

…er scenarios

Adds a human-readable E2E layer on top of the existing unit/integration suite so
the plugin's decision matrix, situation/action resolution, and consumer-facing
DSL are all exercised via real Gradle TestKit builds driven by Gherkin feature
files. Each scenario constructs a temporary JGit-managed project, commits a
baseline, layers a canned diff, runs affectedTest --explain via TestKit, and
asserts against the --explain header lines so we pin the resolved decision
rather than any supporting matrix text.

Coverage spans 44 scenarios across five feature files: pilot situations
(EMPTY_DIFF, DISCOVERY_SUCCESS, UNMAPPED_FILE, ALL_FILES_IGNORED,
ALL_FILES_OUT_OF_SCOPE, DISCOVERY_EMPTY), the full 7x3 mode/situation matrix
(LOCAL/CI/STRICT across every situation) as Scenario Outlines, security-service
shape configurations (nested outOfScopeTestDirs globs, custom testSuffixes,
transitiveDepth, multi-module routing), v1-to-v2 DSL migration errors
(runAllIfNoMatches, runAllOnNonJavaChange, excludePaths, negative
gradlewTimeoutSeconds), and edge cases (rename detection, uncommitted and
staged working-tree visibility, STRICT on EMPTY_DIFF). The harness centres on
TestProject, World, and CommonSteps — TestProject passes baseRef via
-PaffectedTestsBaseRef to avoid build-script mutations leaking into the diff,
and ignores .gradle/ and build/ in the baseline so TestKit's own scratch
output never pollutes uncommitted/staged scenarios. Wall time is ~15s total
thanks to TestKit daemon reuse and -x compileJava on every invocation, so
the CI check task stays fast.
@vedanthvdev vedanthvdev force-pushed the feat/cucumber-e2e-scenarios branch from c90c8af to 2656475 Compare April 23, 2026 14:22
@vedanthvdev vedanthvdev merged commit 43d3f07 into master Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant