Re: how to pass the @testng.test invocationCount="5" through the properties file or xml file

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

Re: how to pass the @testng.test invocationCount="5" through the properties file or xml file

Anna
Hi Cédric,
I am wondering if this useful feature was ever implemented? 

thanks and best regards,
Anna

On Monday, 24 October 2005 02:46:26 UTC+3, Cedric wrote:


On 10/21/05, Cédric Beust ♔ <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="r67GBCjsBa8J" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cbe...@...> wrote:
Hi Ram,

Well, actually there's a slight problem and parameter substitution is not going to work in this case, because this attribute is typed:  it's an integer.

You are not seeing this since you are using the JDK 1.4 version and everything is a String, but the annotation is really:

  @Test(invocationCount = 10, successPercentage = 80)

...  and right now, I can't find any good way of being able to replace 10 with the value of a parameter...

Any suggestion?

I thought about it more, and here is a possibility:

<parameter name="invocation" value="10" />
<parameter name="sp" value="80" />

@Test(invocationCountVar = "invocation", successPercentageVar = "sp")

Basically, just using the same attribute name as above but adding "Var", and in this case, the value will be fetched from testng.xml.

What do you think?

--
Cédric

--
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
|  
Report Content as Inappropriate

Re: how to pass the @testng.test invocationCount="5" through the properties file or xml file

Krishnan Mahadevan
Anna,

You have revived a really old TestNG thread.
You might want to make use of IAnnotationTransformer, which provides a much more easier way of altering any of the @Test annotations attributes in Runtime.
  • See here for some general documentation about Annotation transformer.
  • See here for javadocs.
  • See here for some samples.
  • See my blog post here to get introduced to the concept of Listeners in TestNG

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/

On Tue, Mar 14, 2017 at 12:50 PM, Anna <[hidden email]> wrote:
Hi Cédric,
I am wondering if this useful feature was ever implemented? 

thanks and best regards,
Anna

On Monday, 24 October 2005 02:46:26 UTC+3, Cedric wrote:


On 10/21/05, Cédric Beust ♔ <[hidden email]> wrote:
Hi Ram,

Well, actually there's a slight problem and parameter substitution is not going to work in this case, because this attribute is typed:  it's an integer.

You are not seeing this since you are using the JDK 1.4 version and everything is a String, but the annotation is really:

  @Test(invocationCount = 10, successPercentage = 80)

...  and right now, I can't find any good way of being able to replace 10 with the value of a parameter...

Any suggestion?

I thought about it more, and here is a possibility:

<parameter name="invocation" value="10" />
<parameter name="sp" value="80" />

@Test(invocationCountVar = "invocation", successPercentageVar = "sp")

Basically, just using the same attribute name as above but adding "Var", and in this case, the value will be fetched from testng.xml.

What do you think?

--
Cédric

--
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.
Loading...