• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to have different data provides in TestNG

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In TestNG i am using Data provider to test my testXSLExtractor method with large number of data(Data driven testing), here how can i have more than one data provider to my test method(testXSLExtractor)? is it possible with TestNG ?

something like this dataProvider = "UrlProvider1,UrlProvider2,UrlProvider3"(i tried this way but no luck).

 
Gopi Chella
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OOPS !!! No one replied
 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you should try using google.
"different data providers in testng" gives some good results on the first page.

I skimmed the one from "Old Nabble"...
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recently i have worked on that, so find the below code to understand the solution..

The below code used to read the data from excel sheet and returns the array.

@DataProvider(name = "PegaDataPool")
public Object[][] createDataPool(Method testMethods) {
ExcelReader readExcel = new ExcelReader();
List<String> tableName = new LinkedList();
if (testMethods.getName().equalsIgnoreCase("testNewCaseRegistration")) {
tableName.add("pegaUserData");
Object[][] retObjArr = readExcel.getTableArray("C:/workspace/VTAF-4.0/src/TestData/PegaTestData.xls","Pega User", tableName);
return (retObjArr);
}
return null;
}

you can use above values in the below methods

@Test(dataProvider = "PegaDataPool")
public void testNewCaseRegistration(String branch, String enquiryAmount,String debitAmount, String transactionDate, String tableName)throws Exception {

these branch, enquiryAmount variables can use whenever you require the data present in it.

}

Please find the attachment to know the data present in excel sheet.


Hope it will be useful to u...


 
Gopi Chella
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply, however my question is different.
For example you have three data provider methods like below

the above are three seperate data provider method and my requirement is i want to use all the three data provider in my Test method like below,



 
author
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, but nothing stops you from having a data provider combine the results of several data providers and use that one in your @Test method.

 
Gopi Chella
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks i got it .
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am working on the same scenario(multiple dataproviders for single Test).
Could you explain in detail the steps to use multiple dataproviders for single Test?

Thanks

Regards,
Priya.M
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic