On Thu, Mar 19, 2009 at 4:37 PM, Vlad Losev <vl...@google.com> wrote:
> Hi Greg,
>
> Please see if this answer helps you:
> http://code.google.com/p/googletest/wiki/GoogleTestFAQ#I_define_my_tests_in_a_library_(.lib)_and_Google_Test_doesn%27.
The FAQ says "static library". Should we change it to "either .lib or .dll"?
I also think it helps to make this info more visible. Perhaps move it
to the primer? Thanks,
>
> Best regards,
> Vlad.
>
> On Thu, Mar 19, 2009 at 3:53 PM, Greg Malcolm <gregm...@gmail.com> wrote:
>>
>>
>> Hi!
>>
>> I'm working on a big Visual Studio 2008 based project, mostly made of
>> dynamic DLL libraries. The code base is fairly massive so rather than
>> keep the tests in separate project modules, I would like to include
>> them in a separate folder in each of the existing dlls with an
>> executable test runner invoking them. The problem is that the Test
>> Runner doesn't seem to be able to see test installed outside of the
>> executable.
>>
>> I will be the first to admit this solution is a bit ugly, but I don't
>> want to expose every dllexport every class.
>>
>> Is there a way to make gtest run tests in all these dlls? Or can
>> anyone offer a viable alternative strategy for testing the code in the
>> dlls?
>>
>> The best I can think of write now is to create an executable for every
>> single dll and give each dll its own Main method. I'd prefer to test
>> all the dlls at once though.
>>
>> I should probably mention upfront that I've changed the "Use of MFC"
>> setting to "MFC Dynamically Linked dll" to get rid of linker errors. I
>> don't think that's an issue, but just in case...
>>
>> - Greg
>
>
--
Zhanyong
Hi Vlad,
The FAQ says "static library". Should we change it to "either .lib or .dll"?
On Thu, Mar 19, 2009 at 4:37 PM, Vlad Losev <vl...@google.com> wrote:
> Hi Greg,
>
> Please see if this answer helps you:
> http://code.google.com/p/googletest/wiki/GoogleTestFAQ#I_define_my_tests_in_a_library_(.lib)_and_Google_Test_doesn%27.
I also think it helps to make this info more visible. Perhaps move it
to the primer? Thanks,
Another idea is to create a static lib for your project in addition to
a DLL. You'll continue to use the DLL in production, and will use the
static lib for testing. You'll end up linking twice, but each file is
compiled only once. This isn't ideal either, but may be less work for
you.
>
> Thanks again for all the help!
>
> - Greg
>
--
Zhanyong
I was thinking along the same lines with making a __declspec
(dllexport) call. Sadly it didn't seem to solve the problem, but there
was a side effect.
Beforehand breakpoints placed on tests in the exe project would
trigger at the "dynamic initializer" stage. They wouldn't for tests in
dll.
With the "pull" method getting invoked. The breakpoints are getting
triggered. So maybe the remaining problem is that gtest is a static
libary?
Turning my project dll into a static library is not an option so I
will try and convert gtest into one. Probably going to need to add a
lot __declspec(dllexport) macros to make it fly, but I'll see how it
goes...
Thanks again for all the help!
- Greg