using CodePro coverage With JUnit

codepro coverage插件没有特别针对JUnit, 所以直接右键在Test class 'AllTests.java'上运行菜单‘CodePro Tools->Run code coverage' 会报错

Launch Failed


      The selection does not contain a main type

这是因为运行这种方法是通过查找main方法

通过查看 Evaluation Guide 找到了运行JUnit之后查看代码覆盖率的方法,

(原来没有看仔细,下面这种方法已经在introduction页面的Full Featured Code Coverage讲到)

1,InthePackageExplorer,right-clickontheprojectandfromtheCodeProToolssub-menuselectInstrumentCode.

2.runtheJUnittestasnormalway.

3.in the converage view, a result is shown

第一步会在Project的'.project'文件中增加一个builder/nature

<buildCommand>
	<name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name>
	<arguments>
	</arguments>
</buildCommand>



<nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature>

相关推荐