Hotel Booking Example
pytest 9.2.0 pytest-given 0.6.0
Module:
A search offers only the available rooms
✓ passed 0ms
Given
our organizer Carol
the Deluxe Suite is listed as available
When
Carol searches for a Room
Then
only the Deluxe Suite is offered
When
Carol selects the Deluxe Suite
Then
the Deluxe Suite is selected for the group
A paid booking is confirmed to every guest
✓ passed 0ms
Given
our organizer Carol
our guest Alice
our guest Bob
Carol has selected the Deluxe Suite
When
Carol adds Alice and Bob to the Booking
Carol submits the Payment for the Booking
Then
the Booking System confirms the Booking
the Booking System sends the Confirmation to Alice and Bob
When
Alice and Bob check in to the Deluxe Suite
Then
both guests are checked in
A declined payment leaves the booking pending
✗ failed 41ms
Given
our organizer Carol
our guest Alice
our guest Bob
Carol has added Alice and Bob to the Booking
When
Carol submits the Payment by {payment_method} for the Booking
Then
the Booking System declines the Payment because of {decline_reason}
the Booking stays pending and no Confirmation is sent to Alice or Bob
payment_method decline_reason status
credit card insufficient funds ✓
debit card expired card ✓
bank transfer fraud check failed ✓
gift card partial balance ✗
assert 'unsupported payment method' == 'partial balance' - partial balance + unsupported payment method
examples/hotel-booking/test_hotel_booking.py:313: in test_payment_declined
    assert response == decline_reason
E   AssertionError: assert 'unsupported payment method' == 'partial balance'
E     
E     - partial balance
E     + unsupported payment method
Cancelling a paid booking refunds it and notifies the guest
✓ passed 0ms
Given
our guest Alice
Alice has a confirmed Booking she paid for
When
Alice cancels the Booking
Then
the Booking System refunds the Payment for the Booking
the Booking System sends a Confirmation to Alice
Rebooking restores a cancelled booking
⊗ expected failure 3ms
Expected to fail: rebooking is not implemented yet
Given
our guest Alice
Alice has cancelled her stay
When
Alice rebooks the Booking
rebooking a cancelled booking is not supported yet
examples/hotel-booking/test_hotel_booking.py:360: in test_rebook_cancelled_booking
    rebook_cancelled_booking(stay)
examples/hotel-booking/test_hotel_booking.py:348: in rebook_cancelled_booking
    raise NotImplementedError('rebooking a cancelled booking is not supported yet')
E   NotImplementedError: rebooking a cancelled booking is not supported yet
A booking can be cancelled only before its guest checks in
✓ passed 0ms
Given
our guest Alice
Alice has a confirmed Booking now and one next month
When
Alice checks in to the Deluxe Suite
Then
her current stay is checked in
When
Alice cancels her later Booking
Then
the later booking is cancelled
When
she tries to cancel the stay she has checked in to
Then
the cancellation is refused
Book a Group Trip
8 sentences4 scenarios
Carolsearches forRoom
search 1 scenario
CarolselectsDeluxe Suite
select 2 scenarios
CaroladdsAlicetoBooking
CaroladdsBobtoBooking
2 scenarios1 failing
CarolsubmitsPaymentforBooking
2 scenarios1 failing
Booking SystemconfirmsBooking
1 scenario
Booking SystemsendsConfirmationtoAlice
Booking SystemsendsConfirmationtoBob
1 scenario
Carolredeemsloyalty points
no coverage
Alicechecks in toDeluxe Suite
Bobchecks in toDeluxe Suite
2 scenarios
Scenarios
Covers:
Covers:
Covers:
Covers:
Cancel a Booking
4 sentences3 scenarios
AlicecancelsBooking
cancel 2 scenarios
Booking SystemrefundsPaymentforBooking
1 scenario
Booking SystemsendsConfirmationtoAlice
1 scenario
Aliceasks to rebookBooking
rebook 1 scenario1 expected to fail
Scenarios
Covers:
Covers:
Covers:
Glossary
14 terms 3 actors 5 work objects 6 activities
Booking
Booking
A claim on one or more rooms for given dates.
2 stories5 scenarios
Confirmation
Notification of a successful booking.
2 stories3 scenarios
confirm
Guarantee a paid booking so its rooms are held for arrival.
1 story1 scenario
cancel
Withdraw a booking before arrival.
1 story2 scenarios
rebook
Restore a cancelled booking for the same rooms and dates.
1 other form1 story1 scenario
Payment
Payment
Money transferred for a booking.
2 stories3 scenarios
decline
Refuse a payment, leaving its booking pending.
1 scenario
refund
Return the payment for a cancelled booking.
1 story1 scenario
Other
Organizer
Person booking accommodation on behalf of a group.
1 other form1 story3 scenarios
Guest
Individual traveler in the group.
2 other forms2 stories5 scenarios
Booking System
Automated back-end for stays.
2 stories3 scenarios
Room
A bookable hotel room.
1 other form1 story3 scenarios
redeems
Undefined
1 story
loyalty points
Undefined
1 story
Actors
Work Objects
Activities
No terms match this filter.