In my case, due to the way I wanted the testing to be done, manual registration was easier.
This is due to the fact that I had a small number of tests that were applied to a large number of classes, each of which implemented the same interface. These were file format handlers that supported many different file formats, and I wanted to run the same set of tests for each (for example, open a file in each format and try to read some data.)
Initially, I used automatic registration, and I had to duplicate test cases for each supported file format. I actually did this with #include and some precompiler tricks, but nonetheless it was hard to maintain.
Instead, I switched to manual registration, as this allows me to create one set of tests, and these tests are added to the tree dozens of times, each copy working with a different class (to check each file format.) The code is much cleaner, and now most of the lines #ifdef disappeared, which is nice.
The answer to your question is similar to how to solve the problem with C ++ code during metaprogramming or not. C ++ metaprogramming may be a bit like automatic copy and paste, so you can type less code, write a more general algorithm, and run the compiler instead. Manual registration with Boost.Test is similar, allowing you to specify your test list using an algorithm (code), rather than listing each separately.
Of course, if most of your tests are unique, and you do not use the same test several times with different parameters, you probably will not see any benefit from switching to manual registration.
source share