How To Install libtest-roo-perl on Ubuntu 18.04

In this tutorial we learn how to install libtest-roo-perl on Ubuntu 18.04. libtest-roo-perl is module for composable, reusable tests with roles and Moo

Introduction

In this tutorial we learn how to install libtest-roo-perl on Ubuntu 18.04.

What is libtest-roo-perl

libtest-roo-perl is:

Test::Roo allows you to compose Test::More tests from roles. It is inspired by the excellent Test::Routine module, but uses Moo instead of Moose. This gives most of the benefits without the need for Moose as a test dependency.

Test files are Moo classes. You can define any needed test fixtures as Moo attributes. You define tests as method modifiers – similar in concept to “subtest” in Test::More, but your test method will be passed the test object for access to fixture attributes. You may compose any Moo::Role into your test to define attributes, require particular methods, or define tests.

This means that you can isolate test behaviors into roles which require certain test fixtures in order to run. Your main test file will provide the fixtures and compose the roles to run. This makes it easy to reuse test behaviors.

For example, if you are creating tests for Awesome::Module, you could create the test behaviors as Awesome::Module::Test::Role and distribute it with your module. If another distribution subclasses Awesome::Module, it can compose the Awesome::Module::Test::Role behavior for its own tests.

No more copying and pasting tests from a super class! Superclasses define and share their tests. Subclasses provide their own fixtures and run the tests.

There are three methods to install libtest-roo-perl 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 libtest-roo-perl Using apt-get

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

sudo apt-get update

After updating apt database, We can install libtest-roo-perl using apt-get by running the following command:

sudo apt-get -y install libtest-roo-perl

Install libtest-roo-perl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libtest-roo-perl using apt by running the following command:

sudo apt -y install libtest-roo-perl

Install libtest-roo-perl 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 libtest-roo-perl using aptitude by running the following command:

sudo aptitude -y install libtest-roo-perl

How To Uninstall libtest-roo-perl on Ubuntu 18.04

To uninstall only the libtest-roo-perl package we can use the following command:

sudo apt-get remove libtest-roo-perl

Uninstall libtest-roo-perl And Its Dependencies

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

sudo apt-get -y autoremove libtest-roo-perl

Remove libtest-roo-perl Configurations and Data

To remove libtest-roo-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libtest-roo-perl

Remove libtest-roo-perl configuration, data, and all of its dependencies

We can use the following command to remove libtest-roo-perl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libtest-roo-perl

References

Summary

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