How to set sysproperty in testng using eclipse?

3.2k views Asked by At

I have to set 'sysproperty key="org.uncommons.reportng.escape-output" value="false"/' in TestNG.

  1. Let me know how to do it using eclipse.
  2. Also let me know how to create a TestNG ANT task if I can not use eclipse to set the property.

Thanks in Advance.

2

There are 2 answers

0
artdanil On BEST ANSWER

The fist part of question could be addressed by accessing following menu - Run -> Run|Debug Configuration -> Your Configuration -> 'Arguments' tab -> VM arguments. Add following line to the text area:

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

For the second question, refer to TestNG Ant documentation:

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

You could also add It as a syspropertyVariable in your maven-surefire-plugin in your pom.xml, like so, if you don't need changing it often. Otherwise, use the VM arguments like in the previous answers.

<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>