如何使BOOST_TEST_MESSAGE显示在屏幕上? [英] How do I get BOOST_TEST_MESSAGE to display on the screen?

查看:286
本文介绍了如何使BOOST_TEST_MESSAGE显示在屏幕上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在摸索通过Boost单元测试框架的方式,并且已经建立了基本的功能单元测试.我正在使用BOOST_TEST_MESSAGE让用户知道正在运行哪些测试,但是消息没有显示在屏幕上.例如:

I'm fumbling my way through the Boost Unit Testing Framework and have set up a basic functioning unit test. I'm using BOOST_TEST_MESSAGE to let the user know which tests are running, but the messages don't display on the screen. For example:

#define BOOST_TEST_MODULE MyTest

#include <boost/test/included/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(MyTestSuite, MyTestFixture)

BOOST_AUTO_TEST_CASE(MessageTest)
{
  BOOST_TEST_MESSAGE( "no one sees this!" );
}

BOOST_AUTO_TEST_SUITE_END();

我尝试将BOOST_TEST_LOG_LEVEL定义为all,但这没有效果.我是从 Boost日志级参数页面中得到这个想法的,但我认为 log 的概念可能与屏幕上实际显示的内容无关.有什么想法吗?

I have tried defining BOOST_TEST_LOG_LEVEL to all but this has no effect. I got that idea from the Boost log-level parameter page, but I think the concept of the log might not be related to what is actually displayed on the screen. Any ideas?

推荐答案

按照

此工具生成的消息不会以活动日志级别阈值的默认值出现在测试日志输出中.为了使这些消息出现,活动日志级别阈值必须设置为小于或等于消息"的值.

Messages generated by this tool do not appear in test log output with default value of the active log level threshold. For these messages to appear the active log level threshold has to be set to a value below or equal to "message".

在运行测试二进制文件时,请将环境变量BOOST_TEST_LOG_LEVEL设置为message:

Either set the environment variable BOOST_TEST_LOG_LEVEL to message when running your test binary:

BOOST_TEST_LOG_LEVEL=message <your_test>

或传递命令行参数--log_level:

<your_test> --log_level=message

这篇关于如何使BOOST_TEST_MESSAGE显示在屏幕上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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