【问题标题】:How to set sysproperty in testng using eclipse?如何使用 eclipse 在 testng 中设置 sysproperty?
【发布时间】:2012-08-11 00:40:43
【问题描述】:

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

  1. 让我知道如何使用 eclipse 来实现。
  2. 如果我无法使用 eclipse 设置属性,请告诉我如何创建 TestNG ANT 任务。

提前致谢。

【问题讨论】:

    标签: eclipse ant selenium testng reportng


    【解决方案1】:

    如果您不需要经常更改它,您还可以将它作为 syspropertyVariable 添加到 pom.xml 中的 maven-surefire-plugin 中,就像这样。否则,请使用之前答案中的 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>
    

    【讨论】:

      【解决方案2】:

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

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

      第二个问题,参考TestNG Ant documentation

      <testng>
         <sysproperty key="org.uncommons.reportng.escape-output" value="false"/>
         <!-- the rest of your target -->
      </testng>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-10-11
        • 2013-08-30
        • 2014-10-28
        • 1970-01-01
        • 2018-12-09
        • 2011-07-05
        • 2010-12-17
        • 1970-01-01
        相关资源
        最近更新 更多