In a world where we had xRes fully automated, how would the
workflow of a new feature look like?
Here I create a imaginary scenario, and describe what would be
needed for it to happen.
Everything starts with the requirements
Story
As a Hotel Provider, I'd like to inform special conditions for reservations considered "Early Booking". Such information should be kept by xres and furthermore exported to midOffices systems.Details
An Early Booking can happen when a room reservation is made in a long term advance. The criteria to define the booking an Early Booking stays at the Hotel Provider side, so it decides when to apply and inform it.Acceptance Criteria
- Initial Providers that should support EB information: MTS, HBD
- Tags informed for EB: Deposit Price, Currency, Initial Deposit Date, Final Deposit Date
- xRes must retain the EB information in the Booking
- EB information should be displayed in the Booking Details page in xAdmin
- EB Tags must be present in the XML Request of the exports for Midoco and xMid
Assumptions
- The EB information will be provided by the Hotel Provider in its XML response from Actions BA or B.
- The EB Tags to be exported for MidOffices will follow the example provided and attached in this task.
After all the requirements clarified, the story can be broken
down into smaller tasks.
The development should make sure that not only the new
functionality has been achieved, but also that there is enough
evidence for it to be validated in both automated and human ways.
In parallel, the Test Cases can be written, asserting that all the requirements will be satisfied and without any side effects.
#TC1
Scenario
One Hotel Room with a single bed and all services included is booked for one man 6 months in advance.Steps
- With any booking interface, perform an Action BA.
- Perform an Action B.
- Export the new booking to MidOffices.
Expected Results
- A new Booking should be created.
- In the booking details page, information about Early Booking should be visible in the Hotel block.
- The Request XML of the export for xMid should contain the EB info in the correct standards.
- The Request XML of the export for Midoco should contain the EB info in the correct standards.
More complex scenarios could be created, or even scenarios
considering failures from third parties could also be considered.
For example, a family of two adults, one child and one infant book
two rooms, but the provider responds with invalid format dates in
one of the EB tags.
The Test Case should follow the same concept, and the Expected
Results should be established. But for this example, I we will
keep only the Happy Path.
The Functional tests should be running in a controlled and isolated environment, with a dedicated xRes instance and Database. That way, it is possible to break it without consequences.
Here's how it'd look like:
Explaining the diagram above, as said before, everything starts
with the Requirements (Test Cases).
As many Test Cases as possible are transcribed into Automated
Functional Tests, on a Test Automation Platform.
The Test Automation Platform can be any tool or technology that
supports High level automations. It could be Postman, Behat,
Selenium, Codeception, etc. The list goes on.
Regardless of the solution, the Automated Tests Platform should be
capable of:
Given that the solution which I have more experience with is Behat, and I know for a fact that it supports such low level actions behind the system, we'll use it in this example.
In Behat Gherkin language, a test would be something like this:
Feature: In order to see the Early Booking information As a xAdmin user, I want to book a room and export it. Scenario: Book an Early Booking Hotel Room and export it. Given my name is "Rodrigo Cinto", 31 years old, email "r.cinto@traso.de" And I live in "Leipzig", address "Nonnenstrasse42", Zipcode "04229" And I book a Hotel BERLIN with services DZZA And from "201120" to "221120" When I make an Action BA And I make an Action B And the Hotel Provider responds an Early Booking with Deposit Price '100.00', Currency 'EUR', Initial Payment Date '2020-02-05', Final Payment Date '2020-11-05' And I execute the MidOffices export queue Then I would like to see "Early Booking" and "2020-02-05 - 100.00 EUR" in the "Last booking details page" And I would like to see "Early Booking: 2020-02-05 - 100.00 EUR" in the "Midoco export logs" And I would like to see "Early Booking: 2020-02-05 - 100.00 EUR" in the "xMid export logs"
It seems a little sorcery, but Behat allows you to create a PHP
function for each one of those statements with help of Regular
Expressions.
To possibilitate full environment control, the responses from the
External Services Providers like Hotel, Flights and Transfers must
be provided by a Fake API Server, or Provider Simulator.
This Fake API Server is a very important component, which can be
configured to answer to any request, with any response, following
the Tests Requirements.
To make sure the Tests don't compromise other environments, a
separated instance of xRes and Databases should be provisioned as
well, with copy cats of Hotels, Flights, Users, and so on.
The new tests are then stashed among all the other previously
created tests, each one of them with their own setup, execution,
assertions, and tear down.
Now it is time to integrate the Automated Functional Tests with
the rest of the workflow.
Good thing about automation is that we can run it whenever we
want. Therefore, we should be able to decide whether we'd like to
run the tests or not during a new Release launch. Is it a heavy
push? We should wait for the tests to be executed. Is it a hotfix
that needs to be pushed as quick as possible? Leave the Functional
Tests for later.
It would even be possible to schedule periodic executions, in
order to make sure the system is tidy and there are no hidden
surprises in old delivered features.
Still speaking of Releases, after it is done, only then we can finally check manually the Test Cases we couldn't or didn't want to automate, but in a perfect world they should be minimal verifications.
Not much.