DataDriven - executing scripts multiple times without dataprovider method

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

DataDriven - executing scripts multiple times without dataprovider method

benny jose
Hi Team,

QUERY 1: Can you suggest a method to RUN @TEST method multiple times without using @data provider.

snippet :
for(i = 1 ;i<=number of iterations;i++)
{
#method will get different sets of data during run time
@test
}

QUERY 2 : I will have a master excel sheet which contains all the test cases with a "YES" or "NO" flag and testcases(@test) with "YES" flag must be executed.Is this feasible with using TestNG

Thanks for your response in advance.

Thanks,
Benny.

--
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: DataDriven - executing scripts multiple times without dataprovider method

Krishnan Mahadevan
>>> QUERY 1: Can you suggest a method to RUN @TEST method multiple times without using @data provider.

When the data provider was built in TestNG to solve this exact purpose, can you please help us understand as to why you donot want to use a data provider ? If you use a data provider, then every single row from your data provider is considered as a distinct test iteration. If you resort to using a for..loop then all the iterations are considered as 1 single iteration. Also remember that when you use a data provider, TestNG will continue to run the remaining iterations irrespective of failures in between. That will not be the case, when you run the tests via a for..loop without explicitly adding try..catch logic and resorting to gobbling of exceptions.

>>> QUERY 2 : I will have a master excel sheet which contains all the test cases with a "YES" or "NO" flag and testcases(@test) with "YES" flag must be executed.Is this feasible with using TestNG

Yes you can do this very easily from within a data provider. All you need to do is retrieve your data from your spreadsheet, and then filter out all rows that contain a value of "YES" and then run them.

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, Jan 9, 2018 at 6:13 PM, benny jose <[hidden email]> wrote:
Hi Team,

QUERY 1: Can you suggest a method to RUN @TEST method multiple times without using @data provider.

snippet :
for(i = 1 ;i<=number of iterations;i++)
{
#method will get different sets of data during run time
@test
}

QUERY 2 : I will have a master excel sheet which contains all the test cases with a "YES" or "NO" flag and testcases(@test) with "YES" flag must be executed.Is this feasible with using TestNG

Thanks for your response in advance.

Thanks,
Benny.

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