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.
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
- features: To store your feature file. There can be sub folder for sub modules.
- testdata: To store test data of project.
- properties: Environment specific properties files, extent properties file.
- xml: extent xml or log xml.
Folders in root directory
- drivers: To store your driver exe files.
- screenshots: To store screenshots
- logs: It can contain extentreport folder
- scripts: docker or other scripts
- certs: any specific certificates required for application to run
Files in root directory
- .dockerignore, docker-composer.yml, docker-composer-jenkins.yml