portfolio / demos
andresqe.duckdns.org · HTTPS · up
AI demos

AI applied to QA, with real examples

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

Test case generator

In: a user story with its acceptance criteria. Out: test cases with boundary values and negative cases, plus the questions the story leaves open.

Do not paste real or confidential data. The text is sent to Groq to generate the answer; this site does not store or log it, and the provider processes it under its own terms.

Up to 4000 characters. There is a per-visitor limit and a daily limit for the whole site.

What comes out is an unverified draft, generated by an AI on the spot.

Booking a room Generated with Claude Sonnet 5.5

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

TC-01 Functional Successful booking with valid data

Steps

  1. Pick a check-in date and a later check-out date
  2. Fill in first name, last name, a valid email and an 11-character phone
  3. Confirm the booking

Expected result

The booking-confirmed message is shown with the chosen dates.

TC-02 Boundary value 10-character phone (one below the minimum)

Steps

  1. Fill the form with valid data and a phone of exactly 10 characters
  2. Confirm the booking

Expected result

A length error is shown on the phone field and the booking is not created.

TC-03 Boundary value 11- and 21-character phones (both valid limits)

Steps

  1. Book with a phone of exactly 11 characters
  2. Repeat the booking with one of exactly 21

Expected result

Both bookings are accepted.

TC-04 Boundary value 22-character phone (one above the maximum)

Steps

  1. Fill the form with valid data and a 22-character phone
  2. Confirm the booking

Expected result

A length error is shown and the booking is not created.

TC-05 Negative Check-out date before check-in

Steps

  1. Pick a check-out date earlier than the check-in date
  2. Fill the rest with valid data
  3. Confirm the booking

Expected result

The booking is not allowed and the message says check-out must be after check-in.

TC-06 Negative Email with an invalid format

Steps

  1. Type an email without an at-sign
  2. Fill the rest with valid data
  3. Confirm the booking

Expected result

A format error is shown on the email field and the booking is not created.

Questions the story leaves unanswered

  • What happens if the chosen dates are already booked? The story does not say.
  • Is there a maximum number of nights per booking?
  • Does the phone accept symbols such as + or spaces, or digits only?
  • Can the check-in date be in the past?
Administrator login Generated with Claude Sonnet 5.5

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

TC-01 Functional Login with valid credentials

Steps

  1. Open the admin login
  2. Type a valid username and password
  3. Click Login

Expected result

The admin menu with Rooms and Report is shown.

TC-02 Negative Wrong password

Steps

  1. Type a valid username and a wrong password
  2. Click Login
  3. Wait for the error message to appear

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.

TC-03 Negative Empty fields

Steps

  1. Leave username and password empty
  2. Click Login

Expected result

The user is not logged in and the admin menu does not appear.

TC-04 Security Direct access to the panel without a session

Steps

  1. In a fresh session, open the rooms panel URL directly

Expected result

No room data is shown.

TC-05 Functional Log out

Steps

  1. Log in with valid credentials
  2. Click Logout

Expected result

The user returns to the front page and the admin menu disappears.

Questions the story leaves unanswered

  • Is there a lockout after several failed attempts? The story does not mention it.
  • Does the error message reveal whether the user exists? A generic message is preferable.
  • Does the session expire after inactivity?

2 / 3

Bug analyzer

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.

Do not paste real or confidential data. The text is sent to Groq to generate the answer; this site does not store or log it, and the provider processes it under its own terms.

Up to 4000 characters. There is a per-visitor limit and a daily limit for the whole site.

What comes out is an unverified draft, generated by an AI on the spot.

Playwright: the Rooms link never shows up Generated with Claude Sonnet 5.5 Real case from this project

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

  • "element(s) not found" after exhausting the full timeout: the element does not exist, so this is not a slow-load problem.
  • The test name contradicts itself: "wrong_password" and "shows_rooms_menu".
  • The trace shows no network or other error: the page loaded.

How to fix it

  • Change the expectation: with a wrong password, check that the menu does NOT appear and that the error message is shown.
  • If the test was meant to log in, use valid credentials.
  • Wait for the error message first, before checking that the menu is absent.

How to confirm it

  • Check the aria snapshot taken at the time of the failure: it should show the login form with an "alert" element.
  • Re-run the test with valid credentials: the link should appear.

Severity

Low — a test error, not a product error

pytest blows up on startup Generated with Claude Sonnet 5.5 Real case from this project

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

  • The exception comes from "pytest_addoption" in "allure_pytest_bdd", that is, during startup.
  • The message says "already added": something else registered that option first.
  • No test appears in the output: pytest never got to collect them.

How to fix it

  • Disable one of the two plugins in pytest.ini with "-p no:allure_pytest_bdd" (the one that suite does not use).
  • If a suite needs both at different times, enable them one at a time with "-p allure_pytest" or "-p allure_pytest_bdd".
  • Write the restriction down in the docs so it is not rediscovered.

How to confirm it

  • List the installed packages and confirm both Allure plugins are there.
  • Run pytest with "-p no:allure_pytest_bdd" and check that it starts.

Severity

Medium — it blocks the whole suite, but the fix is configuration

3 / 3

API test generator

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.

Do not paste real or confidential data. The text is sent to Groq to generate the answer; this site does not store or log it, and the provider processes it under its own terms.

Up to 4000 characters. There is a per-visitor limit and a daily limit for the whole site.

What comes out is an unverified draft, generated by an AI on the spot.

Authentication (POST /auth) Generated with Claude Sonnet 5.5 Run against the real API before publishing · 3 passed

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

  • The spec already flags something unusual: invalid credentials answer 200, not 401. That is why the tests inspect the body instead of trusting the status code alone.
  • The missing-password case, which the spec does not mention, was also checked: it answers the same as a wrong password.
Create a booking (POST /booking) Generated with Claude Sonnet 5.5 Run against the real API before publishing · 4 passed, 1 xfailed

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

  • Each test builds its own data with a unique component (uuid), because the API is shared and a fixed value can clash with another run's.
  • A payload without "firstname" answers 500, not 400: that is the real behaviour and the test documents it as is.
  • The last test documents a real defect as "xfail(strict=True)": today the API accepts a non-numeric price and stores it as null. If it is ever fixed, the test will pass and fail loudly so the mark can be removed.