Running JUnit 5 end-to-end tests in Lambda?

0

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?

1 Answer
0

Hi, you have the full recipe here: https://stackoverflow.com/questions/57382182/running-junit-test-on-aws-lambda-java-lang-exception-no-runnable-methods

Read until the end to get all points to the solution

profile pictureAWS
EXPERT
answered a year ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions