Cucumber-style E2E scenarios covering consumer-shape and edge cases#36
Merged
vedanthvdev merged 1 commit intomasterfrom Apr 23, 2026
Merged
Cucumber-style E2E scenarios covering consumer-shape and edge cases#36vedanthvdev merged 1 commit intomasterfrom
vedanthvdev merged 1 commit intomasterfrom
Conversation
…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.
c90c8af to
2656475
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 --explainvia TestKit, and assertsagainst the header lines in the
--explaintrace — so regressions in theresolved decision, not just supporting matrix text, are caught.
Coverage — 44 scenarios, 0 failures, ~15s wall time
01-pilot-scenarios.featureEMPTY_DIFF,DISCOVERY_SUCCESS,UNMAPPED_FILE,ALL_FILES_IGNORED,ALL_FILES_OUT_OF_SCOPE,DISCOVERY_EMPTY02-mode-situation-matrix.featureLOCAL,CI,STRICT03-security-service-shape.featureoutOfScopeTestDirsglobs, customtestSuffixes,transitiveDepth, multi-module routing04-dsl-migration-errors.featurerunAllIfNoMatches,runAllOnNonJavaChange,excludePaths, negativegradlewTimeoutSeconds05-edge-cases.featureSTRICTonEMPTY_DIFFHarness design
TestProject— JGit-backed consumer project. PassesbaseRefvia-PaffectedTestsBaseRefrather than baking it intobuild.gradle, sobuild-script rewrites never leak into the diff.
World— PicoContainer-injected per-scenario state; handles lazyproject init and cleanup.
CommonSteps— Thin Given/When/Then glue that delegates Git/Gradleoperations to
TestProjectand asserts against--explainheaderlines (
Situation:,Action:,Outcome:) instead of the matrixexplanation block — so assertions pin the resolved decision, not
unrelated boilerplate.
.gitignore— The baseline project ignores.gradle/andbuild/so TestKit's own scratch output never surfaces inincludeUncommitted=true/includeStaged=truescenarios asunmapped files.
CI integration
checkalready depends onfunctionalTestinaffected-tests-gradle/build.gradle, so.github/workflows/ci.ymlpicks this up for free on every PR to
master.Test plan
./gradlew :affected-tests-gradle:functionalTest→ 44 passed, 0 failed