I have used amazon.in and chocalate as Rocho Ferrero. I cannot choose Mars & Bounty and Amazon.com because of the error message shown by amazon due to location
- Selenium - Web Automation
- TestNG - Unit Testing Library
- Extent Reports - Reporting Library to generate beautiful html reports
- AssertJ - Fluent Assertion Library in Java
- WebDriverManager - Executables management
- Lombok - To reduce boilerplate codes
Note : All the aforementioned libraries are open-source and does not include any license.
- This framework has the capability to run the tests in local and remote selenium grid.
- It can also be extended to run on clouds like browser stack or seetest.
- Web Tests can be run on chrome or edge browsers.
- Configuration can be changed from config.properties inside src/test/resources
- Utility methods available for Web Interactions (SeleniumActions.java)
- Integration with Jenkins for scheduling is easy. ๐
Prerequisites: Java 8+ , Maven 3.6.3 Installed and path set
- Tests should be added as per the convention followed. New testng tests should be created inside the src/test/java folder.
- All the tests should extend BaseTest.java
- Each test created should define the description as mandatory parameters. This will be helpful while creating the extent reports.
- All the tests should be follow AAA pattern - ARRANGE, ACT and ASSERT
- Have maximum of one to two assertions per test.
- Tests should interact only with the Facade layer. This can be used to wrap the business logic.
Prerequisites: Java 8+ , Maven 3.6.3 Installed and path set
- There are multiple ways to run the tests. During development phase you can use the testng.xml present in the root folder to run. Right click and choose run.
- Each of the testng xml file should contain the test classes to pick for the run.
- User can also choose the thread-count parameter to run the tests in parallel.
- User can also choose to run via maven commands which is highly recommended.
- Maven profiles are configured in the pom.xml. You can run these from IDE Terminal or any OS Terminal inside the project folder.
mvn clean test -Pall
- To run all the tests available in the testng.xml
Note : User should not try to run the test from test class - Might end up in NPE. Because the listeners are configured only in testng.xml
- Dashboard view clearly indicates the start time, end time of the run, number of tests passed and failed. It also shows the time took for the individual tests in form of timeline. Hover the mouse over the timeline to get the exact time details.
- Tags tab in the Dashboard view clearly indicates the pass and fail according to the functionality.
- Click on each test tab to view the corresponding test log events.
- All the web tests will have a screenshot attached on failure
- After each test run, reports can be found under root directory and ExtentReports folder.
- Press "l" on the keyboard after opening the report to switch the theme to Standard.
- This project can be integrated easily with Jenkins.
- Login to Jenkins
- Create Maven Project(Add maven plugin if not present)
- Configure choice parameters to run different maven profiles
- Configure goal and options
- Choose custom workspace and give the project location
- To run, select Build with parameters -> Choose Profile -> Click build
- View the results in the console output.
##Command to run the docker container
- Make sure to have the selenium grid or selenoid grid up and running
- Find cwd
$current = $PWD -replace "\\", "/" -replace "C", "c"
3.Start selenoid container
docker run -d --name selenoid -p 4444:4444 -v //var/run/docker.sock:/var/run/docker.sock -v ${current}/config/:/etc/selenoid/:ro -v /c/Users/testi/selenoid/video/:/opt/selenoid/video/ -e OVERRIDE_VIDEO_OUTPUT_DIR=/c/Users/testi/selenoid/video/ aerokube/selenoid:latest-release
or
Start selenium standalone container or grid
docker run -d --rm --name selenium -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:96.0
- Start seleniod ui(only need to view live execution)
docker run --rm -d --name selenoid-ui --link selenoid -p 8090:8080 aerokube/selenoid-ui --selenoid-uri=http://selenoid:4444
- Run the docker image with necessary parameters. (Remote URL can be any ip reachable to the container. All are optional parameters)
docker run --rm -e remoteurl=http://192.168.0.231:4444/wd/hub -e runmode=remote -e remotemode=selenoid amuthanqa/assignment:latest
- Add the additional parameters to the jenkins build and execute shell or windows batch command
- I have not written any unit tests because all the methods are relatively small and static
- I have performed sonarlint analysis to check the code quality.
- Base image used in the dockerfile is customised from
maven:3.6.3-jdk-8
where the maven dependencies are downloaded and kept handy to avoid downloading maven dependencies during each run.
For any further clarification - please reach out to [email protected]