0. 任务:
为Eclipse写一个插件,可以显示用CppUTest写的单元测试结果。
注:CppUTest是一种C++的单元测试框架
1. 准备
Eclipse 4.2.2CDT 8.1.2CppUTest 3.4
2. 新建项目
"file" -> "new" -> "others..." -> "plug-in development" -> "plug-in project"
3. 添加依赖和扩展
double click "MANIFEST.MF" in the project -> "Dependencies" -> "add" -> "org.eclipse.cdt.testrunner" -> "OK"
double click "MANIFEST.MF" in the project -> "Extensions" -> "add" -> "org.eclipse.cdt.testrunner.TestsRunner" -> "finish"
注:在开发的插件是对CDT TestsRunner的扩展,因此,需要添加CDT TestsRunner作为依赖和扩展
4. 编辑扩展
保存
并验证
"run as..." -> "eclipse application"
在新打开的Eclipse中
"run" -> "run configuration" -> "C/C++ unit" -> "new" -> "C/C++ testing" -> "tests runner"
可以看到新添加的 test runner