In my case, because of how I wanted the testing done, manual registration was easier.
This is because I had a small number of tests that were applied to a large number of classes each implementing the same interface. These were file format handlers that supported many different file formats, and I wanted to perform the same set of tests on each (e.g. open a file in each format and try to read some data.)
Originally I was using automatic registration, and I had to duplicate the test cases for each supported file format. I actually did this with an #include
and some precompiler tricks, but nevertheless it was difficult to maintain.
Instead I have now switched to manual registration, as this allows me to create one set of tests, and have those tests added to the tree dozens of times, with each copy running against a different class (to test each file format.) The code is a lot cleaner and most of the #ifdef
lines have now gone which is nice.
The answer to your question is similar to whether you would solve a C++ coding problem with metaprogramming or not. C++ metaprogramming can be a bit like automatic copy-and-paste so you can type less code, writing a more generic algorithm and having the compiler do the work instead. Manual registration with Boost.Test is similar, letting you specify your list of tests with an algorithm (code) instead of listing each one separately.
Of course if most of your tests are unique, and you're not running the same test repeatedly with different parameters, then you probably won't see any benefit from switching to manual registration.