Question

I have the following in testng.xml

...
<parameter name="Empl_Name" value="Stephen" />
<test name="Employee Search test" junit="false">
    <parameter name="Valid_Empl_Name" value="${Empl_Name}" />
    <classes> 
          <class name="org.EmployeeClass" />
    </classes> 
</test>

The above is not working. My requirement is that I want to refer the Parameter Valid_Empl_Name with the above mentioned Empl_Name. I want to reuse the Empl_Name parameter value in many of the test cases.

Is there any way to do this ?

Was it helpful?

Solution

This is currently not supported in TestNG but I'd be open to adding it.

OTHER TIPS

Yes, its quite complex, but there is a way. If you build your project with Maven, there is a Maven plugin called build-helper-maven-plugin that will let you pre-process the .xml file before the build starts.

I did this in this project, but you can probably find better examples elsewhere. Maven is no longer favored over Gradle anyways; maybe you can do the same thing with Gradle (or Groovy script).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top