Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Project Structure & Workflow

The project structure and workflow are organized as follows:

## src/main/java

- base
  - Hook: The starting point of JUnit execution (`@Before` and `@After`). It instantiates the Base Class (`TestBase`) and calls the `beforeEachTest` method, passing the URL from the properties file.
  - TestBase: Initializes the browser of choice (default: Chrome, specified in the properties file) using WebDriverManager for all required web drivers. It also boots up the page objects with the WebDriver interface. After preconditions (page load, timeouts, maximize browser), it retrieves the URL using `driver.get()`.

- common: Contains frequently used helper methods, including wait-related methods.

- pageObject: Contains separate page object classes that include locators and functional methods.

- util: Contains frequently used key constants (`Key.java` enum). The configuration file contains all required property file handlers, and `Misc.java` provides the `getClassName()` method. This method is used with logs to get the corresponding class and method names where the tests are running from. The current thread is used as a parameter, and `getStackTrace()[2]` is used to retrieve the current caller's information.

## src/test/java

- features: Feature files are evaluated using the `Feature:` keyword. Corresponding `Scenario:` and corresponding `StepDefinitions` methods are called.

- runner: JUnit test execution starts with `@RunWith(Cucumber.class)`. The feature file location is provided, and the `Hook` class is specified using `@CucumberOptions`. The features are then triggered.

- stepdefinitions: Methods in step definitions are called one by one to trigger the corresponding page object classes based on the test strategy defined in the feature files. Page objects contain locators and functionality testing methods.

## test-output (generated at runtime)

The following directories are generated at runtime:

- htmlText: This directory is created whenever the `createDirectory()` method in `common.CommonAction.java` is called. The method accepts the desired directory path as an argument. It captures a screenshot, performs OCR on the image using the ITesseract library, and saves the extracted texts to a text file using `textToFile()` in `common.CommonAction.java`. The method takes the text to save, the name of the text file, and the path from the properties file.

- logs: This directory is generated whenever the `log()` method in `report.Log.java` is called. It removes all console logs using `removeConsole()` and saves them as a text file with a timestamp.

- screenshot: This directory is generated whenever the `screenshotElement()` or `screenshotPage()` methods in `common.CommonAction.java` are called. For element screenshots, the current driver, the name of the image file, and the locator of the web element are passed. For entire page screenshots, only the current driver and the name of the image file are required. Both methods use the `.png` format for screenshots.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages