This is an example BDD test automation project, written using Cucumber-JVM framework and RestAssured for a google books Web Service.
This project was developed by me to demonstrate how to use Cucumber-JVM as a BDD test framework.
- Java
- Cucumber
- RestAssured
- JUnit
- Maven
- Java 11 - Java Dev Kit
- Maven 3.6.x - Dependency Manager
- IntelliJ IDEA - IDE
- Cucumber Plugin - For IntelliJ IDE
Though the project structure for this sample demo application does not matter much, in large projects it plays an important role from the maintability, accessibility, and reusability standpoint. Therefore, I have devided the overall project code into two main sections; main and test. The main folder contains all the framework related code, whereas test folder contains purely the testcases related stuff - in this case, these are feture and step definition files, and Runner class which is for the glue code between these two entities. Likewise, you can navigate inside main folder to learn more about project structure.
I have randonmly found this Google Books Web Service link which I'd recommend you to explore further using Postman.
This project uses Maven. To run tests, simply run:
mvn clean test
.
You can find the Surefire HTML reports in the following directory of the Project.
\target\surefire-reports\index.html
To extend your understanding further with the underline tech-stack, try the following exercises:
Add new scenarios after exploring the response of this Web Service in Postman. For example,
- Verify title and author fields for books volume
- Verify the response time should be less than 1s
Add logging in this project using any logging library such as SLF4J whose references is also included in the Pom file. Explore Serenity and Surefire reporting (References are already included in the pom file).