An automated API / web service / integration testing framework
The framework using the following:
- Allure Report - A flexible lightweight test report tool.
- Faker - A library for generating fake data such as names, addresses, and phone numbers.
- Parallel tests - Speed up RSpec by running parallel on multiple CPU cores.
- Pry - A runtime developer console.
- Rake - Allows us to create tasks to manage dependencies and run our checks.
- Rest-client - Builds and triggers HTTP requests whilst handling
- Rspec - Framework to create and organise our checks. responses to be used in our checks.
- Rubocop - RuboCop is a Ruby static code analyzer (a.k.a. linter ) and code formatter..
- Ruby - A popular language with testers.
The framework contains following areas:
spec
- stores automated checks. The tests will call functions from the API and Payload areas of the framework and be responsible for asserting responses.api
- a library of API endpoints which are used in spec to communication with restful-booker. They are grouped based on the resource you are calling so if there are two resources called Booking and Auth then we create two classes named Booking and Auth. Each function is tied to an individual request that can be called multiple times. This means if the request changes it requires a single change to propagate through the framework.payloads
a suite of builders to create payloads for POST requests. Payloads that are required for requests and responses are stored in this area. The idea is similar to the API area in that one class is responsible for one payload that may be called multiple times. Again, this means if the payload changes it requires a single change to propagate through the framework.gemfile
/Rakefile
manages the running of framework and it’s dependencies.steps
- Preconditions and/or multi-action test steps.
Suite of automated checks against the web service restful-booker
-
Clone this repository.
-
Run the following step that installs the necessary dependencies. Bundler is required.
bundle install
ENV_URL
-> defaults to https://restful-booker.herokuapp.com, any valid url can be passed to set the target
environment.
To start tests, run:
bundle exec rake
or execute individual test with provided ID (symbol after test's name, which contains digits enclosed in
quotes: tms:'101'
)
bundle exec rspec --tag tms:101
Run tests in parallel:
bundle exec parallel_rspec
To generate the report from existing Allure results you can use the following command:
allure generate report/allure-results --clean
When the report is generated you can open it in your default system browser. Simply run:
allure open allure-report
For more info, please visit: Allure Framework official documentation
restful-booker detailed API documentation
@FriendlyTester has a great blog post on what the builder pattern is and it’s context to data creation.