step book

This commit is contained in:
2025-06-12 22:01:51 +02:00
parent 76f2145629
commit a27dba9ad2
2 changed files with 186 additions and 1 deletions

View File

@@ -2,12 +2,15 @@
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 |
@@ -15,6 +18,7 @@ Feature: Manage books
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:
@@ -22,12 +26,14 @@ Feature: Manage books
| 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 |
@@ -36,6 +42,7 @@ Feature: Manage books
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 |
@@ -44,11 +51,13 @@ Feature: Manage books
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