简体   繁体   English

如何使用Boost.Test硬编码跳过的测试?

[英]How do I hardcode a skipped test using Boost.Test?

While coding using python's unittest module, I have found it useful to mark tests to be skipped on execution (see unittest.SkipTest exception in python ) 使用python的unittest模块进行编码时,我发现将测试标记为在执行时被跳过很有用(请参见python中的unittest.SkipTest异常

Is there anything similar in Boost.Test? Boost.Test中有类似的东西吗?

I am implementing my tests using boost version 1.49.0 and I want to add something like: 我正在使用1.49.0升压版实现我的测试,我想添加以下内容:

BOOST_AUTO_TEST_CASE(test_wibly)
{
    throw boost::???::skip_test("http://my::defect.tracking.software/#4321");
}

Basically this should not consider the test as passed or failed, but "skipped" and it should appear so in the output. 基本上,这不应将测试视为通过或失败,而应“跳过”,并且应在输出中显示。

If there is nothing like it, where can I find some resources on how to implement it myself (on top of Boost.Test)? 如果没有类似的东西,我在哪里可以找到一些有关如何自己实现的资源(在Boost.Test之上)?

The documentation has a section on skipping tests, but it refers to skipping a test suite if a previous test fails. 该文档中有关于跳过测试的部分,但是它指的是如果先前的测试失败,则跳过测试套件。

As far as I know there is no way to do this with Boost Test. 据我所知,Boost Test无法做到这一点。

I have run across the NCBI C++ Toolkit , which has an enhanced version of Boost Test that adds these sort of capabilities. 我已经遍历了NCBI C ++工具箱 ,该工具箱具有Boost Test的增强版,其中添加了这些功能。 I haven't had an occasion to try it yet, so I can't vouch for it. 我还没有机会尝试一下,所以我不能保证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM