我使用的是Eclipse CDT和Boost.Test(带有Boost.Build)。我希望Eclipse能够解析在构建过程中运行测试套件时生成的Boost.Test输出。
有谁知道如何做到这一点吗?提前感谢
发布于 2010-09-23 20:17:40
转到窗口>首选项。在preferences对话框中,从options树中选择C/C++ > Build。在错误解析器下,单击“添加...”在新对话框中,将"Regex Error Parser“替换为"Boost Unit Test Error Parser”。
在Error Parser Options窗格中,添加以下行。我不能保证这些规则可以捕获boost单元测试的所有可能输出,但到目前为止,它们对我来说是有效的,我们可以在以后添加更多:
Severity | Pattern | File | Line | Description
Error | (.*)\((\d*)\): ((fatal )?error in ".*":.*) | $1 | $2 | $3
Error | \*\*\* (\d* failures detected in test suite ".*")| | | $1
Info | (.*)\((\d*)\): (last checkpoint) | $1 | $2 | $3请注意,新的解析器不会自动用于现有项目。要为现有项目启用解析器,请转到Project > Properties,C/C++ Make project,Error parser选项卡。如果新添加的解析器不在列表中,请单击"Restore Defaults",它现在应该是可用的。
发布于 2012-12-07 16:15:56
还有一个很好的插件叫做cdt c/c++ test runner,它支持Google test,boost test和qt test。
您可以在以下链接中找到说明:
https://github.com/xgsa/cdt-tests-runner/wiki/Tutorial
我已经使用它一段时间了,我发现它很高效,很好用。它有一些特性,比如用于Java的JUnit插件。
发布于 2020-11-19 19:13:17
我也有同样的问题,我的集成开发环境(gedit)无法识别Boost.Test的输出格式(由于某些原因,它与gnu和clang输出不兼容)。
您可以通过在测试中粘贴以下内容来以编程方式更改输出格式:
#include<boost/test/output/compiler_log_formatter.hpp>
struct gedit_config{
struct formatter : boost::unit_test::output::compiler_log_formatter{
void print_prefix(std::ostream& out, boost::unit_test::const_string file, std::size_t line){
out<< file <<':'<< line <<": ";
}
};
gedit_config(){boost::unit_test::unit_test_log.set_formatter(new formatter);}
};
BOOST_GLOBAL_FIXTURE(gedit_config);https://stackoverflow.com/questions/2491380
复制相似问题