USING IMPORTANT LIBRARIES
- Selenium: 4.10.0
- TestNG: 7.8.0
- Cucumber-Java: 7.13.0
- Cucumber-reporting: 5.7.5
- Log4j: 3.0.0-alpha1
- Extent Report: 5.0.9
- Maven: 3.9.0
- Java: 17
SOME FEATURES IN FRAMEWORK
- Run the parallel Scenario on feature file
- Cucumber Report
- Extent Report
- Write Log to file
- Screenshot test case
- Read data test from Excel file (xlsx, csv, json,...) (Need a bit time to optimize test data for NOW BOOK IT more clearly)
- Base function in the package: utils, helpers and main defined functions is WEBUI
SYSTEM REQUIREMENTS
- JDK All version
- Chrome Browser, Edge Browser
- IntelliJ is the best choice (to change JDK version)
1. Run single/parallel the test case:
- Run Cucumber TestRunner from src/test/java/nowbookit/com/runners
- Run Feature file (src/test/resources/features/)
- Run Feature in suite XML (src/test/resources/suites/)
- Run Feature from Maven pom.xml file (mvn clean test)
2. Cucumber Report
- See Cucumber report after executing at /reports/CucumberExtentReports/CucumberExtentReports.html
3. Extent Report
- Config from src/test/resources/extent.properties
4. Write Log to file
- Call class: Log.info , Log.pass, Log.error,... (Log is a custom global class from Log4j2) (import nowbookit.com.utils.Log.java)
5. Record Screenshot
- Setup in config.properties file (src/test/resources/config/config.properties)
- screenshot_passed_steps=yes or no
- screenshot_failed_steps=yes or no
- screenshot_skipped_steps=yes or no
- screenshot_all_steps=yes or no
6. Read data test from Excel file
- Create function with annotaion DataSupplier on src/main/java/nowbookit/com/utils/DataProviderUtils.java
- Call the name of DataSupplier above in the test cases as DataProvider of TestNG
- Read excel with Map and Hashtable
7. Base function in the package
- src/main/java/nowbookit/com/utils
- src/main/java/nowbookit/com/helpers
8. Read data test from JSON file
- JsonUtils class select the json file path and call "get" method with key
9. Main keyword is WebUI
- WebUI class is main keyword in Framework. It contains common functions
- How to use: WebUI.function_name
- Example: WebUI.setWindowSize(1024, 768), WebUI.screenshotElement(By by, String elementName),...
10. Call test case:
- Run test case Gherkin-Cucumber: => src/test/resources/features/TC01_WalkinBooking.feature => src/test/resources/features/TC02_WidgetBooking.feature
- Run test case TestNG: => src/test/resources/suites/SuiteFeatureAll.xml => src/test/resources/features/TC01_WalkinBooking.feature
- Or run with maven in pom.xml file:
=> mvn clean test
📦NowBookItDemo
┣ 📂src
┃ ┣ 📂main
┃ ┃ ┣ 📂java
┃ ┃ ┃ ┗ 📂nowbookit
┃ ┃ ┃ ┃ ┗ 📂com
┃ ┃ ┃ ┃ ┃ ┣ 📂annotations
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜FrameworkAnnotation.java
┃ ┃ ┃ ┃ ┃ ┣ 📂constants
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜FrameworkConstants.java
┃ ┃ ┃ ┃ ┃ ┣ 📂driver
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜BrowserFactory.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜DriverManager.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜TargetFactory.java
┃ ┃ ┃ ┃ ┃ ┣ 📂enums
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜AuthorType.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Browser.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜CategoryType.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜FailureHandling.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜Target.java
┃ ┃ ┃ ┃ ┃ ┣ 📂exceptions
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜FrameworkException.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜HeadlessNotSupportedException.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜InvalidPathForExtentReportFileException.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜InvalidPathForFilesException.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜TargetNotValidException.java
┃ ┃ ┃ ┃ ┃ ┣ 📂helpers
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜CaptureHelpers.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜FileHelpers.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Helpers.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜PropertiesHelpers.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜ScreenRecoderHelpers.java
┃ ┃ ┃ ┃ ┃ ┣ 📂keywords
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜WebUI.java
┃ ┃ ┃ ┃ ┃ ┣ 📂report
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ExtentReportManager.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ExtentTestManager.java
┃ ┃ ┃ ┃ ┃ ┗ 📂utils
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜BrowserInfoUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜DataGenerateUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜DateUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜LanguageUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜LogUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ObjectUtils.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ReportUtils.java
┃ ┃ ┗ 📂resources
┃ ┃ ┃ ┗ 📜log4j2.properties
┃ ┗ 📂test
┃ ┃ ┣ 📂java
┃ ┃ ┃ ┗ 📂nowbookit
┃ ┃ ┃ ┃ ┗ 📂com
┃ ┃ ┃ ┃ ┃ ┣ 📂common
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜BaseTest.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜CommonSteps.java
┃ ┃ ┃ ┃ ┃ ┣ 📂dataprovider
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜DataProviderManager.java
┃ ┃ ┃ ┃ ┃ ┣ 📂hooks
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜CucumberListener.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Hooks.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜TestContext.java
┃ ┃ ┃ ┃ ┃ ┣ 📂listeners
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜TestListener.java
┃ ┃ ┃ ┃ ┃ ┣ 📂projects
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂website
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂nbi
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂pages
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜adminBookingPage.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜adminBookingPage.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜adminLoginPage.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂stepdefinitions
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜BookingSteps.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜DashboardSteps.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜LoginSteps.java
┃ ┃ ┃ ┃ ┃ ┗ 📂runners
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜WalkinBooking_TestRunner.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜WidgetBooking_TestRunner.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜TestRunnerAllFeatureByTag.java
┃ ┃ ┗ 📂resources
┃ ┃ ┃ ┣ 📂config
┃ ┃ ┃ ┃ ┣ 📜config.json
┃ ┃ ┃ ┃ ┣ 📜config.properties
┃ ┃ ┃ ┃ ┗ 📜data.properties
┃ ┃ ┃ ┣ 📂features
┃ ┃ ┃ ┃ ┣ 📜TC01_WalkinBooking.feature
┃ ┃ ┃ ┃ ┣ 📜TC02_WidgetBooking.feature
┃ ┃ ┃ ┣ 📂suites
┃ ┃ ┃ ┃ ┣ 📜SuiteFeatureAll.xml
┃ ┃ ┃ ┃ ┣ 📜SuiteFeatureByTag.xml
┃ ┃ ┃ ┣ 📂testdata
┃ ┃ ┃ ┃ ┣ 📜LoginCSV.csv
┃ ┃ ┃ ┣ 📜cucumber.properties
┃ ┃ ┃ ┣ 📜extent.properties
┃ ┃ ┃ ┗ 📜pdf-config.yaml
┣ 📂target
┃ ┣ 📂cucumber-reports
┃ ┃ ┣ 📜WidgetBooking_TestRunner.html
┣ 📜reports
┃ ┣ 📜CucumberExtentReports.html
┣ 📜.gitignore
┣ 📜pom.xml
┗ 📜README.md