GH-31 - Support for optimized test execution.

Initital prototype to support optimized test execution based on the Spring Modulith application module model. The change introduces a new artifact spring-modulith-junit that extends JUnit's test execution lifecycle. It obtains the ApplicationModules model for the application and potentially skips test classes for execution in case the changes made to the application reside in modules the current test case's module does not depend on.

Co-authored-by: Lukas Dohmen <l.dohmen@yahoo.de>
Co-authored-by: David Bilge <david.bilge@gmail.com>
This commit is contained in:
Lukas Dohmen
2024-02-22 20:50:47 +01:00
committed by Oliver Drotbohm
parent db4ab8f55d
commit 8cf3920af9
19 changed files with 630 additions and 13 deletions

View File

@@ -16,7 +16,6 @@
package example.order;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.modulith.test.ApplicationModuleTest;
import org.springframework.modulith.test.Scenario;
@@ -28,16 +27,16 @@ import org.springframework.modulith.test.Scenario;
@RequiredArgsConstructor
class OrderIntegrationTests {
private final OrderManagement orders;
private final OrderManagement orders;
@Test
void publishesOrderCompletion(Scenario scenario) {
@Test
void publishesOrderCompletion(Scenario scenario) {
// this is a change
var reference = new Order();
var reference = new Order();
scenario.stimulate(() -> orders.complete(reference))
.andWaitForEventOfType(OrderCompleted.class)
.matchingMappedValue(OrderCompleted::orderId, reference.getId())
.toArrive();
}
scenario.stimulate(() -> orders.complete(reference))
.andWaitForEventOfType(OrderCompleted.class)
.matchingMappedValue(OrderCompleted::orderId, reference.getId())
.toArrive();
}
}