In this tutorial you are going to learn How to Automate the API Tests using RESTAssured Library
This project contains automated api tests explained step by step. The tech stack used for this project are:
- JAVA as the programming language for writing test code
- TestNg as framework
- Gradle as the build tool
- IntelliJ as the preferred IDE for writing java code.
Setup your machine.
- Install JDK 1.8
- Install IntelliJ (Community edition is fine)
- Install gradle
- Clone the project from
git clone https://github.com/vinaykumarvvs/api-automation-tutorial.git - Import the project (api-automation-tutorial) in IntelliJ
File -> New -> Project from Existing Sources -> Browse Project Location -> build.gradle - Now click on
auto import -> Okwait until the IntelliJ downloads all the dependencies
Note: For 2nd & 3rd steps, you need to follow this way OpenTerminal/CMD -> cd <change-to-project-location>
- You can run the tests directly from the IntelliJ, by right clicking and Run test..
- For Linux/Mac users:
gradle clean build runTests - For Windows users:
gradlew clean build runTests
Through out this tutorial I am going to use PetStore-Swagger. PetStore - Swagger is the open source project which has very good documentation with various number of examples.
- Test-1: Send a GET Request of an API and validate the body
- Test-2: Send a GET Request of an API and retrieve the data from body
- Test-3: Send a GET Request of an API and store the Response