ChaosQA · Guides

Booking overlap test cases: double booking checks

Updated November 21, 2026

A booking system has one rule that matters more than any field check: the same resource cannot be taken twice at the same moment. The rule is one comparison in code, and it tends to break in the same few places. This page lists test cases for each of them, with expected results.

The examples use meeting rooms and times of day, but the cases carry over to hotel nights and appointments. For the basic set on a single REST endpoint (back to back, starts inside, covers completely) see REST API test cases; the sections below go past it.

The rule and its usual mistakes

Two bookings of one resource overlap when each starts before the other ends: newStart < oldEnd && oldStart < newEnd. Overlap bugs usually come from a line that looks close to it and passes the obvious test:

CodePassesFails on
<= instead of <Any real overlap10:00–11:00 next to 11:00–12:00 is rejected
Only "new start is inside an old booking"10:30–11:30 against 10:00–11:0009:30–10:30 and 09:00–12:00 are accepted
Only "new start or new end is inside"Partial overlaps on both sides09:00–12:00 covers the old booking and is accepted
Compares against the first booking foundA room with one bookingThe conflict is with the second booking of the day
Equal start times treated as "no overlap"Different startsAn exact copy of an existing booking is accepted

The fourth row needs a room with at least three bookings on the same day, and the conflict should be with the last one created.

Which bookings take part in the check

The check also depends on which existing bookings it reads. Set up each of these states on the slot, then try to book it:

Existing booking on the slotExpected for a new booking
CancelledAccepted
Deleted, if the system keeps deleted rowsAccepted
Pending or on hold (payment not finished)Rejected while the hold lasts
Hold that has expiredAccepted
Belongs to another userRejected, and the message does not show that user's details
Same time, another room or another branchAccepted
Same room id in another account or tenantAccepted, if rooms are separate per account

Editing adds one more case. Moving a booking within its own time, for example from 10:00–11:00 to 10:00–11:30, must not conflict with itself. A check that forgets to exclude the booking being edited rejects every extension. A check that excludes it by the wrong id lets an edit land on someone else's slot.

Capacity greater than one

A room with two desks, a class with ten seats or a hotel with five rooms of one type has a capacity. The rule becomes "at no moment more than N bookings". Counting how many bookings overlap the new one gives a different answer, as the first row shows.

Capacity 2, existingNewMost at one momentExpected
09:00–10:00, 10:00–11:0009:30–10:302Accepted
09:00–10:00, 09:30–10:3009:45–09:503Rejected
09:00–10:00, 09:00–10:0010:00–10:152Accepted

In the first row the new booking overlaps two bookings, but those two never meet, so no more than two are in use at any moment. Code that counts overlapping bookings gets 2, compares it with the capacity and rejects a free slot. To find the opposite error, fill the capacity and then try one more booking in the busiest minute. Check the edit path too: shortening one booking should free capacity, and extending one should be checked against the full count.

Buffers between bookings

Many systems keep time free after a booking for cleaning or changeover. With a 15-minute buffer and an existing booking 10:00–11:00, a new one-hour booking:

New startExpected
11:00Rejected
11:10Rejected
11:15Accepted
08:45 (ends 09:45)Accepted
08:50 (ends 09:50)Rejected

The last two rows test the buffer before the booking. A common shortcut adds the buffer only to the end of the old booking, so a new booking that ends inside the buffer before it is accepted. Ask whether the buffer belongs to each booking or to the gap between them, and whether it counts at opening and closing time.

Bookings that cross midnight

A booking from 22:00 to 02:00, stored as two times of day without dates, has an end smaller than its start. The standard comparison then gives wrong answers in both directions:

ExistingNewReal overlapCompared as times only
22:00–02:0023:00–23:30YesNo conflict
22:00–02:0001:00–03:00 the next dayYes, 01:00–02:00No conflict

Test what the system does with a booking that ends after midnight: rejects it, stores it as two days, or stores it with full dates. Then try both rows above, and a booking that starts at 00:00 on the next day. For hotel nights the same question is whether check-out day counts as booked: the usual rule is that a stay from the 10th to the 12th leaves the 12th free for the next guest's arrival.

Daylight saving time

On November 7, 2027 New York clocks go back from 02:00 to 01:00, so 01:00–02:00 happens twice. A booking from 01:00 to 01:45 before the change and one from 01:15 to 01:45 after it look like an overlap on the wall clock. In UTC they are 05:00–05:45 and 06:15–06:45, half an hour apart.

Test (New York, 2027)Expected
The two bookings above on November 7Accepted, if the system stores moments; the app says which 01:15 it means
Booking 01:30–03:30 on March 14Takes 1 hour, since 02:00–03:00 does not exist that night
Booking at 02:30 on March 14Rejected or moved, with a message
Room in New York, user in Berlin, March 14–28The overlap is decided in the room's zone; the zones are 5 hours apart, not 6

More cases for time zones and clock changes are in date and time testing.

Two requests at the same moment

A server that reads existing bookings, checks for overlap and then inserts can accept two requests for the same slot if they arrive within a few milliseconds. Each one checks before the other has saved. From a shell:

for i in 1 2 3 4 5; do
  curl -s -o /dev/null -w "%{http_code}\n" -X POST "$API/bookings" \
    -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
    -d '{"room":"r1","date":"2027-03-02","start":"10:00","end":"11:00"}' &
done; wait

Expected: one success and four conflicts, then a list of bookings with exactly one for the slot. Run it several times, since a race does not show up on every run. Repeat with two different users, and with two overlapping but not equal slots (10:00–11:00 and 10:30–11:30), because a unique index on the start time stops only exact copies. In a browser the same test is a double click on the submit button; double submit testing covers that side.

Recurring bookings

A weekly series every Monday from January 4, 2027 for six weeks ends on February 8. Book one of the middle Mondays, say January 25, for someone else first, then create the series:

What the user sees

A calendar or a list of free slots runs its own query, and it can disagree with the check on save. For each case above compare three answers: the slot as shown on the page, the result of booking it, and the slot as shown after reload. A slot shown as free that fails on save, or one shown as taken that the API accepts, is a bug even when the overlap check itself is correct. The same goes for a check done only in the page: send the request straight to the API with a taken slot and expect a conflict.

The conflict message should name the room and the time it collides with, and keep the user's input. Status code for an API: 409 Conflict is the usual choice; 400 or 500 for a taken slot is worth a report.

Try it on a live API. RoomBox is a practice REST API for booking meeting rooms. Bookings have a room, a date, a start and an end, and the rules cover overlaps, opening hours and limits per user. Each session has bugs planted in some of these rules, and the report is checked when you send it.
Open the API exercise

More guides: REST API test cases · date and time testing · all guides