• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to have different data provides in TestNG

 
Gopi Chella
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OOPS !!! No one replied
 
Tina Smith
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • 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"...
 
s lekkala
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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,



 
Cedric Beust
author
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks i got it .
 
Priya Geetha
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic