calling parameters from another xml

419 views
Skip to first unread message

JT_selenium

unread,
May 28, 2013, 4:29:32 PM5/28/13
to testng...@googlegroups.com
Hi,
I have parent xml and different child xmls. I want to declare all parameters in parent xml and need to get available in child xml so that i dont need to keep same parameters in all xmls. Is there any way i can do this. I got some solution like below but its not working

<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" [<!ENTITY parent SYSTEM "../parent.xml">]>

where above line is declared in child.xml to call parameters from parent.xml but its not working or not able to link parameters. If there is any other solution to link different xmls please let me know.

thanks,
JT



Krishnan Mahadevan

unread,
May 28, 2013, 10:34:25 PM5/28/13
to testng...@googlegroups.com
I wasnt aware that TestNG suite xmls can extend each other. 

Cedric,
Is this present in TestNG ?
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


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

Cédric Beust ♔

unread,
May 29, 2013, 1:07:25 AM5/29/13
to testng...@googlegroups.com
You can include suites in each other with the <suite-files> tag.


-- 
Cédric

JT_selenium

unread,
May 29, 2013, 9:59:13 AM5/29/13
to testng...@googlegroups.com, ced...@beust.com
Hi Cedric,
Any solutions where i can describe common parameters in one xml and call that xml in another test suites?

I dont want to use <suite-files> tag as i need to repeat all parameters again in different xmls which i dont want.

Any help will be appreciate.....
thanks,
Jt

On Wednesday, May 29, 2013 1:07:25 AM UTC-4, Cédric Beust ♔ wrote:
You can include suites in each other with the <suite-files> tag.


-- 
Cédric



On Tue, May 28, 2013 at 7:34 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
I wasnt aware that TestNG suite xmls can extend each other. 

Cedric,
Is this present in TestNG ?


On Wednesday, May 29, 2013, JT_selenium wrote:
Hi,
I have parent xml and different child xmls. I want to declare all parameters in parent xml and need to get available in child xml so that i dont need to keep same parameters in all xmls. Is there any way i can do this. I got some solution like below but its not working

<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" [<!ENTITY parent SYSTEM "../parent.xml">]>

where above line is declared in child.xml to call parameters from parent.xml but its not working or not able to link parameters. If there is any other solution to link different xmls please let me know.

thanks,
JT



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.

To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

JT_selenium

unread,
May 29, 2013, 10:58:14 AM5/29/13
to testng...@googlegroups.com, ced...@beust.com
Got the solution where xml parameters can be defined at one place and can be called in mulitple suite files so need to declare common parameters again. 

Declare like below: 
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" [<!ENTITY parent SYSTEM "../parent.xml">]>

and in parameter field just declare

&parent......it willl take care.

-JT

Krishnan Mahadevan

unread,
May 29, 2013, 11:44:41 PM5/29/13
to testng...@googlegroups.com, ced...@beust.com
That's really interesting! Thanks for sharing this info. I never knew about this till now :)

vamseedhar vuppu

unread,
Apr 5, 2017, 12:12:30 AM4/5/17
to testng-users, ced...@beust.com
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" [<!ENTITY parent SYSTEM "../parent.xml">]>
<parameters>&parent;</parameters>

Using above approach is broken with TestNG 10+. Anyone aware of it?

Below is the error we are getting now for "parameters" tag in xml

 org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 15; Element type "parameters" must be declared. 
Reply all
Reply to author
Forward
0 new messages