Monday, 30 May 2016
Friday, 27 May 2016
Code Coverage Using Google Test for unmanaged code using Visual Studio
Folks I am back with a shout out. Today we
are going to walk on creating a static library in Visual c++ and will use
Google test to write unit test and perform code coverage.
In this small article I will be using a set of utilities
Visual studio 2013, Google Test Runner that integrate in
Visual studio for easy discovery of gtest and the finally the Google test
framework. I am writing this to get a quick revision if some day I walk back again to do it again.
The very first step was to download the tool shown above
I downloaded the gtest framework and compiled the library
using the following setting
Once the library is ready I created a dummy static library
to get some hands on testing and named it as Win32Project1 which simply had
two functions sum and sub.
To start writing some Google test code I created a another C++ console based application and configured it with the settings to get code coverage
by setting linker properties of the test project as
And advanced->profile as
Do you know that the above two settings will help me to get
coverage of the api I am going to test in a while.
One these are set I created a dummy Gtest which is very
basic and ran it using the test runner. Notice that I have to set of test
written one from Microsoft unit testing other from google test setting applied
before writing test was.
As the picture show sum is 100% covered however the sub is
not covered as I have no test written for it in Google Tests.
Subscribe to:
Posts (Atom)
Apache Beam Learning In Java Tutorials
Wow https://youtu.be/9kGETU63rkc
-
Folks I am back with a shout out. Today we are going to walk on creating a static library in Visual c++ and will use Google test to write ...
-
Bokeh library helps in interactive visualization, that targets web browsers for representation. We are going to cover three vital aspe...