2

我必须在 TestNG 中设置 'sysproperty key="org.uncommons.reportng.escape-output" value="false"/'。

  1. 让我知道如何使用eclipse来做到这一点。
  2. 如果我不能使用 eclipse 设置属性,还请告诉我如何创建 TestNG ANT 任务。

提前致谢。

4

2 回答 2

2

如果您不需要经常更改它,您还可以在 pom.xml 中的 maven-surefire-plugin 中将它添加为 syspropertyVariable,就像这样。否则,请使用之前答案中的 VM 参数。

<groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter</value>
                    </property>
                </properties>

                <reportsDirectory>target/surefire-reports</reportsDirectory>
                <skipTests>false</skipTests>
                <systemPropertyVariables>
                    <org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
                </systemPropertyVariables>
            </configuration>
于 2013-06-14T08:41:34.023 回答
1

问题的第一部分可以通过访问以下菜单来解决 - 运行 -> 运行|调试配置 -> 您的配置 -> 'Arguments' 选项卡 -> VM 参数。将以下行添加到文本区域:

-Dorg.uncommons.reportng.escape-output=false

对于第二个问题,请参考TestNG Ant 文档

<testng>
   <sysproperty key="org.uncommons.reportng.escape-output" value="false"/>
   <!-- the rest of your target -->
</testng>
于 2012-08-14T21:51:57.843 回答