Cucumber Framework Folder Structure

Profile picture for user devraj

The framework provide help in development of automation project. Framework define various guidelines, coding standards, concepts, process and practice. Maintenance of project become easy with Framework. Also, several automation tester can work easily when there is framework in an organisation.

There can be several variation of Cucumber Framework folder structure within  different organisation. People customise it according to their knowledge and requirement.

Below is one of the Framework structure for Cucumber Project using Maven:

Table of Contents

  1. src/main/java vs src/main/test
  2. src/test/java packages
  3. src/test/resources Folders
  4. Root Directory Folders
  5. Files in Root Directory

src/main/java vs src/main/test

  • src/main/java: This is the root directory for our source or application development code. When you work along with developer in same framework common utilities and code will be kept here. 
  • src/main/test: This is root directory for our test code. Keep your test related code here, which is not needed to run production application or which you will not deliver to customer. You can keep your delivered application smaller by loading testing related libraries separately. 

Packages in src/test/java

  1. base or helper or common package ( In base package you can store base class file which other class will inherit.  All constants can also be defined here. Classes Example: BaseFunctions.Java, and
    • BaseFunctions: Static Variables, Set Driver Method, Intialize Report or Files.
    • Constants: Properties File Path, Drivers EXE Path, Report File Path.
    • GenericFunctions or CommonFunctions: Scroll, Mouse Hover and Click, Wait, Upload File etc.
    • ScenarioContext
  2. pageobjs or pagemodels ( Store your page objects for each page individually in this package. File Includes: HomeObjs, SearchObjs etc.
  3. stepdefinitions or steps package ( To store cucumber step definitions and Cucumber Runner Class. File Includes:,  Note: For large enterprise application where there are sub modules inside modules you can crate another submodule package inside pageobjs and steps.
  4. utils ( To store utility like Excel Utility, Config Utility, Report Utility, Database Utility, Screenshot Utility, Hooks, CucumberRunnerTest etc. We can also keep util in src/main/java if dev and test code is in same framework.

Folders in src/test/resources

  1. features: To store your feature file. There can be sub folder for sub modules.
  2. testdata: To store test data of project.
  3. properties: Environment specific properties files, extent properties file.
  4. xml: extent xml or log xml. 

Folders in root directory

  1. drivers: To store your driver exe files.
  2. screenshots: To store screenshots
  3. logs: It can contain extentreport folder
  4. scripts: docker or other scripts
  5. certs: any specific certificates required for application to run 

Files in root directory 

  1. pom.xml
  2. .gitignore
  3. .dockerignore, docker-composer.yml, docker-composer-jenkins.yml
  4. JenkinsFile