Java 17 (if you are using Windows set JAVA_HOME environment variable to point to jdk root folder e.g. C:\Program Files\Java\jdk-17.0.2)
Dependencies
Dependencies are managed by Gradle and they are declared in build.gradle in root project folder
Selenium = '4.1.3' - For browser automation
WebDriverManager = '5.1.0' - Download, setup, and maintenance of the drivers required by Selenium WebDriver
TestNG = '7.5' - Testing framework on which the tests are being executed
Apache POI = '5.2.2' - Library for parsing and working with Excel files in Java
log4j = '2.17.2' - Logging library
Project Structure
src/test/java/containers used for storing test session data and instantiated page object models
src/test/java/helpers generic functions, annotation processors and UI helper functions
src/test/java/poms page object models representing actual web pages
src/test/java/providers data providers for Data Driven Testing approach
src/test/java/runners TestNG runners
How to Run Tests
Before running tests make sure you have entered correct test parameters in src/test/resources/testParameters.xlsx Excel file (supported browser are either chrome or firefox)
After providing test parameters then you can enter keywords for each search engine in src/test/resources/testData.xlsx Excel file (note that Excel sheet name represents search engine)
If you have locally set up gradle binary then you can cd into project root and run the tests by command gradle clean test
If you do not have installed gradle binary locally then you can cd into project root folder and use gradlew (gradle wrapper) instead ./gradlew clean test
Logs
Logs can be found in /logs/SearchEngine.log file
It will be generated after test execution
Common results will be logged only if the same keyword is used for both search engines
Note that if you execute tests in a row few times it will append results to a log file
Workflow
Framework was developed in a way that allows new contributors to a project to easily add tests without any overlapping or potential conflicts
Example workflow (adding a new search engine) would be the following:
Add search engine test data in src/test/resources/testData.xlsx file
Add data provider class in src/test/java/providers e.g. NewSearchEngineDataProvider.java
publicclassNewSearchEngineDataProvider {
@DataProvider(name = "NewSearchEngine")
publicstaticObject[][] getDuckDuckGoKeywordsData() {
// NewSearchEngine is sheet name in testData.xlsx filereturnExcelHelper.getTestData("NewSearchEngine");
}
}
Add new Page Object Model class in src/test/java/poms package e.g. NewSearchEngineHomePage.java (which extends BasePageObject.java class) and all corresponding methods to that particular web page