Is there any way to pass Multiple data providers to one testcase at a time????

3,105 views
Skip to first unread message

Balamurali K

unread,
Mar 26, 2014, 7:08:32 AM3/26/14
to testng...@googlegroups.com
Hi Team,

Below is my testcase sample

    @TestConfigPath("/config/ipp_test_configurations.json")
    @Test(enabled=true, dataProvider = "from-json", dataProviderClass = WebDriverProvider.class)
    public void disconnectBigTimeExpressFromAppCenter(WebDriver driver)
throws Exception { }

 This is how my current test case look like. The annotation given over here will set configurations for running the testcase which happens from a json file.

  I don't want to disturb these annotations  because they are build and given to us by a third party for running our testcases on their infrastructures or machines

Now I am looking forward to pass one more dataprovider for supplying my testdata which is stored in excel to testcases . Basically, I am looking for some simple strategies like below :-

@Test(enabled=true, dataProvider = "from-json","myNewDP", dataProviderClass = WebDriverProvider.class). 

Yes I know the above will throw compiler error. But is there any other way to pass Multiple data providers to one testcase at a time.

I have gone through couple of articles in Internet. They all are trying to merge their dataproviders  which wont work in my case .


Thanks in advance,
Bala

Krishnan Mahadevan

unread,
Mar 26, 2014, 2:12:30 PM3/26/14
to testng...@googlegroups.com
Bala
Why not involve a @Factory + @DataProvider here ?

Your factory can generate test classes wherein each test class would contain a @Test method which is also coupled with a @DataProvider. 

So in your case the DataProvider bound with factory would produce WebDriver instances which can be pushed into a TestClass instance as and when it is instantiated and this can be used by the test method in your test class which itself would be powered by a DataProvider. Would that work ? 

Incase it all sounds Greek and Latin please elaborate your use case and explain more and I can perhaps share some pseudo code which can get you started. 

iSent. iPhone. iReget. iThumbs.iTypos!
--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages