我对junit完全不熟悉。试图创建junit报告。我已经链接了两个项目,主文件在一个项目中,它运行来自其他项目的测试用例。
这是我的build.xml文件
作为第一个条目并再次导出构建文件。 - >
这是我的输出
Buildfile: E:\Workspace\cd5 Main Project 16-09-2014\build.xml
build-subprojects:
init:
build-project:
[echo] cd5 Main Project 16-09-2014: E:\Workspace\cd5 Main Project 16-09-2014\build.xml
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:134: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:138: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:142: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:146: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:150: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] E:\Workspace\cd5 Main Project 16-09-2014\build.xml:154: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build:
Application:
[java] 12:13:58.627 [AWT-EventQueue-0] DEBUG neo4j.xafactory - Opened [E:\Workspace\cd5 Main Project 16-09-2014\workspace\untitled71\nioneo_logical.log.1] clean empty log, version=1, lastTxId=95
[java] .Testcase id: PluginModelTest.testCreateParameter.PMTCP1
[java] PluginModelTest.testCreateParameter(): model: jp.sbi.celldesigner.plugin.api.impl.PluginModelImpl@cedaea
[java] expectedParamId: a5
[java] Parameter successfully created: Testcase successful:
[java] PluginModelImpl.deleteParameter(): id to delete: a5
[java] .Testcase id: PluginModelTest.testCreateParameter.PMTCP2
[java] PluginModelTest.testCreateParameter(): model: jp.sbi.celldesigner.plugin.api.impl.PluginModelImpl@cedaea
[java] expectedParamId: a6
[java] Parameter successfully created: Testcase successful:
[java] PluginModelImpl.deleteParameter(): id to delete: a6
[java] Time: 0.745
[java] OK (2 tests)
测试运行正常但是没有生成TESTS-TestSuites.xml。问题是什么?
答案 0 :(得分:0)
您可以在以下参考链接中获取有关Junit报告的更多信息:
答案 1 :(得分:0)
更新了答案
即使您Application
目标是从其他项目调用PluginModelTest
,我仍然不知道您的junitreport
目标与PluginModelTest
目标的关联方式
尝试在PluginModelTest
:
antcall
任务
<antcall target="junitreport">
原始答案
CDModelImplTest
和junitreport
目标都适合我。但是您的构建输出(PluginModelTest
)中显示的测试用例与构建脚本(CDModelImplTest
)中的测试用例不同...
更新:首先要尝试更新您的junitreport
目标,使其取决于CDModelImplTest
。这将确保在执行报告生成任务之前执行测试。
<target name="junitreport" depends="CDModelImplTest">
另外,我没有看到您的${junit.output.dir}
被设置在构建文件中的任何位置。除非您从命令行传递其值,否则请尝试将此属性赋值添加到构建文件的顶部:
<property name="junit.output.dir" value="test-results"/>
然后,您的所有单元测试结果和报告都将保存到test-results
文件夹中。
或者,您可以通过类似命令行将此属性传递到构建脚本中(只有在您添加depends
属性后才能使用此属性):
ant -Djunit.output.dir=test-results junitreport
希望这有帮助。