Skip to main content

Cucumber Framework Folder Structure

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:

  • 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 (com.pb.app.helper): 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, Constants.java and GenericFunctions.java.

  • 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 (com.pb.app.pageobjs): Store your page objects for each page individually in this package. File Includes: HomeObjs, SearchObjs etc.

3. stepdefinitions or steps package (com.pb.app.steps): To store cucumber step definitions and Cucumber Runner Class. File Includes: Steps.java, CucumberRunner.java. 

Note: For large enterprise application where there are sub modules inside modules you can crate another submodule package inside pageobjs and steps.

4. utils (com.pb.app.steps): 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. .getignore
  3. .dockerignore, docker-composer.yml, docker-composer-jenkins.yml
  4. JenkinsFile 

Video Tutorial: Cucumber Project Structure

Submitted by tgoswami on August 29, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.