Friday, February 21, 2014

Building GoogleMock to use it with Visual Studio 2013 Ultimate

This post explains how to build GoogleMock to use it with Visual Studio 2013 Ultimate.

First download the last version (1.7.0 when I wrote this) of GoogleMock from the GoogleMock download list.

Then extract the content of the downloaded zip on a folder of your choice. I did it inside c:\src\ 

Now use Windows Explorer to enter into the msvc\2010\ folder under the gmock-1.7.0 folder. There you'll find a solution file called gmock.sln, open it with Visual Studio 2013 Ultimate. 




Since this solution was created with Visual Studio 10, Visual Studio 2013 will ask you to upgrade all the project files within the solution. Click Ok.



Then you'll probably see this message:



This happens because the project files have read-only permissions.
Select the Make Writable option for each of the three project files.

Once the solution is open, you'l see three projects inside the solution:
  1. gmock
  2. gmock_main 
  3. gmock_test



Build the solution in Debug Version pressing F7 and ignore all the warnings.



Once built, to check that everything is ok, go to the Debug folder under msvc\2010\ the you'l find an executable file called gmock_test.exe which runs the tests for the googlemock code.



Open a command line prompt, go to the Debug folder and run the tests.



You should see that all of them pass.

4 comments:

  1. Hi Manuel,
    I've done the same with Visual Studio Express (wich is free), and it worked.
    Ultimate is too expensive for individual developers ;)
    Thanks!

    ReplyDelete
  2. Manuel, Great post. I had a quick question. Is there a way to integrate Google Mock with the default testing framework in MS Visual Studio 2013?

    ReplyDelete
  3. Thanks!

    Sorry, I don't know, I've never tried it.

    ReplyDelete