A long time ago I’ve started to use teamcity-cpp. It became broken with boost 1.59 release, cuz latter had updated version of Unit Test Framework. That is a moment when I started my fork, cuz this code was actively used by a lot of configurations.

I’ve added a way to build this project with CMake (and this PR was accepted to upstream), but sooner I’ve became fail to submit further patches. Anyway, I continued to work and now my fork has some significant differences which make it impossible to contribute to upstream.

The most important feature is a CMake finder module for Boost UTF and support for CMake based projects. To use it one should find the package first (as it usually done for third party libraries/software):

# Find Boost UTF...
find_package(Boost REQUIRED COMPONENTS unit_test_framework)

# ... and corresponding TeamCity integration library
find_package(teamcity-cpp-boost REQUIRED)

Now you are ready to add an executable with unit tests:

add_executable(
    unit-tests-binary
    $<TARGET_OBJECTS:teamcity-cpp-boost>
    # Your other sources here
    ...
  )

The integration package provides a small object library called teamcity-cpp-boost to be added to every unit tests binary (using TARGET_OBJECTS generator expression). And do not forget to link your binary with Boost UTF (as usual).

target_link_libraries(
    unit-tests-binary
    ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
    # Your other required libraries here
    ...
  )

Under the hood…

It registers a global fixture, which is looking into defined environment variables check for TeamCity presense and if so, it’ll register a log formatter which would use TeamCity service messages to report about testing progress…

Some other features of my fork:

  • conditional support for testing libraries (the others are Google Test and CppUnit)
  • simplified way to build TeamCity service messages and some other refactorings
  • easy way to update test patterns (for developers of this package only)

For Gentoo Users

… you may get teamcity-cpp-1.6.ebuild from my repository (overlay).



blog comments powered by Disqus