是否可以仅运行Boost单元测试模块的子集? [英] Is it possible to run only subsets of a Boost unit test module?
问题描述
我正在使用Boost 1.34.1单元测试框架. (我知道版本是古老的,但是由于技术原因,更新或切换框架目前是不可行的.)
I am using the Boost 1.34.1 unit test framework. (I know the version is ancient, but right now updating or switching frameworks is not an option for technical reasons.)
我有一个测试模块(#define BOOST_TEST_MODULE UnitTests
),它由三个测试套件(BOOST_AUTO_TEST_SUITE( Suite1 );
)组成,而测试套件又由几个BOOST_AUTO_TEST_CASE()
组成.
I have a single test module (#define BOOST_TEST_MODULE UnitTests
) that consists of three test suites (BOOST_AUTO_TEST_SUITE( Suite1 );
) which in turn consist of several BOOST_AUTO_TEST_CASE()
s.
我的问题:
是否可以仅运行测试模块的一个子集,即将测试运行限制为仅一个测试套件或什至仅一个测试用例?
Is it possible to run only a subset of the test module, i.e. limit the test run to only one test suite, or even only one test case?
原因:
我将单元测试集成到了我们的automake框架中,因此整个模块都在make check
上运行.我不想将其拆分为多个模块,因为我们的应用程序会生成大量输出,并且很高兴在底部看到测试摘要("X个Y测试失败"),而不是分散在几千行输出中
I integrated the unit tests into our automake framework, so that the whole module is run on make check
. I wouldn't want to split it up into multiple modules, because our application generates lots of output and it is nice to see the test summary at the bottom ("X of Y tests failed") instead of spread across several thousand lines of output.
但是完整的测试运行也很耗时,并且您正在寻找的测试输出同样被淹没;因此,如果我能以某种方式限制正在运行的测试的范围,那就太好了.
But a full test run is also time consuming, and the output of the test you're looking for is likewise drowned; thus, it would be nice if I could somehow limit the scope of the tests being run.
Boost文档使我非常困惑,没有一个人明智.周围有人可能有建议吗? (也可以采取一些欺骗手段,允许拆分测试模块,同时仍然收到可用的测试摘要.)
The Boost documentation left me pretty confused and none the wiser; anyone around who might have a suggestion? (Some trickery allowing to split up the test module while still receiving a usable test summary would also be welcome.)
推荐答案
Take a look at the --run_test parameter - it should provide what you're after.
这篇关于是否可以仅运行Boost单元测试模块的子集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!