Using AutomationPractice.com
Code Structure:
- Cucumber Feature files are placed under test.java.resources.features
- Cucumber Step definition file is placed under test.java.com.test.naga package
- Page files are java.com.test.naga.pages package
- Main driver initialisation java.com.test.naga.utils.driver package
- Common driver functions initialisation java.com.test.naga.utils.common package
Setup & test:
- Install Gradle on your machine https://gradle.org/install/
- Download remote repository [email protected]:nagamanickamm/CucumberJavaSelenium.git
- Open the project using your choice of IDE (Note: This project is build using IntelliJ and do not open via build.gradle)
- Go to Terminal, from project root (ex:'CucumberJavaSelenium') and enter "gradle --refresh-dependencies" (without quotes)
- type "gradle cucumber -Pbrowser=firefox" (change your browser accordingly)
- When the test is a completed click on the cucumber report link shown in the terminal or go to https://reports.cucumber.io/report-collections/ece07264-f966-43d8-8e1d-b39b14c7f1e1
- Alternatively you can execute from run command in intelliJ or any iDE, please add -Dbrowser=firefox in VM options
- If you have any issues with browser parameter then please comment systemProperties['browser'] = browser in build.gradle and it should take from properties file Notes:
- Sample report can be found in report/Cucumber Reports.pdf or
- Cloud report sample - https://reports.cucumber.io/reports/c86cd05e-4745-4100-9855-429710e929a3 https://reports.cucumber.io/report-collections/ece07264-f966-43d8-8e1d-b39b14c7f1e1 (Check reports created only on sunday)
Further enhancements:
- Additional reporting plugins such as Allure, extent, cucumber report plugins cab be added depending on need
- Further, cloud based AI reporting can be added using ReportPortal IO
- CI CD can be setup easily with gradle options
- Environment config file can be further enhanced to switch between multiple environments
- Passwords should be secretly stored/ given during runtime using gradle parameter and can be set using secret key such as in Jenkins configurations
- Use API calls to generate Test Data
- Use Example option on cucumber to add Data driven test
- Add @ annotations to run only selected area of features
- Add more validations for each page (Due to time constraint I could not validate every element)
- Enable Parallel runs across test and browser
- Crossbrowser platforms such as Selenoid, Saucelabs, Browserstacks can be added
- Gradle should be placed at the root rather than module level to import as gradle project(I realised at the middle of testing)