How To Install python-gabbi on Ubuntu 18.04

In this tutorial we learn how to install python-gabbi on Ubuntu 18.04. python-gabbi is declarative HTTP testing library - Python 2.x

Introduction

In this tutorial we learn how to install python-gabbi on Ubuntu 18.04.

What is python-gabbi

python-gabbi is:

Gabbi is a tool for running HTTP tests where requests and responses are represented in a declarative form.

Gabbi works to bridge the gap between human readable YAML files that represent HTTP requests and expected responses and the obscured realm of Python-based, object-oriented unit tests in the style of the unittest module and its derivatives.

Each YAML file represents an ordered list of HTTP requests along with the expected responses. This allows a single file to represent a process in the API being tested. For example:

  • Create a resource.
  • Retrieve a resource.
  • Delete a resource.
  • Retrieve a resource again to confirm it is gone.

At the same time it is still possible to ask gabbi to run just one request. If it is in a sequence of tests, those tests prior to it in the YAML file will be run (in order). In any single process any test will only be run once. Concurrency is handled such that one file runs in one process.

These features mean that it is possible to create tests that are useful for both humans (as tools for improving and developing APIs) and automated CI systems.

This package contains the Python 2.x module.

There are three methods to install python-gabbi on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-gabbi Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-gabbi using apt-get by running the following command:

sudo apt-get -y install python-gabbi

Install python-gabbi Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-gabbi using apt by running the following command:

sudo apt -y install python-gabbi

Install python-gabbi Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-gabbi using aptitude by running the following command:

sudo aptitude -y install python-gabbi

How To Uninstall python-gabbi on Ubuntu 18.04

To uninstall only the python-gabbi package we can use the following command:

sudo apt-get remove python-gabbi

Uninstall python-gabbi And Its Dependencies

To uninstall python-gabbi and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-gabbi

Remove python-gabbi Configurations and Data

To remove python-gabbi configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-gabbi

Remove python-gabbi configuration, data, and all of its dependencies

We can use the following command to remove python-gabbi configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-gabbi

References

Summary

In this tutorial we learn how to install python-gabbi package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.