Currently, all bsoncxx tests link against the entire public bsoncxx library. The same applies for mongocxx tests.
Instead, we should consider separating out our unit tests from our integration tests, and create separate executables for each class being unit tested. A few pros/cons:
- Pro: we'll have a cleaner way to test non-public functionality when we allow building/testing without static libraries (we currently always build the static library, but this won't be the case when
CXX-1257is resolved). - Pro: this will encourage maintainers to keep a clean internal dependency tree, since each unit-testable component of both libraries will need to have their dependencies explicitly listed.
- Con: clean builds will take longer, due to additional time spent linking the newly-added executables (possibly additional time re-compiling unit test dependencies, depending on how we implement unit test dependencies in CMake).
In order to do achieve this, we will need to create a new target with common dependencies (e.g. our polyfill libraries) that unit tests can depend on.
- is related to
-
CXX-1078 Divide mongocxx tests into unit, mocked unit and integration tests
- Closed