JUnit测试的测试结果具有一组属性的properties标记。记录的内容似乎由测试的每个执行者自行决定。
我想进一步处理XML文件,所以每次都有相同的键是很好的。对于maven-surefire-plugin来说,这非常简单:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<propertyName>propertyValue1</propertyName>
</systemPropertyVariables>
</configuration>
</plugin>这会将行<property name="propertyName" value="propertyValue1"/>添加到XML结果文件中。
对于tycho-surefire-plugin,我尝试了以下方法:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<systemPropertyVariables>
<propertyName>propertyValue1</propertyName>
</systemPropertyVariables>
<systemProperties>
<property>
<name>propertyName</name>
<value>propertyValue2</value>
</property>
</systemProperties>
<argLine>-DpropertyName=propertyValue3</argLine>
</configuration>
</plugin>...but结果中既没有打印这些值,也没有输出它们。
如何使用JUnit向tycho-surefire-plugin测试结果添加信息
发布于 2017-09-28 08:39:08
tycho-surefire-plugin声明您应该使用<systemProperties>映射:
<configuration>
<systemProperties>
<propertyName>propertyValue1</propertyName>
</systemProperties>
</configuration>这将使用-DpropertyName=propertyValue1启动分叉测试JVM。
https://stackoverflow.com/questions/46463509
复制相似问题