Hi,
I have a big problem. I have several dlls which contain inside gtest tests. These ones are run by a exec project pulling the test using the method describe in gtest primer (notes for visual c++ user) using gtest as shared library.
This is the scenario: i have a common dll that contains tests. Then i have a specific dll that also contains tests, the specific dll at runtime uses the common dll. For each dll i have a main executable project that should run the tests for each dll.
So now the problem.
1> When running the executable from the specific dll both tests from common and specific are run. This is a problem since i want to measure the coverage of each dll individually, so the specific dll tests will cover more that actually does since those tests in common are running. So my idea would be to try to group the tests using some existent gtest feature that i dont find and then run test by group. I wouldn't like to have to have all tests starting with a prefix and then use ::testing::GTEST_FLAG(filter) += ":-:PREFIX_*"; since its another thing that developers need to remember when writing tests.
2> i have another case where i have the tests in main exec project, then at runtime this project loads a specific dll that references the common dll above. In this case the specific dll does not have any tests (since they are part of the executable) however linking with shared libs makes the program crash since its trying to delete tests from common that haven't run (in the delete factory below). In this case i have a good workaround and i just use static libs and its fine. But a bit strange that first the test are not run and gtest is trying to clean them in the end.
So in conclusion my main problem is to try to run tests per dll rather than having Gtest run all the test it finds. As for the second and subject would be good to have gtest more robust these cases.
Thanks in advance
Jorge Costa
// to signify they cannot be NULLs.
TestInfo::TestInfo(const char* a_test_case_name,
const char* a_name,
const char* a_type_param,
const char* a_value_param,
internal::TypeId fixture_class_id,
internal::TestFactoryBase* factory)
: test_case_name_(a_test_case_name),
name_(a_name),
type_param_(a_type_param ? new std::string(a_type_param) : NULL),
value_param_(a_value_param ? new std::string(a_value_param) : NULL),
fixture_class_id_(fixture_class_id),
should_run_(false),
is_disabled_(false),
matches_filter_(false),
factory_(factory),
result_() {}
// Destructs a TestInfo object.
TestInfo::~TestInfo() { delete factory_; }