TestNG properties

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

TestNG properties

NagaRaju Dasam
Hi Team,

I want to parameterize one of my parameter. 

in the below test suite my parameter value might keep on changing so i want to declare it only once at the top maybe suite level and that value to be replaced every time...

something like this..is it possible?
<properties>
<platform> windows</platform>
</properties>


My Xml file looks like this..

<suite name="Suite1" verbose="1" >
  <test name="Nopackage" >
<parameter name="platform" value="windows" />
    <classes>
       <class name="NoPackageTest" />
    </classes>
  </test>
 
  <test name="Regression1">
<parameter name="platform" value="windows" />
    <classes>
      <class name="test.sample.ParameterSample"/>
      <class name="test.sample.ParameterTest"/>
    </classes>
  </test>

 <test name="Regression2">
<parameter name="platform" value="windows" />
    <classes>
      <class name="test.sample.ParameterSample"/>
      <class name="test.sample.ParameterTest"/>
    </classes>
  </test>
</suite>


Thanks,
Naga

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG properties

Krishnan Mahadevan

In that case, why not define

 

<parameter name="platform" value="windows" />

 

at the <suite> level. So if a particular <test> doesn’t define it, the value defined at the <suite> level takes precedence and if a value is defined at the <test> level, then it gets considered.

 

 

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/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of NagaRaju Dasam <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, November 13, 2017 at 9:47 PM
To: testng-users <[hidden email]>
Subject: [testng-users] TestNG properties

 

Hi Team,

 

I want to parameterize one of my parameter. 

 

in the below test suite my parameter value might keep on changing so i want to declare it only once at the top maybe suite level and that value to be replaced every time...

 

something like this..is it possible?

<properties>

<platform> windows</platform>

</properties>

 

 

My Xml file looks like this..

 

<suite name="Suite1" verbose="1" >

  <test name="Nopackage" >

<parameter name="platform" value="windows" />

    <classes>

       <class name="NoPackageTest" />

 

    </classes>

  </test>

 

 

  <test name="Regression1">

<parameter name="platform" value="windows" />

    <classes>

      <class name="test.sample.ParameterSample"/>

 

      <class name="test.sample.ParameterTest"/>

    </classes>

 

  </test>

 

 <test name="Regression2">

<parameter name="platform" value="windows" />

    <classes>

      <class name="test.sample.ParameterSample"/>

 

      <class name="test.sample.ParameterTest"/>

    </classes>

 

  </test>

</suite>

 

 

Thanks,

Naga

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.