Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion affected-tests-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,40 @@ configurations {
functionalTestRuntimeOnly.extendsFrom testRuntimeOnly
}

dependencies {
// Cucumber-JVM + JUnit Platform Suite power the human-readable e2e
// scenario layer under src/functionalTest/resources/.../features.
// Every feature scenario spawns a real Gradle TestKit build so the
// assertions cover the exact plugin surface consumers like
// security-service see, not just the decision engine. See
// RunCucumberFunctionalTest for the JUnit Platform Suite entrypoint.
functionalTestImplementation 'io.cucumber:cucumber-java:7.25.0'
functionalTestImplementation 'io.cucumber:cucumber-junit-platform-engine:7.25.0'
// Required so Cucumber can constructor-inject the shared `World`
// into step-def classes; without a DI container, CucumberException
// "No suitable constructor" blows up at scenario discovery time.
functionalTestImplementation 'io.cucumber:cucumber-picocontainer:7.25.0'
functionalTestImplementation 'org.junit.platform:junit-platform-suite:1.14.3'
// JGit mirrors the way the core engine tests construct temp repos —
// reusing the same dependency means the feature-file scenarios build
// history with the exact semantics the engine will later parse.
functionalTestImplementation 'org.eclipse.jgit:org.eclipse.jgit:7.6.0.202603022253-r'
}

tasks.register('functionalTest', Test) {
description = 'Runs functional tests with Gradle TestKit.'
description = 'Runs functional tests with Gradle TestKit, including Cucumber e2e scenarios.'
group = 'verification'
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
useJUnitPlatform()

// Cucumber-JVM's JUnit Platform engine scans the classpath resources of
// the running test JVM for .feature files. Without this, feature files
// placed under src/functionalTest/resources are packaged into the
// classpath but the engine still needs glue-code packages pointed at
// explicitly so step definitions get picked up deterministically.
systemProperty 'cucumber.glue', 'io.affectedtests.gradle.e2e.steps'
systemProperty 'cucumber.publish.quiet', 'true'
}

tasks.named('check') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.affectedtests.gradle.e2e;

import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;

/**
* JUnit 5 Platform Suite entrypoint for the Cucumber e2e feature files.
*
* <p>Every feature file under {@code src/functionalTest/resources/io/affectedtests/gradle/e2e/features}
* is discovered by the Cucumber JUnit Platform engine at test time. Each
* scenario spawns a real Gradle TestKit build via {@link TestProject}, so
* the assertions cover the exact plugin surface that consumer builds like
* {@code security-service} see in production, not just the decision
* engine in isolation.
*
* <p>The suite is deliberately split across multiple {@code .feature}
* files (pilot scenarios, the Mode x Situation matrix, security-service
* consumer shape, DSL migration errors, edge cases). Splitting by theme
* keeps feature files self-contained — a reviewer landing in
* {@code 02-mode-situation-matrix.feature} sees every default action
* cell in one place without having to cross-reference other files.
*
* <p>Glue packages point at {@code steps/} so step definitions are
* discovered deterministically regardless of package scanning order.
*/
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("io/affectedtests/gradle/e2e/features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "io.affectedtests.gradle.e2e.steps")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty,summary")
public class RunCucumberFunctionalTest {
}
Loading