Skip to content

ldt0589/NowBookItDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Automation Framework Cucumber TestNG and Selenium Java:

USING IMPORTANT LIBRARIES

  1. Selenium: 4.10.0
  2. TestNG: 7.8.0
  3. Cucumber-Java: 7.13.0
  4. Cucumber-reporting: 5.7.5
  5. Log4j: 3.0.0-alpha1
  6. Extent Report: 5.0.9
  7. Maven: 3.9.0
  8. Java: 17

SOME FEATURES IN FRAMEWORK

  1. Run the parallel Scenario on feature file
  2. Cucumber Report
  3. Extent Report
  4. Write Log to file
  5. Screenshot test case
  6. Read data test from Excel file (xlsx, csv, json,...) (Need a bit time to optimize test data for NOW BOOK IT more clearly)
  7. 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)

HOW TO USE

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

Project structure

📦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

About

This is a demo of NowBookIt

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published