- Download the latest release - java_lambda_function.zip
- Upload the release zip into an s3 bucket and copy the link for the file.
- Create a new Lambda Function in AWS with the following name
lambda-selenium-functionNote: for the tests to execute this name is required
Change the settings of the Lambda Function
- Set the Runtime to Java 8
- Set the Handler to com.blackboard.testing.lambda.LambdaTestHandler::handleRequest
- Set the Memory to 1536 MB
- Set the Timeout to 5 min
- Set the Code entry type to Upload a file from Amazon S3
- Paste in the location of the package previously uploaded into the S3 link URL
- Save the changes
Note: S3 is required because of the size of the package.
Now the function is ready to be invoked.
Use shell commands to clone the repository and change the working directory to the Java example
git clone [email protected]:blackboard/lambda-selenium.git
cd lambda-selenium/lambda-selenium-java/Next, run the test suite 'ExampleTestSuite' inside the same shell :
gradle clean testWhen the tests are ran, they will be executed in parallel by invoking the Lambda function that was created. Once the tests are complete, open folder './build/screenshots' to view screenshots taken inside the running tests. If a test fails, the exception will be thrown for the test case and logged to the console.
To package the jar, run the following command inside the lambda-selenium-java directory
gradle clean unzipLibs shadowJarThis will package all of the required dependencies and code within the jar file. The libraries that we included in the resources folder will also be included in this jar. Once the jar has been built, you can find it in the build/libs folder. This jar can then be deployed in a new lambda function.
Note: If you change the name to a different lambda function, you must change the name of the function that is invoked in the code in the class com.blackboard.testing.lambda.LambdaSeleniumService