Unit Test With GoogleTest Activity
Unit Test with Google Test Activity
Participants install the Google Test library and run an existing C++ project to see individual test results and confirm successful installation.
Have set up a development environment that will compile C++. Configurations differ slightly from one operating system to another, but should work on most.
|Learning Objectives||After successfully completing this activity, the learner should be able to:
|Process Skills Practiced|
- First, you will need to install Google Test on your machine. The code is provided on https://github.com/google/googletest
- I suggest placing Google Test in a location where other source libraries are placed, such as
- Next, go to a different directory (such as one you use to organize your files for this course, or a folder where you store your own code). Clone this cpp-gtest repository.
- Once cloned, edit Makefile find this line:
GTEST_DIR = /usr/local/include/gtestand change it to the directory you placed Google Test. Provide the entire path to the directory in Google Test that has the following folders/files:
(and more .h files...)
- Once you've edited the file, save it and run the command
- Next, run the command
- The output should show that one test has been run (and passed).
- Take a screenshot of this output and submit the image for this assignment
A screen shot of the automated test results.
Notes for Instructors
Students should have a screen shot of Google Test results that show that a test has been run and passed in command line output.
| ACM Body of Knowledge
Area & Unit(s)
Software Engineering / SE Software Verification Validation
Configuring the development environment with the Google Test library takes intermediate expertise of operating system command-line navigation
Download and configuration may take 5 to 20 minutes, depending on the students' operating systems and existing development environment.
|Environment / Materials||
Need a development environment with support for Makefile and C++ compilation (g++ recommended)
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License