Files
mylibrary/src/test/resources/features/book.feature
2025-06-12 23:45:47 +02:00

63 lines
3.5 KiB
Gherkin

# language: en
Feature: Manage books
# ----------------------------Background---------------------------------
Background:
Given the system has the following books:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978123456 | The Odyssey | Homer | Penguin | 2000-01-01 | 10.0 | 5 | EN |
| 978654321 | War and Peace | Leo Tolstoy | Vintage | 2005-05-10 | 15.0 | 2 | EN |
# ----------------------------Scénario 1---------------------------------
Scenario: Register a new book
When I register a new book with the following information:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978111111 | New Book | New Author | NewPub | 2022-10-10 | 20.0 | 10 | EN |
Then the book is successfully registered
And the system now has 3 books
# ----------------------------Scénario 2---------------------------------
Scenario: Get all books
When I request all books
Then I receive the following books:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978123456 | The Odyssey | Homer | Penguin | 2000-01-01 | 10.0 | 5 | EN |
| 978654321 | War and Peace | Leo Tolstoy | Vintage | 2005-05-10 | 15.0 | 2 | EN |
# ----------------------------Scénario 3---------------------------------
Scenario: Get a book by ID
When I request the book with id "978123456"
Then I receive the following book information:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978123456 | The Odyssey | Homer | Penguin | 2000-01-01 | 10.0 | 5 | EN |
# ----------------------------Scénario 4---------------------------------
Scenario: Attempt to register a book with invalid data
When I try to register a new book with the following information:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| | | | | | | | |
Then the registration fails
And I receive an error message containing "Invalid book data provided"
And the system still has 2 books
# ----------------------------Scénario 5---------------------------------
Scenario: Attempt to register a book with an existing ISBN
When I try to register a new book with the following information:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978123456 | The Odyssey | Homer | Penguin | 2000-01-01 | 10.0 | 5 | EN |
Then the registration fails
And I receive an error message containing "Conflict with existing book in database"
And the system still has 2 books
# ----------------------------Scénario 6---------------------------------
Scenario: Attempt to get a book with unknown ID
When I request the book with id "999999999"
Then the request fails
And I receive an error message containing "Book not found"
# ----------------------------Scénario 7---------------------------------
Scenario: Attempt to get all books with a filter that matches nothing
When I request all books with title "Nonexistent Book"
Then I receive an empty list of books