My team is running e2e tests inside Lambda, using JUnit 5, executed programmatically in a Java Lambda as opposed to the usual "mvn test" method.
Now that we have it working, there's an ask to modularize it for other teams to reuse. They just want to write tests and have something common to run it. The common thing would be our lambda that runs:
import org.junit.platform.launcher.LauncherDiscoveryRequest;
...
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors(selectPackage("com.example.test")
.build();
launcher.execute(request);
So we want to have teams just write JUnit tests and send it to our lambda, passing in an input in place of "com.example.test". And of course the actual test classes.
We build with Gradle, deploy with Terraform in Gitlab CI/CD.
I looked into Lambda extensions (as opposed to layers because we're using container images for Lambda) but not sure if it's suitable. Has anyone done something similar? Did you use Lambda extensions?
I’m past the stackoverflow link; already have JUnit 5 working in a lambda. Question is about extracting a common code into potentially an extension container image.