Using PlayTech.com
Code Structure:
- Cucumber Feature files are placed under src.test.java.resources.features
- Cucumber Step definition file is placed under com.test.stepdefinition package
- Page files are java.com.framework.utils.pages package
- Main driver initialisation java.com.test.framework.utils.driver package
- Common driver functions initialisation java.com.test.framework.utils.common package
- build.gradle contains all the dependencies libraries and has the tasks for executing the tests
Setup & test:
- Install Gradle on your machine https://gradle.org/install/
- Download remote repository https://github.com/nagamanickamm/org.playtech.bdd
- Open the project and select build.gradle using your choice of IDE (Note: This project is build using IntelliJ) Import the project as gradle project
- Go to Terminal, from project root (ex:'org.playtech.bdd') and enter "gradle --refresh-dependencies" (without quotes)
- type "gradle cucumberTest -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/4e61ccdb-f913-4909-bee5-ef24ce5695a6
- 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 Cloud report - https://reports.cucumber.io/reports/f4bc2fca-1ab1-4aad-8ca6-6c5a1fd95686
- Alternatively run only selected tags using below gradle cucumberTest -Pbrowser=firefox -Ptags="@Smoke or @NoSmoke"
Easy steps:
- Simply download the code as ZIP from git repo https://github.com/nagamanickamm/org.playtech.bdd
- Go to the project folder (Make sure gradle is installed on your machine)
- Enter : gradle cucumberTest -Pbrowser=firefox (tested on firefox and chrome) else:
- Right click on Runner and execute in IntelliJ
CI/CD: This project is added to GITActions continuous run on push and merge https://github.com/nagamanickamm/org.playtech.bdd/actions
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 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
- Enable Parallel runs across test and browser
- Crossbrowser platforms such as Selenoid, Saucelabs, Browserstacks can be added