I have a C++ project in Eclipse Juno and I'm using the Boost Unit Test Framework. I am new to formal Unit Testing, so I am still working on my workflow.
My workspace contains two projects:
(1) my C++ Project
(2) unit test project to test the classes in (1)
As I write each unit test I import the necessary directories and files from (1) into (2) as virtual directories.
This works OK for the source files, but it doesn't seem to work for the header files.
e.g. compiling unit_test.cpp with
#include "foo/bar.h"
returns
../unit_tests.cpp:8:30: error: foo/bar.h: No such file or directory
even though there is a virtual directory foo
with bar.h
in it.
If I use the Eclipse "Open Declaration" command (F3) on: #include "foo/bar.h"
it will open the file, but the compiler can't find the file because it doesn't actually exist in the folder (I guess).
I noticed that the compiler compiles the "real" source files with a non-virtual directory path, but obviously this isn't done automatically for the header files.
I solved my problem by adding a Workspace referenced include path to the compiler. e.g.
${workspace_loc:/my C++ Project}
and this solved the problem, but what was the point of having virtual files when I have to create a reference to a real file anyway?
My questions are:
(*) Is this a good work flow?
(*) How can my workflow be improved?
(*) How do other people use Eclipse/IDEs to manage unit tests?