How To Install bats on Fedora 34

bats is Bash Automated Testing System

Introduction

In this tutorial we learn how to install bats on Fedora 34.

What is bats

Bats is a TAP-compliant testing framework for Bash. It provides a simple way to verify that the UNIX programs you write behave as expected. Bats is most useful when testing software written in Bash, but you can use it to test any UNIX program.

We can use yum or dnf to install bats on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install bats.

Install bats on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install bats using dnf by running the following command:

sudo dnf -y install bats

Install bats on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install bats using yum by running the following command:

sudo yum -y install bats

How To Uninstall bats on Fedora 34

To uninstall only the bats package we can use the following command:

sudo dnf remove bats

bats Package Contents on Fedora 34

/usr/bin/bats
/usr/lib/bats-core
/usr/lib/bats-core/formatter.bash
/usr/lib/bats-core/preprocessing.bash
/usr/lib/bats-core/semaphore.bash
/usr/lib/bats-core/test_functions.bash
/usr/lib/bats-core/tracing.bash
/usr/lib/bats-core/validator.bash
/usr/libexec/bats-core
/usr/libexec/bats-core/bats
/usr/libexec/bats-core/bats-exec-file
/usr/libexec/bats-core/bats-exec-suite
/usr/libexec/bats-core/bats-exec-test
/usr/libexec/bats-core/bats-format-cat
/usr/libexec/bats-core/bats-format-junit
/usr/libexec/bats-core/bats-format-pretty
/usr/libexec/bats-core/bats-format-tap
/usr/libexec/bats-core/bats-format-tap13
/usr/libexec/bats-core/bats-preprocess
/usr/share/doc/bats
/usr/share/doc/bats/AUTHORS
/usr/share/doc/bats/README.md
/usr/share/licenses/bats
/usr/share/licenses/bats/LICENSE.md
/usr/share/man/man1/bats.1.gz
/usr/share/man/man7/bats.7.gz

References

Summary

In this tutorial we learn how to install bats on Fedora 34 using yum and dnf.