Sean Farrell wrote:

> AFAIK the abstract test paradigm is basically used to ensure that the
> Liskov Substitution Principle is not violated.

Syntactically, yes. But SLP is also semantic. Think of Abstract Test as a 
way to merge the duplication out of a whole series of test cases that each 
vary by some type, not just by data. (Test cases that vary by data are a 
FIT-style pattern in disguise.)

Anyway, I can't find TEST_FIXTURE in this thread. I thought the trick was to 
pass a type into a templated suite, roughly like this (warning - pseudo 
C++):

  template<thing> class tester {
      void test_one_way()
         {
              assert assert assert
         }
      void test_another_way()
         {
              assert assert assert
         }
      void test_different_way()
         {
              assert assert assert
         }
    };

TEST_FIXTURE(tester<dove>, test_one_way) { test_one_way() }
TEST_FIXTURE(tester<dove>, test_another_way) { test_another_way() }
TEST_FIXTURE(tester<dove>, test_different_way) { test_different_way() }
TEST_FIXTURE(tester<hawk>, test_one_way) { test_one_way() }
TEST_FIXTURE(tester<hawk>, test_another_way) { test_another_way() }
TEST_FIXTURE(tester<hawk>, test_different_way) { test_different_way() }
TEST_FIXTURE(tester<penguin>, test_one_way) { test_one_way() }
TEST_FIXTURE(tester<penguin>, test_another_way) { test_another_way() }
TEST_FIXTURE(tester<penguin>, test_different_way) { test_different_way() }

Further macro abuse can roll those up again.

> The reason for not having suit wise setup and tear down is that it
> does not make sense. Every test is to run in isolation and suit wise
> setup and tear down breaks that.

The problem with that theory is reality. Sometimes your tests must access 
slow things, such as a database. Building its records, suite-wide, and 
putting each test case into a transaction, with a ROLLBACK to instantly 
restore the test records, is a happy medium.

-- 
  Phlip 




------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
unittest-cpp-devel mailing list
unittest-cpp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unittest-cpp-devel

Reply via email to