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?

gefragt vor einem Jahr550 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor einem Jahr
  • 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.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen