Reputation: 3
To share common parameters between test suites, we are using below approach.
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" [
<!ENTITY parent SYSTEM "src/test/resources/<project_name>/common/parameters.xml">
<!ENTITY host SYSTEM "src/test/resources/<project_name>/common/hostParameters.xml">
<!ENTITY agent SYSTEM "src/test/resources/<project_name>/common/agentParameters.xml">
] >
<suite name="Test Suite" parallel="false" verbose="10">
<!-- Reference to common parameters -->
<parameters>&parent;</parameters>
<parameters>&host;</parameters>
<parameters>&agent;</parameters>
It is working with TestNG version 6.9.9 if we update TestNG with version 6.10+ we are getting below error. org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 15; Element type "parameters" must be declared.
Is something changed in 6.10+ that is not allowing "parameters" element in TestNG xml? Not sure what is causing it.
Looks like lot of people do use this way, to share common parameters between different TestNG suites. https://rationaleemotions.wordpress.com/2014/02/06/sharing-parameters-among-different-testng-suites/
Upvotes: 0
Views: 421
Reputation: 556
After deleting the parameters tag. it worked.
<parameter name="browser" value="chrome"/>
<parameter name="url" value="http://www.google.com"/>
<parameter name="node" value="http://192.168.1.7:4444/wd/hub"/>
Upvotes: 0
Reputation: 5740
Before 6.10+, TestNG didn't check well bad formatted xml.
Your xml is wrong because you have <parameters>
instead of <parameter>
.
Check the DTD order to know what is possible to do: http://testng.org/testng-1.0.dtd.php
Upvotes: 1