/bedrock-test-automation

Bedrock test automation using selenium

Primary LanguageJavaMIT LicenseMIT

Bedrock Test Automation using Selenium

Execute functional test cases in any web application using natural language. Move away from statically coding your test cases using tools like selenium or puppeteer. Let a generative ai agent test the scenario and provide you with the test results.

This project implements an automated web UI testing framework that remotely controls a browser and simulates user interactions on a site. You can execute this project locally using AWS credentials or remotelly. If executing remotelly, a grid of containers will execute the test cases. The navigation is implemented with the help of a LLM (Claude3 Sonnet). The LLM will navigate, choosing the actions that need to be executed. LLM is aware of HTML source code, actionable elements, his past actions and remaining interactions available.

What it does

The solution can execute different types of test cases for authentication, creation of tickets, searching for products, adding products into shopping cart, empty shopping cart etc. It simulates clicking buttons, entering data and more to try to execute a functional test case in a web application. You can integreate this test automation tool with any sort of pipeline using the architecture below:

Requirements

To run this project, the following are needed:

Running the sample test case (Amazon Cart)

  • Clone the project repository
  • Run mvn package to build the application
  • Authenticate your CLI to your AWS environment
  • Run locally using the debugger of your favorite IDE (I tested using VSCode)
java -jar target/genai-selenium-1.0-SNAPSHOT.jar 
  • Run remotelly using API Gateway and SQS:
cdk deploy test-automation
#look for SERVICE_URL Output within the Outputs tab of the test-automation stack in AWS CloudFormation
export MY_API_GATEWAY_URL = 
curl "$MY_API_GATEWAY_URL" \
	-H 'Content-Type: application/json' -d @sample-test-payload.json \
	--user "$AWS_ACCESS_KEY_ID":"$AWS_SECRET_ACCESS_KEY" \
	--aws-sigv4 "aws:amz:us-east-1:execute-api"

To deploy using an existing VPC, update file cdk.json and add the VPC id as a parameter as shown in the image below. Then run cdk deploy test-automation

Contributing

Guideline for contributing

License

This project is licensed under the MIT-0 license.