【发布时间】:2017-02-13 19:29:02
【问题描述】:
我正在使用unittest 框架,但错过了我在Boost.Test 中学到的喜爱的功能。它是BOOST_AUTO_TEST_CASE_TEMPLATE,在它的帮助下,可以对不同类型运行基本相同的测试,例如
typedef boost::mpl::vector<TypeA, TypeB> types_for_test;
BOOST_AUTO_TEST_CASE_TEMPLATE(test_something, T, types_for_test){
T obj;
BOOST_CHECK_EQUAL(obj.empty(), true);
}
会产生两种不同的单元测试:一种用于TypeA 类型,另一种用于TypeB 类型。
但是,我在unittest-documentation 中没有发现任何类似的东西。
因此我的问题是:模拟BOOST_AUTO_TEST_CASE_TEMPLATE-功能的标准方法是什么?
【问题讨论】:
标签: python python-2.7 unit-testing