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,In the Package Explorer, right-click on the project and from the CodePro Tools sub-menu select Instrument Code.

2.run the JUnit test as normal way.


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>

猜你喜欢

转载自jasonright.iteye.com/blog/790207
今日推荐