Selenium
Last updated
Last updated
Setting Up Selenium with aqua for Automated Testing
This guide will help you set up Selenium with aqua to run automated tests in your development environment or BrowserStack. Follow the steps carefully to ensure all components are correctly configured.
Ensure you have the following ready before starting the setup:
A running aqua PowerShell agent: here the article
Java JDK installed on the server where the agent is running
Selenium, JUnit, Hamcrest, and Apache Commons IO libraries downloaded: you can find the zip. File here:
Aqua test case created with necessary test data for browser and OS configurations
Install Java JDK:
Download and install the latest version of Java JDK on the server running the PowerShell agent.
Download Selenium:
Download the Selenium Java client library from Selenium's official website.
Extract the contents into a folder named Selenium
inside the PowerShell agent directory.
Download JUnit and Hamcrest Libraries:
Download JUnit and Hamcrest from the JUnit official download page.
Place the downloaded JAR files into the PowerShell agent directory.
Download Apache Commons IO:
Download the org.apache.commons.io.jar
and place it in the agent directory. Alternatively, ensure it is declared in the classpath.
Run Selenium Server:
Download the Selenium standalone server from Selenium's official website.
Start the server with the command:
Login to aqua:
Access your aqua account and log in.
Create a Test Case:
Navigate to the test cases section and create a new test case.
Add a Test Step:
Inside the test case, create a new test step.
Add PowerShell Automation:
Configure the test step to use PowerShell for automation.
Upload PowerShell Script:
Copy the PowerShell script contained in execute.ps1
to the aqua PowerShell automation step.
Upload Java Files:
Upload RemoteTest.java
and Report.java
as attachments to the PowerShell step. These files contain the test logic and logging utility.
Add Test Data to the Test Case:
Include the following test data parameters to control the OS and browser configurations:
BrowserName
BrowserVersion
OS
OS_Version
These parameters are used in RemoteTest.java
to specify which environment the test should run on.
Compile the Java Files:
Ensure the PowerShell script (execute.ps1
) compiles the Java files using the javac
command with the appropriate classpath that includes all required libraries and classes.
Run the Test:
Execute the test through the aqua interface. The PowerShell script will run, compiling and executing the Java test files.
execute.ps1
)Ensure the paths in the PowerShell script are correctly set to the locations of the Selenium, JUnit, Hamcrest, and Apache Commons IO libraries.
The RemoteTest.java
file should contain logic to interpret the test data parameters and configure the test accordingly.
The Report.java
file should handle logging and ensure logs are properly parsed and displayed in the aqua Execution Log.
By following these steps, you will successfully set up and execute Selenium tests within the aqua environment.