Steps
- Pick a check-in date and a later check-out date
- Fill in first name, last name, a valid email and an 11-character phone
- Confirm the booking
Expected result
The booking-confirmed message is shown with the chosen dates.
Three QA tasks where I use AI every day: designing test cases, diagnosing failures and writing API tests. Pick an example and see what goes in and what comes out.
1 / 3
In: a user story with its acceptance criteria. Out: test cases with boundary values and negative cases, plus the questions the story leaves open.
Input
User story:
As a hotel visitor I want to book a room by choosing check-in and check-out dates and leaving my contact details, so that I can confirm my stay.
Acceptance criteria:
- Check-in and check-out dates are required and check-out must be after check-in.
- First and last name are required.
- The email must have a valid format.
- The phone must be between 11 and 21 characters long.
- On confirming, a booking-confirmed message is shown with the chosen dates.
Output
Steps
Expected result
The booking-confirmed message is shown with the chosen dates.
Steps
Expected result
A length error is shown on the phone field and the booking is not created.
Steps
Expected result
Both bookings are accepted.
Steps
Expected result
A length error is shown and the booking is not created.
Steps
Expected result
The booking is not allowed and the message says check-out must be after check-in.
Steps
Expected result
A format error is shown on the email field and the booking is not created.
Questions the story leaves unanswered
Input
User story:
As an administrator I want to log in with my username and password, so that I can manage the hotel rooms.
Acceptance criteria:
- With valid credentials the admin menu is shown (Rooms, Report).
- With invalid credentials an error message is shown and the administrator stays on the login form.
- Without logging in, the rooms panel cannot be seen.
- On logging out, the user returns to the front page and the admin menu disappears.
Output
Steps
Expected result
The admin menu with Rooms and Report is shown.
Steps
Expected result
An error message appears, the form is still visible and the admin menu does not appear. Wait for the message first: checking that something is "not there" passes instantly and does not prove the server has answered.
Steps
Expected result
The user is not logged in and the admin menu does not appear.
Steps
Expected result
No room data is shown.
Steps
Expected result
The user returns to the front page and the admin menu disappears.
Questions the story leaves unanswered
2 / 3
In: an error trace with a little context. Out: a diagnosis: what happened, probable cause, evidence in the trace, how to fix it and how to confirm it.
Input
Context: Playwright (pytest) test against the practice app. Test: test_admin_login_wrong_password_shows_rooms_menu_probe
E AssertionError: Locator expected to be visible
E Actual value: None
E Error: element(s) not found
E Call log:
E - Expect "to_be_visible" with timeout 5000ms
E - waiting for get_by_role("link", name="Rooms")
tests/admin/test_admin_negative.py:18: AssertionError
Output
Summary
The test expected to see the "Rooms" link (admin menu) after logging in, but the link did not appear within the 5-second wait.
Probable cause
Most likely the test is wrong, not the application: the test name says the login used a wrong password, and with invalid credentials the admin menu should not appear. The locator is valid; there is simply nothing to find.
Evidence in the trace
How to fix it
How to confirm it
Severity
Low — a test error, not a product error
Input
Context: running pytest on the API suite fails before any test runs.
Traceback (most recent call last):
File "pytest.exe\__main__.py", line 6, in <module>
File "allure_pytest_bdd\plugin.py", line 18, in pytest_addoption
parser.getgroup("reporting").addoption("--alluredir", ...)
File "_pytest\config\argparsing.py", line 357, in addoption
raise ValueError(f"option names {conflict} already added")
ValueError: option names {'--alluredir'} already added
Output
Summary
pytest fails while loading plugins, before running any test: two plugins try to register the same command-line option, "--alluredir".
Probable cause
allure-pytest and allure-pytest-bdd are installed in the same environment and both load automatically. Each declares "--alluredir" and pytest does not allow two options with the same name. This is not a bug in the test code.
Evidence in the trace
How to fix it
How to confirm it
Severity
Medium — it blocks the whole suite, but the fix is configuration
3 / 3
In: the spec of an endpoint. Out: a pytest + requests suite, with unique data per test and the API's known defects marked as such.
Input
POST https://restful-booker.herokuapp.com/auth
Content-Type: application/json
Body: {"username": "admin", "password": "password123"}
Valid credentials: 200 {"token": "<string>"}
Invalid credentials: 200 {"reason": "Bad credentials"}
Output
import requests
BASE_URL = "https://restful-booker.herokuapp.com"
def test_auth_valid_credentials_returns_token():
response = requests.post(
f"{BASE_URL}/auth",
json={"username": "admin", "password": "password123"},
timeout=30,
)
assert response.status_code == 200
token = response.json()["token"]
assert isinstance(token, str) and token
def test_auth_invalid_credentials_returns_reason_not_token():
# The API answers 200 even for bad credentials, so the body decides, not the status code.
response = requests.post(
f"{BASE_URL}/auth",
json={"username": "admin", "password": "wrong-password"},
timeout=30,
)
assert response.status_code == 200
body = response.json()
assert "token" not in body
assert body["reason"] == "Bad credentials"
def test_auth_missing_password_returns_reason_not_token():
response = requests.post(f"{BASE_URL}/auth", json={"username": "admin"}, timeout=30)
body = response.json()
assert "token" not in body
assert body["reason"] == "Bad credentials"
Notes
Input
POST https://restful-booker.herokuapp.com/booking
Content-Type: application/json
Accept: application/json
Body: {"firstname": string, "lastname": string, "totalprice": number,
"depositpaid": boolean,
"bookingdates": {"checkin": "YYYY-MM-DD", "checkout": "YYYY-MM-DD"},
"additionalneeds": string (optional)}
Response: 200 {"bookingid": number, "booking": {...}}
GET /booking/{id} returns the created booking.
Output
import uuid
import pytest
import requests
BASE_URL = "https://restful-booker.herokuapp.com"
HEADERS = {"Content-Type": "application/json", "Accept": "application/json"}
def new_booking():
# Every test builds its own data, with a unique component.
return {
"firstname": "Ana",
"lastname": f"Prueba-{uuid.uuid4().hex[:8]}",
"totalprice": 150,
"depositpaid": True,
"bookingdates": {"checkin": "2026-11-01", "checkout": "2026-11-05"},
"additionalneeds": "Breakfast",
}
def create(payload):
return requests.post(f"{BASE_URL}/booking", json=payload, headers=HEADERS, timeout=30)
def test_create_booking_valid_payload_returns_id_and_echoes_data():
payload = new_booking()
response = create(payload)
assert response.status_code == 200
body = response.json()
assert isinstance(body["bookingid"], int)
assert body["booking"] == payload
def test_create_booking_can_be_read_back_with_same_data():
payload = new_booking()
booking_id = create(payload).json()["bookingid"]
response = requests.get(f"{BASE_URL}/booking/{booking_id}", headers=HEADERS, timeout=30)
assert response.status_code == 200
assert response.json() == payload
def test_create_booking_missing_firstname_returns_server_error():
# Verified real behaviour: the API answers 500 (not 400) to an incomplete payload.
payload = new_booking()
del payload["firstname"]
assert create(payload).status_code == 500
def test_get_booking_unknown_id_returns_404():
response = requests.get(f"{BASE_URL}/booking/99999999", headers=HEADERS, timeout=30)
assert response.status_code == 404
@pytest.mark.xfail(strict=True, reason="The API accepts a non-numeric price and stores it as null")
def test_create_booking_non_numeric_price_is_rejected():
payload = new_booking()
payload["totalprice"] = "a lot"
assert create(payload).status_code >= 400
Notes