How to install Google Test / Google Mock in Visual Studio 2019

I tried to introduce Google Test to unit test the library I made in C language. Google Test is a C / C ++ testing framework.

Google Test already exists as a project template for Visual Studio 2019 It's easy to use Google Test header files (gtest.h, etc.), I had a hard time with the introduction of Google Mock, so I will introduce the solution.

Before reading

How to install Google Test / Google Mock You can also download the source code from GitHub, build it, etc. This introduction method is to install Google Mock using NuGet of __Visual Studio __. Complete only on Visual Studio.

Installation environment

Google Test As mentioned earlier, Google Test already exists as a project template for Visual Studio 2019. It's easy to deploy. Select Google Test from Create Project. Detailed settings will be omitted this time.

Google Mock

Installation

I installed the Google Mock package from NuGet.

If you search on Google Mock, you will find some hits. This time, I installed 1.7.0.1 of googlemock.v140.windesktop.static.rt-dyn.

After installation, the project config file

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="googlemock" version="1.10.0" targetFramework="native" />
  <package id="Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn" version="1.8.1.3" targetFramework="native" />
</packages>

I think it will be like this. You can see that googlemock has been added.

File reading

Now that the installation is complete, I get an error that the location cannot be found when I include gmock / gmock.h to use Google Mock.

If you look at the location of the Google Mock package you installed for trial (project location \ packages \ googlemock.v140.windesktop.static.rt-dyn.1.7.0.1) The directory name under ʻinclude was gtest`.

Isn't it __gmock? ?? ?? ?? __

So by changing the directory name from gtest to gmock You can now include it safely (^ ω ^)

Recommended Posts

How to install Google Test / Google Mock in Visual Studio 2019
How to use Google Test in C
Install numpy in Visual Studio 2019
How to use linux commands in Visual Studio Code terminal
How to debug the Python standard library in Visual Studio
How to hide the command prompt when running python in visual studio 2015
How to install pip, numpy in Autodesk MAYA
How to display videos inline in Google Colab
How to Mock a Public function in Pytest
How to install Python
How to install pip
How to install archlinux
How to install python
How to install BayesOpt
How to install Nbextensions
How to install Prover9
How to run AutoGluon in Google Colab GPU environment
How to load files in Google Drive with Google Colaboratory
How to use Spacy Japanese model in Google Colaboratory
How to install poetry (error handling) in zsh environment
[2020.8 latest] How to install Python
How to install Python [Windows]
Tabpy 1.0 (2020-01 version) How to install
How to install mkl numpy
Bottle Pug in Visual studio 2019
Python development in Visual Studio 2017
How to install Pelican blog
How to develop in Python
Python development in Visual Studio
How to use Google Colaboratory
How to test that Exception is raised in python unittest
How to extract any appointment in Google Calendar with Python
How to install python using anaconda
[For beginners] How to implement O'reilly sample code in Google Colab
How to auto-update App Store description in Google Sheets and Fastlane
How to handle session in SQLAlchemy
[Rails] How to display Google Map
How to install OpenCV on Cloud9 and run it in Python
[Django] How to test Form [TDD]
How to install and use Tesseract-OCR
How to use classes in Theano
How to write soberly in pandas
How to collect images in Python
Mock in python-how to use mox
How to display formulas in latex when using sympy (> = 1.4) in Google Colaboratory
Steps to install Ubuntu in VirtualBox
How to update Spyder in Anaconda
How to use SQLite in Python
How to install python-pip with ubuntu20.04LTS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install MBDyn (Linux Ubuntu)
How to convert 0.5 to 1056964608 in one shot
How to install PyPy on CentOS
[Memo] How to use Google MµG
How to install TensorFlow on CentOS 7
How to reflect CSS in Django
How to install and configure blackbird
How to install CUDA and nvidia-driver
How to kill processes in bulk