Collection of API tests for Restful-Booker
App links : Restful -Booker, Restful-Booker API Docs
Restful-Booker is Web API playground created by Mark Winteringham. It offers authentication, CRUD operations and is loaded with bugs (for the purpose of learning).
There are few ways to start using this repository:
- Clone with Git using command line and this command:
git clone https://github.com/kat-kan/restful-booker-api-tests
- Clone with Git using graphical user interface (for example Sourcetree)
- Download ZIP with the code (using option shown in the screenshot below)
According to the docs, you need the auth token for PUT
, PATCH
and DELETE
methods. I wanted to write tests like in a "real" project, so the credentials are not provided in the code. You can find credentials info here. The credentials should be entered in restful-booker.properties file:
You can run tests:
- using "Run test" option in Intellij Idea IDE
- using
mvn clean test
command in terminal
Allure reports are configured for this project. To get the report, you can use these commands:
mvn allure:serve
(recommended) - opens browser with generated reportmvn allure:report
- generates report to temp folder
As mentioned, Restful Booker API has some bugs for the fun of its testers. Here are the ones that I found:
https://restful-booker.herokuapp.com/booking
- Get Booking Ids
- Filtering by checkout date does not work: returns random results instead of bookings with greater or equal checkout date. For that reason, I had to use @Disabled annotation for test with checkout dates
https://restful-booker.herokuapp.com/booking
- Create Booking
- Total price value cannot be a floating number; precision is lost during saving.
- Checkin and checkout dates are validated and booking is not created, but 200 OK status code is returned; 400 Bad Request would be better
https://restful-booker.herokuapp.com/booking/1
- Delete Booking
- Auth can be set only via Cookie header, doesn't work with Authorization header (returns 403 Forbidden)
- Successful Delete action returns 201 Created, which is rather poor choice for delete action. It's rather used when creating new data.
- Delete non existing booking returns 405 Method Not Allowed. I believe it should be 404 Not Found and marked my test as @Disabled.
https://restful-booker.herokuapp.com/ping
- HealthCheck
- Ping returns 201 Created - I believe 200 OK would be a better choice