Day 02 β Project Initiation and Structure
On Day 01, we designed the blueprint of our Selenium Java framework.
On Day 02, we finally move from planning to action.
Today is about setting up the foundation of the projectβthe part you build once and rely on throughout the frameworkβs lifetime. If this step is done correctly, everything that comes later becomes easier, cleaner, and more scalable.
π― What We Will Do Today
By the end of Day 02, you will have:
- A Maven-based Selenium project
- All required dependencies configured
- A clean, industry-standard folder structure
- A central configuration file for global settings
This setup works the same way in real-world automation projects.
Step 1: Creating the Maven Project
We use Maven because it automatically:
- Downloads required libraries
- Manages versions
- Integrates easily with CI/CD tools like Jenkins
You can use Eclipse or IntelliJ IDEAβboth are widely used.
βΆ Option 1: Create Maven Project in Eclipse
- Open Eclipse IDE
- Go to File β New β Maven Project
- Click Next
- Select:
- Archetype:
maven-archetype-quickstart -
Version: 1.4 or 1.5
- Click Next
- Enter:
Group Id:
com.orangehrm-
Artifact Id:
OrangeHRM_Project- Finish the setup
- Ensure the project is using Java 17:
Right-click project β Properties β Java Compiler β Set to 17
Eclipse will create a basic Maven project with a pom.xml file.
βΆ Option 2: Create Maven Project in IntelliJ IDEA
- Open IntelliJ IDEA
- Click New Project
- Select Maven
- Click Next
- Enter:
-
GroupId:
com.orangehrm -
ArtifactId:
OrangeHRM_Project
-
GroupId:
- Select JDK 17
- Finish
IntelliJ will automatically download Maven dependencies in the background.
Step 2: Configuring Dependencies (pom.xml)
The pom.xml file is the heart of a Maven project.
This is where we define all external libraries our framework needs.
For now, we add:
- Selenium WebDriver
- TestNG
π Why these?
- Selenium β Browser automation
- TestNG β Test execution, grouping, reporting, and parallel runs
π§ pom.xml β Essential Dependencies
Add the following inside the <dependencies> section:
<dependencies>
<!-- Selenium WebDriver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.27.0</version>
</dependency>
<!-- TestNG Framework -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
Once saved:
- Eclipse β Right-click project β Maven β Update Project
- IntelliJ β Maven reload happens automatically
If there are no errors, your dependencies are set correctly.
Step 3: Designing the Folder Structure
The default Maven structure is good, but not enough for a scalable automation framework.
We now create a clean, logical package hierarchy.
π¨ First Step
Delete any default packages created under:
src/main/javasrc/test/java
Weβll build our own structure.
π Packages Under src/main/java
Create the following packages:
| Package | Purpose |
|---|---|
com.orangehrm.base |
Browser setup and teardown |
com.orangehrm.actiondriver |
Common Selenium actions |
com.orangehrm.pages |
Page Object classes |
com.orangehrm.utilities |
Excel, reporting, helpers |
com.orangehrm.listeners |
TestNG listeners |
This separation ensures:
- Clean code
- Easy maintenance
- Better scalability
π Resources Folder Setup
Under src/main/resources, create:
config.propertieslog4j2.xml
We will use these files throughout the framework.
Step 4: Global Configuration Using config.properties
Hardcoding values like URLs and browsers is a bad practice.
Instead, we store them in a configuration file.
This makes switching environments easy (QA, UAT, Production).
π config.properties β Initial Setup
Create this file in src/main/resources:
# Application Settings
url=https://opensource-demo.orangehrmlive.com/
browser=chrome
# Timeout Settings
implicit_wait=10
explicit_wait=30
# Test Credentials
username=admin
password=admin123
Later, our framework will read these values dynamically.
β Day 02 Summary
By the end of today, you have:
- A Maven-based Selenium project
- Selenium and TestNG fully configured
- A professional folder structure
- A central configuration system
This is the backbone of the automation framework.
π Day 02 Task
- Create the Maven project (Eclipse or IntelliJ)
- Add Selenium and TestNG dependencies
- Create all required packages
- Validate the setup:
- Maven dependencies resolve successfully
- No build errors
π Whatβs Next?
On Day 03, we will:
- Create the Base Class
- Configure WebDriver using Selenium Manager
- Launch the browser dynamically
The real automation begins next π¦
Top comments (0)