C++ 用于运行测试和浏览报告的 Eclipse (CDT) 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16741400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 20:36:20  来源:igfitidea点击:

Eclipse (CDT) plugin for running tests and browsing report

c++eclipsejunitgoogletest

提问by π?ντα ?ε?

Google's answers (hear! hear!) and Eclipse Market Place search results on this topic simply drive me crazy! And apparently the proposed SO answers aren't really helpful either.

Google 的回答(听!听!)和 Eclipse Market Place 搜索结果关于这个主题简直让我发疯!显然,提议的 SO 答案也没有真正的帮助。

I'm looking for an Eclipse plugin, that allows me to browse a JUnit report XML compliant unit test report produced from a google test runner.

我正在寻找一个 Eclipse 插件,它允许我浏览由谷歌测试运行程序生成的 JUnit 报告 XML 兼容单元测试报告。

Nice to have features:

很高兴有以下功能:

  • jump to the source from failure reports
  • run the tests automatically after building.
  • 从故障报告跳转到源
  • 构建后自动运行测试。

I'm pretty sure a (free) plugin suitable for Eclipse CDT exists, that realizes these requirements, I'm just too stupid to find it :-). May be any smarter guy/gal here?

我很确定存在适用于 Eclipse CDT 的(免费)插件,它实现了这些要求,我太笨了,找不到它:-)。这里可能有更聪明的人/女孩吗?

回答by π?ντα ?ε?

Since JUNO there is a C++ Unit testing support package. It is package of the CDT. I only used it with boost test, but AFAIK it also supports googletest.

由于 JUNO 有一个 C++ 单元测试支持包。它是 CDT 的包。我只将它用于 boost 测试,但 AFAIK 它也支持 googletest。

@mkaescomment pushed me to it!

@mkaes评论把我推到了它!

  1. Install the CDT (Help->Install Software->CDT) optional C/C++ Unit Test support
  2. Create a new Runner using 'Run As -> Run Configurations -> C/C++ Unit Test
  3. Choose 'Google Tests Runner' for 'Tests Runner' in the 'C/C++ Testing' tab
  4. Choose your testing project executable in the 'Main' tab
  5. Run it, and the 'C/C++ Unit' view shows up after (rebuild and) execution
  1. 安装 CDT (Help->Install Software->CDT) 可选的 C/C++ 单元测试支持
  2. 使用'Run As -> Run Configurations -> C/C++ Unit Test 创建一个新的 Runner
  3. 在“C/C++ 测试”选项卡中为“测试运行程序”选择“Google 测试运行程序”
  4. 在“主要”选项卡中选择您的测试项目可执行文件
  5. 运行它,并在(重建和)执行后显示“C/C++ 单元”视图

Look here for more illustrated and detailed instructions: Eclipse Juno has landed with unit testing support for C++

在此处查看更多图解和详细说明:Eclipse Juno 已提供对 C++ 的单元测试支持