Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 如何以编程方式获取JUnit surefire报告_Maven_Junit4_Maven Surefire Plugin_Junit Runner - Fatal编程技术网

Maven 如何以编程方式获取JUnit surefire报告

Maven 如何以编程方式获取JUnit surefire报告,maven,junit4,maven-surefire-plugin,junit-runner,Maven,Junit4,Maven Surefire Plugin,Junit Runner,我需要使用JUnitCore从独立的jar测试工具运行单元测试。我已经添加了surefire JAR作为依赖项,在那里我找到了类org.apache.maven.surefire.junitcore.junitcorerUnlineStener。这是它的用法示例 我的目的是获取在运行时不使用maven运行maven所产生的xml报告 RunListener reporter = new JUnitCoreRunListener( new MockReporter(), new HashMap&l

我需要使用
JUnitCore
从独立的jar测试工具运行单元测试。我已经添加了surefire JAR作为依赖项,在那里我找到了类
org.apache.maven.surefire.junitcore.junitcorerUnlineStener
。这是它的用法示例

我的目的是获取在运行时不使用maven运行maven所产生的xml报告

RunListener reporter = new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
JUnitCore jc = new JUnitCore();
jc.addListener( reporter );
Result r = jc.run( new Computer(), AppTest.class);
jc.removeListener( reporter );
System.out.println( r );
RunListener reporter=new-junitcorrenlistener(new-MockReporter(),new-HashMap());
JUnitCore jc=新JUnitCore();
jc.addListener(记者);
结果r=jc.run(newcomputer(),AppTest.class);
jc.removeListener(记者);
系统输出println(r);
这是行不通的。从该报告器获取XML输出的正确方法是什么