+1 vote
in TestNG by

Write the code snipped for passing values 1 and 2 to the parameters val1 and val2 through the XML file.

1 Answer

0 votes
by

To pass the values into the parameters in TestNG, we use <parameter> tag in the TestNG XML file. Additionally, it contains two attributes:

name: the name of the parameter variable.

value: the value to insert in that variable.

Observe the following XML file denoting the same concept.

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

<suite name="My Test-Suite" >

  <test name="QA" >

    <parameter name="val1" value="1" />

    <parameter name="val2" value="2" />

    <classes>

       <class name="testNGPackage.Parameter" />

       <class name="testNGPackage.Multiple_Parameters" />

    </classes>

   </test>

</suite>

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

 

<suite name="My Test-Suite" >

  <test name="QA" >

    <parameter name="val1" value="1" />

    <parameter name="val2" value="2" />

    <classes>

       <class name="testNGPackage.Parameter" />

       <class name="testNGPackage.Multiple_Parameters" />

    </classes>

   </test>

</suite>

 

Related questions

0 votes
asked Jul 14, 2022 in Go Semantics Supplemental by john ganales
+1 vote
asked Apr 19, 2021 in TestNG by rajeshsharma
...