Hello! 2009/11/30 Alex <tzuchien.c...@gmail.com>: > I know this topic has been discussed before. I've read the previous > posts and if I understand correctly, UnitTest++ is not designed to > support abstract test cases/suites.
The "abstract" world is not as well defined in C++ world as in Java. What does it mean abstract in test? Is the abstract test, something more than "parametrized test" intended to be reused with various implementations ? If that's it I would go into this direction ... > What is the best practice/workaround/hack to write abstract test cases > in UnitTest++ ? void my_complex_contract(SomeInterface& object_under_test) { SOME_CHECK(someValue, object_under_test.GetSome()) ... } TEST(PersonImpl_follows_my_complex_contract) { PersonImpl p; my_complex_contract(p); } TEST(Department_follows_my_complex_contract) { DepartmentImpl p; my_complex_contract(p); } The above applies if you've got "virtual" interfaces. If you've got only "generic" interface then your contract function might become template: template <typename T> void copyable_contract_check(T& object_under_test) { T tmp(object_under_test); CHECK(tmp == object_under_test); ... } TEST(empty_my_vector_follows_copyable_contract) { my_vector v; check_copyable_contract(v); } -- Zbigniew Zagórski / software developer / geek / http://zbigg.blogspot.com / ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ unittest-cpp-devel mailing list unittest-cpp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unittest-cpp-devel