Folks –

 

I would appreciate any help for the following question ….

 


From: Ranji Raghavan [mailto:ranji.raghavan@openspirit.com]
Sent: Tuesday, February 06, 2007 10:23 AM
To: 'boost-test@emailaccount.com'
Subject: Question about Boost.Test

 

Hello Gennadiy –

 

I have been asked recently to investigate an UNIT testing tool for our C++ framework we have and have taken a quick stab at cppUnit, CxxTest and I am currently looking into Boost.Test. I have a fair bit of experience in JUnit and MbUnit/NUnit that we have used to unit test the JAVA & .NET version of the same application.

 

What we are trying to accomplish (and have accomplished for JAVA & .NET versions at least) is to have all our test cases defined in XML files – this way we have the same inputs for the .NET, JAVA & C++ versions of our application. JUnit & MbUnit have the capability that allows me to feed different data sets (1000’s of them in some case) to the same test method.

 

Delving into cppUnit & CxxTest, I could not find any pragmatic way to feed disparate data sets to the same test method – or at least that’s what I gather from what little I could decipher. But looking at Boost.Test I did find BOOST_PARAM_CLASS_TEST_CASE( test_class_method_pointer, first_parameter, last_parameter ) method that caught my attention.

 

The question I have for you is this: Can I pass an instance of a class (that contains all the requisite data I parsed from the XML file) to a test method. For example –

 

class my_complex_test
{
    void test_assignment( can this be an instance of a class? )
    {
        ...
    }
};
...
std::list<can this be a list that holds instances of a class> possible_xmlvalues;
ts->add( BOOST_PARAM_CLASS_TEST_CASE( &my_complex_test::test_assignment,
                                      possible_xmlvalues.begin(),
                                      possible_xmlvalues.end() ) ); 
 
 
Any help you can render will be greatly appreciated.
 
Thanks
 
Ranji Raghavan