https://github.com/iamcharankumar/web_test_framework
A Java-based Selenium Web Test Framework for automating tests on the Sauce Demo website.
https://github.com/iamcharankumar/web_test_framework
data-driven discord-bot java logback maven parallelization reportportal selenium-grid-4 selenium-java selenium-webdriver test-automation-framework testng ui-testing web-testing
Last synced: 7 days ago
JSON representation
A Java-based Selenium Web Test Framework for automating tests on the Sauce Demo website.
- Host: GitHub
- URL: https://github.com/iamcharankumar/web_test_framework
- Owner: iamcharankumar
- Created: 2023-09-12T03:12:43.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-20T15:08:32.000Z (12 months ago)
- Last Synced: 2024-07-21T16:26:41.461Z (12 months ago)
- Topics: data-driven, discord-bot, java, logback, maven, parallelization, reportportal, selenium-grid-4, selenium-java, selenium-webdriver, test-automation-framework, testng, ui-testing, web-testing
- Language: Java
- Homepage:
- Size: 4.39 MB
- Stars: 10
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README



# ABOUT
A Web Test Framework for developing regression suites. The test cases can be run locally and in remote server.
# STEPS FOR INTEGRATING TESTNG & REPORT PORTAL
1. Download the latest docker-compose.yml
from [here](https://github.com/reportportal/reportportal/blob/master/docker-compose.yml), a quicker way to download
this is to use below command
`curl https://raw.githubusercontent.com/reportportal/reportportal/master/docker-compose.yml -o docker-compose.yml`
2. Once downloaded, execute the below command to pull the required images and start containers
`docker-compose -p reportportal up -d --force-recreate`
3. Verify login http://localhost:8080/ui/#login with `default\1q2w3e` or `superadmin\erebus`
4. Create a blank project and copy and paste the below config in `reportportal.properties` under `src/test/resources`.
See the table below.
5. Read these great posts written below by [Automation Hacks](https://github.com/automationhacks) to configure the
Report
portal.
By far, these are the only posts with accurate steps.
1. Further reading on setting up the reportportal
is [here](https://automationhacks.io/2020/03/02/how-to-setup-reportportal-on-a-local-docker-instance/).
2. Further reading on configuring logback with reportportal to push logs
is [here](https://automationhacks.io/2020/09/25/logging-integration-with-logback-testng-in-report-portal/).| Sl.No | Report portal Property Name | Report portal Property Value |
|-------|-----------------------------|------------------------------|
| 1 | rp.endpoint | http://localhost:8080 |
| 2 | rp.api.key | |
| 3 | rp.launch | Java launch |
| 4 | rp.project | web_tests |#### REPORT PORTAL OUTPUTS
![]()
![]()
# STEPS FOR INTEGRATING TEST REPORTS [REPORT PORTAL URL] WITH DISCORD MESSAGE SERVICE
1. Create a discord account and follow the steps
given [here](https://www.svix.com/resources/guides/how-to-make-webhook-discord/) to configure a message channel and
send the test reports after the test execution.
2. Pass your channel's webhook token in the `SauceLabsPortalConstants` class.
3. Here we will send the Report Portal Launch URL along with test case metrics.
So make sure that your report portal is
up and running.
4. You're ready to execute your tests now. Follow the below section.#### DISCORD OUTPUTS
# STEPS FOR THE TEST EXECUTION
1. `git clone https://github.com/iamcharankumar/web_test_framework.git`
2. `cd web_test_framework`
3. `git pull`
4. `mvn clean test -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3`#### BROWSERS & RUN MODES
| Sl.No | Browser Name | Run Mode | mvn command |
|-------|--------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Chrome | Local | `mvn clean test -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 2 | Chrome | Headless | `mvn clean test -Drunmode=headless -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 3 | Chrome | Remote | `mvn clean test -Drunmode=remote -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 4 | Firefox | Local | `mvn clean test -Dbrowser=firefox -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 5 | Firefox | Headless | `mvn clean test -Drunmode=headless -Dbrowser=firefox -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 6 | Firefox | Remote | `mvn clean test -Drunmode=remote -Dbrowser=firefox -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 7 | Edge | Local | `mvn clean test -Dbrowser=edge -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |
| 8 | Edge | Headless | `mvn clean test -Drunmode=headless -Dbrowser=edge -Dgroups=SAUCE_LABS_SMOKE,SAUCE_LABS_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3` |**NOTE**: These above commands (no testng.xml required) will run the tests in parallel with the specified thread count
and with the respective groups and thread counts.
The screenshot listeners are configured in "pom.xml" under "< property >" tag.# PROPERTIES SETUP FOR SELENIUM GRID
- Run mode value can be 'local' or 'remote'
- You can configure it in the "config.properties" file.
- To run in remote server, follow the below docker setup instructions.# DOCKER SETUP FOR SELENIUM GRID
**Make sure to have the docker desktop and docker compose installed on your machine.**
**NOTE:** Since I'm running the `docker-compose-v3.yml` on Apple Chip, I'm using `docker-seleniarm` images.
More on the Docker images for Selenium (ARM/NON-ARM)
read this GitHub's [README](https://github.com/seleniumhq-community/docker-seleniarm).# đź§Ş ARM-Ready Selenium Grid with Docker Compose
> ⚠️ Tired of Selenium Docker setups breaking on your M1/M2 Mac? Here's a fully functional ARM-based Selenium Grid using [`seleniarm`](https://github.com/SeleniumHQ/docker-selenium#arm-support).
---
## đź’ˇ Why This Exists
Most Selenium Docker images are built for **x86_64** architecture — which fails to run on modern **ARM64** systems like:
- Apple Silicon Macs (M1/M2)
- Raspberry Pi
- ARM-based CI runnersThis project uses the [`seleniarm`](https://github.com/SeleniumHQ/docker-selenium#arm-support) images to build a **cross-platform, lightweight, plug-and-play** Selenium Grid. 🌍
---
## ⚙️ Tech Stack
- Selenium Grid Hub (ARM compatible)
- Chrome & Firefox Nodes (ARM)
- Docker Compose
- VNC Enabled for visual debugging
- Parallel test sessions---
## đź§± Folder Structure
Goto `/web_test_framework/src/main/java/resources` and execute the below docker commands to setup the `Seleniarm Gird`.
`docker ps -a`
###### Run the below command to delete all the docker containers (if only required)
`docker rm -vf $(docker ps -aq)`
###### To spin up 10 nodes in the grid we use --scale before the node's name.
`docker-compose -f docker-compose-v3.yml up --scale chrome=10 --scale firefox=10 -d --force-recreate`
###### To kill a session in the selenium grid.
`curl -X DELETE http://localhost:4444/wd/hub/session/{session_id}`
#### SELENIUM GRID OUTPUTS
![]()
#### DECLUTTERING MAVEN OUTPUT
- Maven usually floods the console with logs during test execution, making it hard to spot what's important.
A clean, minimal, Node.js-style output for a Java project felt impossible—until I
found this [maven dependency](https://mvnrepository.com/artifact/me.fabriciorby/maven-surefire-junit5-tree-reporter).
- Its purpose is simple: **"What happened to my test cases?"** That’s exactly what it shows—straight to the point, no
clutter.
- By following this [post](https://medium.com/wearewaes/my-journey-to-a-clear-test-output-in-maven-df82fe272249)
by [Fabricio](https://github.com/fabriciorby),
I was able to configure it easily and get the clean output shown below.
- The output works locally and in GitHub Actions as well.
- Huge respect and thanks to the author for this
brilliant [work](https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter?tab=readme-ov-file)!
❤️
## Star History
[](https://star-history.com/#iamcharankumar/web_test_framework&Date)