Kent Dahl - 2001-07-19

I was wondering which is the best way to decouple the testdata from the
tests themselves in CppUnit.

After realizing the difference between TestFixture and TestCase (which is one of the critique points the CppUtx design adresses), I'm more reluctant to having a single testmethod iterate over some structure:
     
void MyTestCaseSubclass::testFoobar(){
     for(int i=0;i<1024;i++) assertEquals(...)
}

Especially since you may loose information about exactly which entry in your dataset that failed.

So I begun thinking about using the Fixture for holding this information (ie, in CppUnit, this still means my individual subclass of TestCase). Thus I could create 1024 instances of TestCaller objects, each with their own fixture instance containing the data for one data entry. Add some subclass/version of TestCaller with someway of denoting which specific entry it was, like a number, and you'd have a way of quickly seeing which specific data entries failed.

Are there any best practice on this?