![]() ![]() \packages\gmock.1.10.0\lib\native\src\gtest\src\Īt this point the project should look something like this (if it doesn't, try Unloading and Reloading the project): Install the latest gmock NuGet package from Google (currently v1.10.0). ![]() Create a new project from the Google Test template.Option 1: Compiling GoogleTest Directly in the Test Project Using a library will give faster build times, but you'll need to make sure that compile/link options are the same on the library and the test projects. I've found two ways to set this up: Either compile the whole GoogleTest framework directly into each of the test projects, or create a library project to hold it. Replacing the Microsoft GoogleTest NuGet package with the one from Google causes a link error: MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int _cdecl invoke_main(void)" what is the current recommended (and least painful) way to set up GoogleTest/GoogleMock in Visual Studio? Tests should be able to be discovered, run, and debugged via the Test Explorer. Trying to add a second GoogleMock NuGet package causes multiple problems, such as mismatched gtest/gmock versions, overlapping include paths, etc. But no, the GoogleTest NuGet package that is automatically added by the template does not include the gmock folder at all. Just #include "gmock/gmock.h" and mock away. With Visual Studio 2017/2019 it is really easy to set up a new Google Test project and start writing tests (as long as you don't mind using older versions of GoogleTest versions anyway).īut what about using GoogleMock as well? You would think that since Google combined gtest/gmock some time ago that this would just work. This is going to be a self-answered, FAQ-style question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |