Unit Test With GoogleTest Activity
(Unit Testing with GoogleTest Activity initial commit) |
m (→Directions:) |
||
Line 19: | Line 19: | ||
==== Students: ==== | ==== Students: ==== | ||
− | + | * First, you will need to install Google Test on your machine. The code is provided on [https://github.com/google/googletest GitHub.com/google/googletest] | |
− | + | * I suggest placing Google Test in a location where other source libraries are placed, such as <code>/usr/local/include</code> | |
− | + | * 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 [https://github.com/ChicoState/cpp-gtest cpp-gtest repository]. | |
− | + | * Once cloned, edit Makefile find this line: <code>GTEST_DIR = /usr/local/include/gtest</code> and 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: <code><br/>internal<br/>gtest.h<br/>gtest-typed-test.h<br/>gtest-test-part.h<br/>''(and more .h files...)''</code> | |
− | + | * Once you've edited the file, save it and run the command <code>Make</code> | |
− | <code>internal<br/>gtest.h<br/>gtest-typed-test.h<br/>gtest-test-part.h<br/>''(and more .h files...)''</code> | + | * Next, run the command <code>./RandoTest</code> |
− | + | * 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 | |
− | + | ||
− | + | ||
− | + | ||
=== Deliverables: === | === Deliverables: === |
Revision as of 06:16, 1 August 2016
Title |
Unit Test with Google Test |
Overview |
Participants install the Google Test library and run an existing C++ project to see individual test results and confirm successful installation. |
Prerequisite Knowledge |
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 |
Participant should be able to learn how to configure a unit testing framework and read and interpret unit test results. |
Directions:
Students:
- First, you will need to install Google Test on your machine. The code is provided on GitHub.com/google/googletest
- I suggest placing Google Test in a location where other source libraries are placed, such as
/usr/local/include
- 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/gtest
and 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:
internal
gtest.h
gtest-typed-test.h
gtest-test-part.h
(and more .h files...) - Once you've edited the file, save it and run the command
Make
- Next, run the command
./RandoTest
- 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
Deliverables:
A screen shot of the automated test results.
Assessment:
Students should have a screen shot of GoogleTest results that show that a test has been run and passed in command line output.
Comments:
Additional Information:
Knowledge Area/Knowledge Unit |
Softward Engineering |
Topic |
Unit Testing |
Level of Difficulty |
Configuring the development environment with the GoogleTest library takes intermediate expertise of operating system command-line navigation |
Estimated Time to Completion |
Download and configuration may take 5 to 20 minutes, depending on the students' operating systems and existing development environment. |
Materials/Environment |
Need a development environment with support for Makefile and C++ compilation (g++ recommended) |
Author |
Kevin Buffardi |
Source |
Kevin Buffardi |
License |
Licensed CC BY-SA 4.0 |
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License