-
What is GTEST?
Google Test (also known as gtest for e.g. the ROS environment) is a unit testing library for the C++ programming language, based on the xUnit architecture. The library is released under the BSD 3-clause license. It can be compiled for a variety of POSIX and Windows platforms, allowing unit-testing of C sources as well as C++ with minimal source modification. The tests themselves could be run one at a time, or even be called to run all at once. This makes the debugging process very specific and caters to the need of many programmers and coders alike.
-
Types of GTest
» Unit Tests
» Integration Tests
» Acceptance Tests
-
How to use GTest?
We build a template environment using GTest
(We attached the project on bellow of post)
After download, follow the steps below.
Step 1: Copy your source code to sample folder
Step 2: Open VS solution FreeSourceC_DevEnv.sln
Step 3: Add the code (from sample folder ) to Models in FreeSource_Bench
(ex: Square.cpp and Square.h)
Step 4: add include Directory for your source code
FreeSource_Bench property -> VC++ Directories -> Include Directories
Step 5: Modify UnitTest.cpp
use macro TEST(test_case_name, test_name) to make your test case.
Note: Square model is an example model. You can delete it if you want.
Download Project (VS2015):
Google Drive 1