Passing Variable parameter through testng.xml

2,166 views
Skip to first unread message

mahadi hasan

unread,
Jan 15, 2013, 4:53:49 PM1/15/13
to testng...@googlegroups.com
Hi,

I am trying to write some variable parameter in testng.xml and the value of the variables i want pass by Jenkins. In order to do that i am trying to do the bellow:

 <test name="Functional test" preserve-order="true">
      <parameter name="testEnv" value=${testEnv}> </parameter>
    <classes>
      <class name="com.hero.TestClass"/>
    </classes>
  </test>


And in Jenkins i am creating a String Parameter:
Name: testEnv
Default Value: staging


Now when i run the test it says:
[testng] [TestNG] [Error] org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 36; Open quote is expected for attribute "{1}" associated with an element type "value".


I am not sure if this is the correct way to do such types of job, can anyone please correct me where i am doing the wrong.

Best Regards,
Mahadi

Krishnan Mahadevan

unread,
Jan 15, 2013, 8:33:39 PM1/15/13
to testng...@googlegroups.com
I dont think you can do it this way. 
However if your project is a Maven project then you could do the following :
Add a <resources> [ for src/main/resources] or a <testResources> [ for src/test/resources ] in your <build> section. Add filtering to it and specify your suite file in it. Then you could specify 
mvn resources:resources / mvn resources:testResources to do this. 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/NAGnsiCB6_wJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
Reply all
Reply to author
Forward
0 new messages