Skip to content

Collection of API tests for Restful-Booker || Stack: Java 17, JUnit 5, REST Assured || Status - Finished

Notifications You must be signed in to change notification settings

kat-kan/restful-booker-api-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

restful-booker-api-tests

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).

Installation

There are few ways to start using this repository:

  1. Clone with Git using command line and this command: git clone https://github.com/kat-kan/restful-booker-api-tests
  2. Clone with Git using graphical user interface (for example Sourcetree)
  3. Download ZIP with the code (using option shown in the screenshot below)

image

Authentication

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: image

Running the tests

You can run tests:

  • using "Run test" option in Intellij Idea IDE
  • using mvn clean test command in terminal

Allure Reporting

Allure reports are configured for this project. To get the report, you can use these commands:

  • mvn allure:serve (recommended) - opens browser with generated report
  • mvn allure:report - generates report to temp folder

allureReport

Issues found

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

About

Collection of API tests for Restful-Booker || Stack: Java 17, JUnit 5, REST Assured || Status - Finished

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages