Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Cucumber Tests in a AWS Lambda Function #2950

Open
osadalakmal opened this issue Dec 2, 2024 · 1 comment
Open

Running Cucumber Tests in a AWS Lambda Function #2950

osadalakmal opened this issue Dec 2, 2024 · 1 comment

Comments

@osadalakmal
Copy link

👓 What did you see?

I am trying to run cucmber tests as an AWS lambda function using Java. When I invoke it as

       try {
            String tags = (String) input.getOrDefault("tags", "@mytests");
            String[] cucumberArgs = new String[]{
                    "--glue", "com.example", // Path to step definitions
                    "classpath:resources/features",     // Path to feature files
                    "--strict",
                    "--tags", tags, // Tags to filter tests
            };

            System.out.println("Tests going to be run now");
            Main.run(cucumberArgs, Thread.currentThread().getContextClassLoader());
            System.out.println("Tests completed successfully");
            return "Tests completed successfully.";
        } catch (Throwable e) {
            e.printStackTrace();
            return "Error running tests: " + e.getMessage();
        }

The lambda function just exists and no logs are printed in localstack container except for "Tests going to be run now". Has anyone tried this before? Is it supported?

✅ What did you expect to see?

I expected it to run the tests just line a normal command line handler would. When I tried creating a standalone jar file and using that to run the tests, it worked fine.

📦 Which tool/library version are you using?

java-17
cucumber 5.7.0

🔬 How could we reproduce it?

  1. Take any cumber project
  2. Add a runner extending lambda request handler with above code as the handler
  3. package as a jar and use localstack to create a lambda
  4. invoke the lambda to run the cucmber tests

📚 Any additional context?

No response

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Dec 2, 2024

You're running on a JVM, so it should work. So no clue.

You may well be running out of memory. I think the default on AWS was 128MiB.

So either the lambda is killed before more is logged or perhaps with the exception being swallowed nothing else is logged and the system hangs. Try with the latest version it's gotten slightly better at immediately rethrowing out of memory exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants