Using Visual Studio 2010 C++ with googletest. I’m new to unit testing and I’ve created a test solution to experiment with it. I have three projects in the solution:
HelloService (static lib)
HelloService.Tests (exe, a console app I think, linked with gmock_main.lib)
HelloApp (MFC exe, my main app)
I’ve got googletest (and googlemock) compiled linked and successfully working. My question is with the code test development cycle. I’m trying to understand the proper workflow with testing. Currently if I set HelloService.Tests as the “StartUp project” then when I hit F5 the tests run, but my HelloApp doesn’t. If I set my HelloApp as the startup project then when I hit F5 my app runs but my tests don’t.
I would think that I would want my “HelloApp” as the startup project but my tests to run when I build it and before I run it. Is that right? How do I set it up to do that?
The solution for me was to set the HelloApp as the StartUp project and then right click on the HelloApp project and choose “Project Dependencies…” and then check the HelloService.Tests project (the HelloService project was already checked). Now when I hit F5 the test project gets run (because HelloService.Tests already had a post-build event on it to run itself)
My only concern is if creating a project dependency creates some kind of code dependency. My guess is it doesn’t but I’d like to know for sure.