Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roboticautomata/serenity-bdd-api-testing-example
API Test Automation Example with Serenity BDD
https://github.com/roboticautomata/serenity-bdd-api-testing-example
cucumber java restassured serenity
Last synced: 19 days ago
JSON representation
API Test Automation Example with Serenity BDD
- Host: GitHub
- URL: https://github.com/roboticautomata/serenity-bdd-api-testing-example
- Owner: RoboticAutomata
- Created: 2024-02-18T16:18:59.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-02-24T15:50:48.000Z (11 months ago)
- Last Synced: 2024-11-02T14:42:04.440Z (2 months ago)
- Topics: cucumber, java, restassured, serenity
- Language: Java
- Homepage: https://linktr.ee/roboticautomata
- Size: 266 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# API Testing Example with SerenityRest BDD (and Cucumber)
This repo demonstrates how to do API Test Automation using SerenityRest (RestAssured under the hood) with Cucumber BDD format.* [API Testing Example with SerenityRest BDD (and Cucumber)](#api-testing-example-with-serenityrest-bdd-and-cucumber)
* [Application under Test](#application-under-test)
* [Exactly what APIs are we testing?](#exactly-what-apis-are-we-testing)
* [Add User](#add-user)
* [Login User](#login-user)
* [Logout User](#logout-user)
* [Repository Structure](#repository-structure)
* [Run the tests](#run-the-tests)
* [Resources](#resources)## Application under Test
We will be testing the [Thinking Tester Contact List App](https://thinking-tester-contact-list.herokuapp.com/)
Specifically, the [API](https://documenter.getpostman.com/view/4012288/TzK2bEa8)
## Exactly what APIs are we testing?
In case Thinking App goes down or the API is updated, here is the gist of the current APIs tested at the time of writing.
We specifically will cover the workflow of adding a new user, logging in and logging out.
### Add User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/usersRequest Body ->
{
"firstName": "Test",
"lastName": "User",
"email": "[email protected]",
"password": "myPassword"
}Response Status ->
201
```### Login User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/users/loginRequest Body ->
{
"email": "[email protected]",
"password": "myNewPassword"
}Response Status ->
200Response Body ->
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MDgyMWYzMDYyZmJiMjEzZTJhZDlhMjAiLCJpYXQiOjE2MTk3M
}
```### Logout User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/users/logoutHeader ->
Authorization: Bearer $tokenResponse Status ->
200
```## Repository Structure
```
src/test/resources/features
└── User.feature #the test scenario
``````
src/test/java/starter
├── apis #resquest specifications for various APIs
│ └── UserAPI.java
├── CucumberTestSuite.java #useful if running tests from an IDE
└── steps #step definitions for our feature files
└── UserSteps.java
```## Run the tests
```
mvn clean verify
```## Resources
- [Youtube Tutorial](https://youtu.be/Us1b191D6pQ?feature=shared)
- [Medium Blog Tutorial](https://medium.com/@RoboticAutomata/api-test-automation-tutorial-with-serenity-bdd-e40f2c34876f)