How To Install gtest on CentOS 7

In this tutorial we learn how to install gtest on CentOS 7. gtest is Google C++ testing framework

Introduction

In this tutorial we learn how to install gtest on CentOS 7.

What is gtest

Google’s framework for writing C++ tests on a variety of platforms (GNU/Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.

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

Install gtest on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install gtest

Install gtest on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

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

sudo dnf -y install gtest

How To Uninstall gtest on CentOS 7

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

sudo dnf remove gtest

References

Summary

In this tutorial we learn how to install gtest on CentOS 7 using yum and dnf.