Eclipse/GTest Workspace Patterns

151 views
Skip to first unread message

Joe Schneider

unread,
Aug 15, 2010, 10:20:22 AM8/15/10
to Google C++ Testing Framework
I'm about to migrate a fairly large team of developers to Eclipse/
GTest. I have done a decent amount of toy-project development in
Eclipse, but no large-scale professional work in it. I'd prefer to use
the autogenerated makefiles from Eclipse if possible. I understand I
should go to the Eclipse groups to get Eclipse help, but the specific
issues I'd like help with are specific to unit testing and GTest
integration, and I'm hoping I can find someone who has some
suggestions here.


What I think I know so far:

* Two projects per component: one for the production code, one for
the unit test.
- In a small project, I guess you'd only have one component.
The projects would create the executables MyProj and MyProjTests.
- In a larger project, you'd have many components. The
projects would create MyComp.a and the executable MyCompTests.
Another project would link all of the project static libraries into
one large executable.

- Different code/executable build targets are possible in a
single project using build configurations, but this turned into a mess
and smelled wrong.

* I have found the GTest plug-in for Eclipse from the Industrial Logic
folks which is much better than simple console output. Using this
along with a GTest run configuration I can run unit tests fairly
easily.


What I'm struggling with:

* Easiest way to link/include the production source code into the test
executable.
- I can simply link against the production static library in a
large project. In a small project, where I might not normally need to
generate a static library intermediate, what's the easiest way to do
this?

* In our previous build system we ran the unit tests as part of our
build of the production code. It was impossible to get an executable
of the production code without the unit tests passing. This is pretty
easy with custom makefiles, but wondering if anyone has a good
suggestion using the autogenerated makefiles.

Thanks!

Pat Notz

unread,
Aug 15, 2010, 11:56:40 AM8/15/10
to Joe Schneider, Google C++ Testing Framework
On Sun, Aug 15, 2010 at 8:20 AM, Joe Schneider <joss...@gmail.com> wrote:
>
> * I have found the GTest plug-in for Eclipse from the Industrial Logic
> folks which is much better than simple console output.  Using this
> along with a GTest run configuration I can run unit tests fairly
> easily.
>

This plugin worked great for Eclipse 3.5 (Ganymede) but it doesn't
install in 3.6 (Helios). Does it work in 3.6 for you? Perhaps I need
a different update URL. My current URL is
http://industriallogic.com/update/ .

Thanks ~ Pat

Keith Ray

unread,
Aug 16, 2010, 10:53:57 PM8/16/10
to Pat Notz, Joe Schneider, Google C++ Testing Framework
That update URL is correct. We know the know the plugin doesn't work
in Helios, because of changed dependency structures within Eclipse,
but we been focused on other work.

--
--
C. Keith Ray
 Web: http://industriallogic.com
 Twitter: @CKeithRay, @IndustrialLogic

Amplify Your Agility
Coaching | Training | Assessment | eLearning

Vlad Losev

unread,
Aug 17, 2010, 12:59:07 PM8/17/10
to Joe Schneider, Google C++ Testing Framework
Hi Joe,

Take a look at CMake. AFAIK, it can generate an Eclipse projects. You can define tests and a target to run them will be added to the generated makefile. CMake supports custom targets so it may be possible to generate the final executable only if the tests pass. Alternatively, you can use a CI system that publishes binaries only if the tests pass.
 
Thanks!


Regards,
Vlad
Reply all
Reply to author
Forward
0 new messages