mardi 12 avril 2016

How can I unit test code without having the third party DLLs using C++ Google Test?

down vote favorite

I've inherited a legacy code project at work, and I'd like to add some unit tests to it before I make some changes. I'm working on a Visual C++ project using VS2010. I've been playing around with Google Test as the unit testing framework.

I've been able to successfully add a unit test project to the existing solution, and I wrote a basic test to verify that it will run. My existing solution builds a DLL, but the problem happens because it implicitly links to a third party DLL. That DLL requires another third party DLL, and so on. I can build but when I run I get the following error:

"The program can't start because thirdParty.dll is missing from your computer. Try reinstalling the program to fix this problem."

If I put all the dependent DLLs into the folder where my unit test executable lives everything works fine, but I would like to know if there's any way to run the executable without having all of those third party DLLs. The code I'm about to change doesn't actually make any calls in to any of the functions used by the various third party DLLs, and I'd like to wrap the calls to them so I can mock them but right now it seems as if I need them.

I apologize in advance if I'm not explaining anything clearly. I'm new to C++ and Visual Studio.

Aucun commentaire:

Enregistrer un commentaire