This repository contains code for Trayt portal test automation
- Spring Boot
- Cucumber
- Selenium
- Maven
- Allure Report
- Execute scenarios and features in groups using Cucumber tags
- Execute test in different browsers(Chrome, Firefox, Edge)
- Take screenshots for failed steps in scenario.
- Generate detailed execution report with trends and screenshots.
- Apart from Java8 and Intellij/Eclipse IDE, We need below tools to be installed to execute tests.
-
To include tests to framework follow below process.
- Write test cases in feature file by using gherkin language and put it in features folder.
Example: Sample Feature file path TraytPortalDemo.feature - Generate Step definitions for the feature file by using any one of the below method.
- Intellij Cucumber java plugin (Most preferred and easy way)
- Right click on Feature file and add "spring.profiles.active=dev" as Environment variable in runconfiguration
and run the feature file. Cucumber will generate sample Step definitions snippet in console, copy the sample snippet
and create a class in stepdefinitions folder and paste it in that class.
Example: Sample Step definition class LoginDemoStepDefs.java
- All the elements we need to interact in our scenarios should be inspected and should be added to the page object class created in pages folder.
Example: Sample page object class HomePage.java - All the common data like urls and credentials required to execute test cases will go in application.yml file.
- Write test cases in feature file by using gherkin language and put it in features folder.
-
- By using maven command.(Most preferred and suggested way)
Example:
mvn clean test -Dspring.profiles.active=dev -Dcucumber.filter.tags=@TraytLoginDemo -Dbrowser=chrome
Possible values for below properties
spring.profiles.active: dev or qa or stage or prod
browser: chrome or edge or firefox
cucumber.filter.tags: all the tags we want run
- By using maven command.(Most preferred and suggested way)