Create framework or structure for Selenium Project

Profile picture for user ksharma

There can be several variation of Selenium Framework folder structure within different organisation. Here we will be creating Hybrid Framework which is combination of Module based and data driven framework.

Selenium tool help us to create automation scripts but; without a proper structure of the scripts it's very hard to maintain the scripts. So there is need to create a framework.

A framework provides us a structure to maintain our scripts easily and effectively. With the help of framework we can define various guidelines like coding standards, concepts, process and practice.

Below is the structure of the framework that we have created using maven.

Packages in src/main/java

Inside main you can define utilities:

utils (com.orgname.projectname.utils) 

This package will contain following class file:

  • This contains property file read and configurations. This file will read all the parameters that we have created in the in one go.
  • All driver related configurations. In Driver configurations we will create the functionality for running our test script on the expected browser.
  • To read data from excel file.
  • To read data from xml files.
  • To read data from database.
  • The folder is integration of the java classes that store the static variables referencing to the paths, files and other environmental details.

Packages in src/test/java

  • helper (com.orgname.project.helper): Contain for TestNG annotations and listeners. Also contains, for common functions.
  • pages/pageobjs (com.orgname.project.pageObjs): In the Object Repository we are storing page objects for each page individually in this package. Store objects files like, etc.
  • testcases/tests (com.orgname.project.testcases): In this package we are storing test cases for each page. We do not define any objects in our test class. Example File:,

Packages and files in src/main/resources

  • From the file we are reading the data like on which browser we want to run our scenarios and on which environment. 
  • testdata (folder): It will contain Excel, xml or text files with data.

Folders/Files in Project Root Directory

  • TestNG.xml: TestNG.xml is the file that we have created to run our automation suite. 
  • pom.xml: pom.xml is already created by maven. When you are creating a maven project. In this, we have to add dependency.
  • drivers (folder): We have created one Drivers directory that is not a part of any package. In drivers folder we are storing our driver.exe files
  • logs (folder): To store logs.