"Actually, I thought of all of that already and disagree with almost all of it :)" Could you elaborate? I didn't say that you needed to change any public interfaces. This is still very confusing: 380 +#ifdef MOCK_COMPWINDOW 381 + typedef Stackable Window; 382 +#else 383 + typedef CompWindow Window; 384 +#endif The code is compiled twice, and you have an abstract base class in one version and a concrete class in another. What this essentially is, is a template implemented in terms of #define. If you're going to create an abstract base class, why not just go all the way and make PrivateGLWindow inherit Stackable, put a redirect method in Stackable and make it call through to PrivateGLWindow? That way you don't need to rely on a define, and you only need to compile this code once. 96 +include_directories(${GTEST_INCLUDE_DIRS} ..) 97 +add_definitions(-DMOCK_COMPWINDOW) 98 +set(exe "compiz_opengl_test_windowstack") 99 +add_executable(${exe} test-windowstack.cpp ../windowstack.cpp) 100 +target_link_libraries(${exe} compiz_core ${GTEST_BOTH_LIBRARIES}) 101 +add_test(OpenGLWindowStackTests ${exe}) "I'm not using compiz_discover_tests because I hate the fact that it necessitates excessively deep directories (plugins/NAME/src/LIBNAME/src/stuff.cpp). Also, what does compiz_discover_tests give me if I need to create more files, directories and complexity to use it?" It doesn't necessitate that at all. The tests are only organized that way because this is the way I happened to organize them. (Also, when in doubt, its a good idea to be consistent rather than go against the grain - I'm happy to change the organization if we can agree on a better way). Here's the syntax for compiz_discover_tests. compiz_discover_tests (test_executable COVERAGE library_that_the_test_uses_1 library_2 ...) The coverage argument is optional, but does require that the tested code goes into a separate library (which you should do anyways because currently the code is compiled twice, which is the exact problem that unity has which I am trying to avoid). I strongly recommend using this function. It has the following purposes: 1. It adds every individual test to the CTest manifest, meaning that you always have a perfectly clean environment on setup and teardown (defend against subtle bugs where tests are stateful and rely on each other when they shouldn't). 2. You have per-test resolution when something fails from "make test" 3. Its the best way to get your code added to the coverage report, so that you can see if your tests are actually excersizing the code all round. (You can add to the coverage report yourself, however that's several hundred lines of CMake code). Another good reason: 4. If someone else adds a test using compiz_discover_tests there is a race in CMake where the CTestFile for this test will be clobbered. "WindowStack" also feels weird. Its not a window stack - its a class that accumulates uncovered screen regions to determine which windows are not occluded. Also "stackable" in the namespace compiz::opengl feels weird too. Its not a "stackable", in compiz terms "stackable" means something more like a window that sits in a stack and can be re-arranged. In this part of the code, it is something that occludes another region, or can occlude it.