如何boost.test库执行规定的测试套件 [英] How to execute specified test suites in boost.test library

查看:478
本文介绍了如何boost.test库执行规定的测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Boost.Test库在C执行单元测试用例++。假设我有两套房,如

I am using Boost.Test library for implementing unit test cases in C++. Suppose I have two suites such as

BOOST_AUTO_TEST_SUITE(TestA)
BOOST_AUTO_TEST_CASE(CorrectAddition)
{
BOOST_CHECK_EQUAL(2+2, 4);
}

BOOST_AUTO_TEST_CASE(WrongAddition)
{
    BOOST_CHECK_EQUAL(2 + 2, 5);
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE(TestB)
BOOST_AUTO_TEST_CASE(CorrectAddition)
{
bool ret = true;
    BOOST_CHECK_EQUAL(ret, true);
}
BOOST_AUTO_TEST_CASE(WrongAddition)
{
    BOOST_CHECK_EQUAL(2 + 2, 5);
}
BOOST_AUTO_TEST_SUITE_END() 

和我想只说运行一套TESTB',我应如何执行它。
我真的很感谢您的时间和帮助。很抱歉,如果这个问题是被张贴或别的地方记录。

and I would like to run only say suite 'TestB', how shall I execute it. I really thank for your time and help. Sorry if this question is been posted or documented else where.

推荐答案

假设你正在使用的库提供的主要切入点,命令行解析等,并没有推出自己的,你可以选择特定的测试通过在运行时命令行开关套件和测试用例的名字或图案。

Assuming you are using the library-supplied main entry point, command-line parsing, etc., and haven't rolled your own, you can select specific test suites and test cases by name or pattern via a command-line switch at run time.

请参阅这个页面在一个很好的例子文档

这篇关于如何boost.test库执行规定的测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆