How do I get an scoped parameter using ITestContext?

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

How do I get an scoped parameter using ITestContext?

cytoe
Lets say I have:

<suite name="blah">
   <parameter name="foo" value="1"/>
   <test name="x">
       <parameter name="foo" value="not 1"/>
   </test>
   <test name="y">
       <parameter name="foo" value="2"/>
   </test>
</suite>

How do I get the value of test "y", parameter "foo" using ITestContext?
Reply | Threaded
Open this post in threaded view
|

Re: How do I get an scoped parameter using ITestContext?

Cédric Beust ♔


On 3/2/07, cytoe <[hidden email]> wrote:


Lets say I have:

<suite name="blah">
   <parameter name="foo" value="1"/>
   <test name="x">
       <parameter name="foo" value="not 1"/>
   </test>
   <test name="y">
       <parameter name="foo" value="2"/>
   </test>
</suite>

How do I get the value of test "y", parameter "foo" using ITestContext?

testContext.getSuite().getXmlSuite() will give you the entire suite file, but I'm not seeing any way to find the current XmlTest (apparently an oversight on my part).

--
Cedric


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How do I get an scoped parameter using ITestContext?

cytoe

getAllParameters().get(key) works if there's only one test overriding a parameter...  Otherwise, it gets the value set by the last test.

Cédric Beust ♔ wrote
On 3/2/07, cytoe <cytoe@msn.com> wrote:
>
>
>
> Lets say I have:
>
> <suite name="blah">
>    <parameter name="foo" value="1"/>
>    <test name="x">
>        <parameter name="foo" value="not 1"/>
>    </test>
>    <test name="y">
>        <parameter name="foo" value="2"/>
>    </test>
> </suite>
>
> How do I get the value of test "y", parameter "foo" using ITestContext?


testContext.getSuite().getXmlSuite() will give you the entire suite file,
but I'm not seeing any way to find the current XmlTest (apparently an
oversight on my part).

--
Cedric

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