Re: [Boost-bugs] [Boost C++ Libraries] #11543: Adding Test Groups to BOOST.TEST

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11543: Adding Test Groups to BOOST.TEST
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-25 10:48:19


#11543: Adding Test Groups to BOOST.TEST
-------------------------------+---------------------
  Reporter: sumedhghaisas@… | Owner: rogeeff
      Type: Feature Requests | Status: closed
 Milestone: To Be Determined | Component: test
   Version: Boost 1.57.0 | Severity: Problem
Resolution: obsolete | Keywords:
-------------------------------+---------------------

Comment (by sumedhghaisas@…):

 Okay I am entirely sure but I think they are different concepts, but I
 might be wrong.
 I will explain my reasons in following points -

 Data driven tests in Boost.Test applies only to a single test test where
 as test group lets you initialize multiple tests with parameters.
 For example - Lets say you have class A and Class B. They are have
 equivalent API. I want to run 30 tests on each one. With current
 framework. I have to write 30 tests and initialize them individually for
 both the classes. Like I have to initialize every test for every class
 where as test group will combine those tests in a group and lets you
 initialize them on a class with one single line. So if you have 10 such
 classes all you need are 10 lines to initialize those tests where as in
 current framework one has to initialize 300 test cases individually.

 The concept of Data driven tests is to let the user flexibility to run
 single test on various parameters where as the main concept of test group
 is to let user flexibility to create a group of tests which can be
 initialized on parameters.

 {{{
 template<size_t index>
 MANAK_GROUP(TestGroup);

 std::string c_name;

 GINIT(const std::string& str)
 {
   c_name = str;
 }

 MANAK_AUTO_GROUP_TEST_CASE("Test1_with_" + c_name)
 {

 }

 MANAK_AUTO_GROUP_TEST_CASE("Test2_with_" + c_name)
 {

 }

 MANAK_GROUP_END();

 MANAK_ADD_GROUP(TestGroup<Class1>, "Class1");
 MANAK_ADD_GROUP(TestGroup<Class2>, "Class2");
 MANAK_ADD_GROUP(TestGroup<Class3>, "Class3");
 }}}

 Like the code above will be written like below in current framework

 {{{
 template<typename T>
 void fun1() {}

 template<typename T>
 void fun2() {}

 template<typename T>
 void fun3() {}

 register fun1 with class 1
 register fun1 with class 2
 register fun1 with class 3

 register fun2 with class 1
 register fun2 with class 2
 register fun2 with class 3

 register fun3 with class 1
 register fun3 with class 2
 register fun3 with class 3
 }}}

 In this case if user has to add a new test he has to add that test for
 each class, or if user needs to add new class he has to add all the
 functions to this class. Test group makes this situation more constructive
 and abstracts the construction of test from the class its is being applied
 to.

 I am extremely sorry if I am missing something and would happy to learn if
 such functionality already exists which we can use in our project. In such
 case please provide a very short sample case. Thanking you in advance.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11543#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC