[testng-dev] DataProvider combined with @BeforeSuite

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

[testng-dev] DataProvider combined with @BeforeSuite

Richard Hansson
Hello.
I've built an appium test suite ( automation framework for native apps)  with the help of  testNG framework. 

My test suite structure is the following : a baseClass where I setup my server capabilities and emulator options, I then extend my baseClass in all my tests, the baseClass has a @BeforeSuite annotation so I only setup my server ONCE when I run my xml file to run all the tests. 

I now want to run my testSuite on multiple emulators, I thought the easiest way to do this is use testng Dataprovider like this :


@DataProvider
public static Object[][] credentials() {

   
return new Object[][]{{"7.1.1", "Pixel_XL_API_25"}, {"6.0.0", "Nexus_6_API_23"}};

}

But the problem is I can't use a dataprovider combined with @BeforeSuite. How do I workaround this? I know this is intended that DataProvider can only be comebined with @Test. 

Appreciate all help
Regards

--
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [testng-dev] DataProvider combined with @BeforeSuite

⇜Krishnan Mahadevan⇝

Richard

@BeforeSuite is designed to run ONLY once per <suite>.

If you want it to be run multiple times then you would need to choose one of the other alternatives :
1. @BeforeTest - runs before every <test>
2. @BeforeClass - runs before any @Test method in a test class gets executed
3. @BeforeMethod - runs before a @Test method.


On Thu, Sep 7, 2017, 00:52 Richard Hansson <[hidden email]> wrote:
Hello.
I've built an appium test suite ( automation framework for native apps)  with the help of  testNG framework. 

My test suite structure is the following : a baseClass where I setup my server capabilities and emulator options, I then extend my baseClass in all my tests, the baseClass has a @BeforeSuite annotation so I only setup my server ONCE when I run my xml file to run all the tests. 

I now want to run my testSuite on multiple emulators, I thought the easiest way to do this is use testng Dataprovider like this :


@DataProvider
public static Object[][] credentials() {

   
return new Object[][]{{"7.1.1", "Pixel_XL_API_25"}, {"6.0.0", "Nexus_6_API_23"}};

}

But the problem is I can't use a dataprovider combined with @BeforeSuite. How do I workaround this? I know this is intended that DataProvider can only be comebined with @Test. 

Appreciate all help
Regards

--
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev.
For more options, visit https://groups.google.com/d/optout.
--

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/

--
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [testng-dev] DataProvider combined with @BeforeSuite

William Kilian
This discussion belongs on the user list, but this use case also sounds like it fits @Factory better than @DataProvider.

Thanks,

William Kilian
--
Sent from my phone

On September 6, 2017 8:26:49 PM CDT, "⇜Krishnan Mahadevan⇝" <[hidden email]> wrote:

Richard

@BeforeSuite is designed to run ONLY once per <suite>.

If you want it to be run multiple times then you would need to choose one of the other alternatives :
1. @BeforeTest - runs before every <test>
2. @BeforeClass - runs before any @Test method in a test class gets executed
3. @BeforeMethod - runs before a @Test method.


On Thu, Sep 7, 2017, 00:52 Richard Hansson <[hidden email]> wrote:
Hello.
I've built an appium test suite ( automation framework for native apps)  with the help of  testNG framework. 

My test suite structure is the following : a baseClass where I setup my server capabilities and emulator options, I then extend my baseClass in all my tests, the baseClass has a @BeforeSuite annotation so I only setup my server ONCE when I run my xml file to run all the tests. 

I now want to run my testSuite on multiple emulators, I thought the easiest way to do this is use testng Dataprovider like this :


@DataProvider
public static Object[][] credentials() {

   
return new Object[][]{{"7.1.1", "Pixel_XL_API_25"}, {"6.0.0", "Nexus_6_API_23"}};

}

But the problem is I can't use a dataprovider combined with @BeforeSuite. How do I workaround this? I know this is intended that DataProvider can only be comebined with @Test. 

Appreciate all help
Regards

--
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev.
For more options, visit https://groups.google.com/d/optout.
--

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/

--
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev.
For more options, visit https://groups.google.com/d/optout.