If there was some way for CMake to utilize "solution folders" in Visual
Studio, we could easily organize unit tests into a hierarchy. This way the
solution explorer would not be cluttered and we'd still be able to have 1
project per unit test.

On Thu, Apr 2, 2009 at 4:03 PM, Daniel Blezek <blezek.dan...@mayo.edu>wrote:

>  Hi Robert,
>
>   I don’t have any suggestions about the compile time unit tests, but we’ve
> been using the Google testing framework for the last 6 months and have been
> very happy with it.  I wrote up some details related to ITK here:
>
> http://www.itk.org/Wiki/Proposals:Increasing_ITK_Code_Coverage#Google_Test
>
> You can have multiple tests embedded in one executable, which is what the
> gtest framework does.
>
> Best regards,
> -dan
>
>
> On 4/2/09 3:00 PM, "Robert Dailey" <rcdai...@gmail.com> wrote:
>
> Hi,
>
> Currently we have a directory called "test" under each project we have.
> Each source file (CPP) results in 1 unit test project being created. So if
> we have a project named "foobar", it would be structured like this on the
> filesystem:
>
> foobar/test/test1.cpp
> foobar/test/test2.cpp
> foobar/test/test3.cpp
>
> And the generated visual studio projects (when created via CMake) would be:
>
> foobar
> foobar_test1
> foobar_test2
> foobar_test3
>
> Obviously this creates a lot of clutter in the solution explorer window in
> Visual Studio. Is there a more recommended practice for structuring unit
> tests in CMake? Personal advice is also welcome. One approach I'd like to
> take is where we only have two projects:
>
> foobar
> foobar_test
>
> And inside foobar_test, all of the sources under the /test/ directory would
> be included, so a single project compiles all unit tests.
>
> foobar_test
>   test1.cpp
>   test2.cpp
>   test3.cpp
>
> However, the reason why I'm currently not doing this is because of
> compile-time unit testing. Basically, some unit tests are designed to be
> successful if they fail to compile. For example, perhaps certain template
> parameters do not meet the requirements of a specific C++ concept, and thus
> rightfully fail. This unit test would be considered successful because we
> want to make sure that ONLY types matching this specific concept are
> accepted by the compiler.
>
> If we include these source files in the same project, then it interrupts
> the whole compilation process. They have to be separate in order to work
> properly.
>
> ------------------------------
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
>
> --
> *Daniel Blezek, PhD
> *Medical Imaging Informatics Innovation Center
>
> P 127 or (77) 8 8886
> T 507 538 8886
> E blezek.dan...@mayo.edu
>
> Mayo Clinic
> 200 First St. S.W.
> Harwick SL-44
> Rochester, MN 55905
> mayoclinic.org
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to