How To Install python-webunit on Ubuntu 18.04

In this tutorial we learn how to install python-webunit on Ubuntu 18.04. python-webunit is Unit testing for web apps with code that acts like a web browser.

Introduction

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

What is python-webunit

python-webunit is:

This is Richard Jones’ webunit. It has the following features:

  1. Browser-like page fetching including fetching the images and stylesheets needed for a page and following redirects
  2. Cookies stored and trackable (all automatically handled)
  3. HTTP, HTTPS, GET, POST, basic auth all handled, control over expected status codes, …
  4. DOM parsing of pages to retrieve and analyse structure, including simple form re-posting
  5. Two-line page-fetch followed by form-submit possible, with error checking
  6. Ability to register error page content across multiple tests
  7. Uses python’s standard unittest module as the underlying framework

There are three methods to install python-webunit 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-webunit 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-webunit using apt-get by running the following command:

sudo apt-get -y install python-webunit

Install python-webunit Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-webunit

Install python-webunit 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-webunit using aptitude by running the following command:

sudo aptitude -y install python-webunit

How To Uninstall python-webunit on Ubuntu 18.04

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

sudo apt-get remove python-webunit

Uninstall python-webunit And Its Dependencies

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

sudo apt-get -y autoremove python-webunit

Remove python-webunit Configurations and Data

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

sudo apt-get -y purge python-webunit

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

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

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

References

Summary

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