【问题标题】:Adding Information To JUnit Test Results via tycho-surefire-plugin通过 tycho-surefire-plugin 向 JUnit 测试结果添加信息
【发布时间】:2017-09-28 07:36:28
【问题描述】:

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>

这会将行 &lt;property name="propertyName" value="propertyValue1"/&gt; 添加到 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>

...但是这些值都没有打印在 XML 结果中。

如何使用tycho-surefire-plugin向 JUnit 测试结果添加信息?

【问题讨论】:

    标签: tycho tycho-surefire-plugin


    【解决方案1】:

    documentation of the tycho-surefire-plugin 声明您应该使用&lt;systemProperties&gt; 映射:

    <configuration>
      <systemProperties>
        <propertyName>propertyValue1</propertyName>
      </systemProperties>
    </configuration>
    

    这将使用-DpropertyName=propertyValue1 启动分叉的测试JVM。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-24
      • 2022-01-14
      • 1970-01-01
      • 1970-01-01
      • 2016-02-06
      • 1970-01-01
      • 2011-03-22
      • 2011-06-03
      相关资源
      最近更新 更多