FW: Question about Boost.Test

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

Hello Gennadiy -
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 -
Short answer is - yes. Do you have any problems?
class my_complex_test { void test_assignment( can this be an instance of a class? )
Probably "ParameterType const&"?
{ ... } }; ... 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() ) );
What version of boost are you using? You sure you need class? Gennadiy

Actually, I am just looking into BOOST reading the documentation etc Do you recommend any particular version of BOOST that I should install and play with? I am looking to define all the test data in XML files - maybe 1000's of them - have a class that parses this XML file (some tests have about 7-8 pieces of disparate primitive data types string, double, int etc)and pass the array of class instances to a test method for repetitive testing. If this is not pragmatic, could you recommend another way? -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Tuesday, February 06, 2007 12:56 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Question about Boost.Test
Hello Gennadiy -
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 -
Short answer is - yes. Do you have any problems?
class my_complex_test { void test_assignment( can this be an instance of a class? )
Probably "ParameterType const&"?
{ ... } }; ... 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() ) );
What version of boost are you using? You sure you need class? Gennadiy _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

"Ranji Raghavan"
Actually, I am just looking into BOOST reading the documentation etc Do you recommend any particular version of BOOST that I should install and play with?
I recommend you to use the latest version. Try 1.34 RC.
I am looking to define all the test data in XML files - maybe 1000's of them - have a class that parses this XML file (some tests have about 7-8 pieces of disparate primitive data types string, double, int etc)and pass the array of class instances to a test method for repetitive testing. If this is not pragmatic, could you recommend another way?
Use BOOST_PARAM_TEST_CASE. It works differently in latest version then before. You will have less problems with parametrs object lifetime management. Let me know if you have any problems. Gennadiy

I have downloaded and built the BOOST libraries using VS2005 - I have
pointed the VC++ directories INCLUDE files to the BOOST install directory
and the Library files to the folder where the BOOST libraries were built to.
But when I try even the simplest of test programs from one of the examples
you had written - see below
#include
Actually, I am just looking into BOOST reading the documentation etc Do you recommend any particular version of BOOST that I should install and play with?
I recommend you to use the latest version. Try 1.34 RC.
I am looking to define all the test data in XML files - maybe 1000's of them - have a class that parses this XML file (some tests have about 7-8 pieces of disparate primitive data types string, double, int etc)and pass the array of class instances to a test method for repetitive testing. If this is not pragmatic, could you recommend another way?
Use BOOST_PARAM_TEST_CASE. It works differently in latest version then before. You will have less problems with parametrs object lifetime management. Let me know if you have any problems. Gennadiy _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Gennadiy Rozental
-
Ranji Raghavan