Run testclass several times in sequence

32 views
Skip to first unread message

Ilya Zinkevich

unread,
Jul 5, 2016, 9:32:04 AM7/5/16
to testng-users
I have testNG testclass that runs selenium smoke-test on webresource. I need it to be started sequentially as many times as number of strings in input datafile (e.g. xls). And these parameters should be provided to testsuite somehow. Is it any way to run tests this way?

⇜Krishnan Mahadevan⇝

unread,
Jul 5, 2016, 10:39:09 AM7/5/16
to testng...@googlegroups.com
You might want to try using a Factory powered by a data provider, wherein the data provider would feed off of an excel spreadsheet, to create test class instances and the test class can basically have one or more @Test annotated test methods that can use the value passed to its instance to do its task.

Sequential execution can be easily controlled by the data-provider-thread-count and the parallel attribute of the @DataProvider annotation.

With respect to the parameters and the test suite, you would need to share a bit more context around it so that someone in the forum can help you out with an answer.

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, Jul 5, 2016 at 5:49 PM, Ilya Zinkevich <tunc...@gmail.com> wrote:
I have testNG testclass that runs selenium smoke-test on webresource. I need it to be started sequentially as many times as number of strings in input datafile (e.g. xls). And these parameters should be provided to testsuite somehow. Is it any way to run tests this way?

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

Ilya Zinkevich

unread,
Jul 11, 2016, 9:00:50 AM7/11/16
to testng-users
Hi,
Thanks for idea with Factory. Now is a new issue.
in @BeforeTest method I initialize ChromeDriver like

public WebDriver driver; //TestClass field

driver = new ChromeDriver(capabilities); //in @BeforeTest method

But when flow comes to first @Test, driver appears to be null. Maybe I miss something with Factory? 

вторник, 5 июля 2016 г., 17:39:09 UTC+3 пользователь Krishnan написал:

⇜Krishnan Mahadevan⇝

unread,
Jul 11, 2016, 9:22:12 AM7/11/16
to testng...@googlegroups.com
Please move your WebDriver instantiation from @BeforeTest [ this gets executed ONLY once per <test> tag ] to @BeforeClass (which gets executed before any @Test method in the class is executed by TestNG) or maybe into the Test Class constructor itself.

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/

Reply all
Reply to author
Forward
0 new messages