aspose file tools*
The moose likes Testing and the fly likes Dataprovider in TestNg Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Dataprovider in TestNg" Watch "Dataprovider in TestNg" New topic
Author

Dataprovider in TestNg

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

With reference to this interview of C�dric Beust

http://www.artima.com/lejava/articles/testng.html

I have question regarding dataProvider on whether we really need it ?

How is writing
different from



Groovy
Cedric Beust
author
Ranch Hand

Joined: Oct 12, 2004
Posts: 46
Imagine that getData() returns a thousand different data sets. You want to have a thousand tests invoked, each with one set, not one test that tests one thousand different test cases...

--
Cedric


Originally posted by Pradip Bhat:
With reference to this interview of C�dric Beust

http://www.artima.com/lejava/articles/testng.html

I have question regarding dataProvider on whether we really need it ?

How is writing
different from

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Thanks Cedric.Now I understand how dataprovider works. Sorry I did not read your interview completely.My fault. It is really useful feature.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Like you said if there are 1000 records and 850th record cause the test to fail does, TestNg print the offending record or just would say that test fail ? Thanks
Cedric Beust
author
Ranch Hand

Joined: Oct 12, 2004
Posts: 46
Hi Pradip,

Originally posted by Pradip Bhat:
Like you said if there are 1000 records and 850th record cause the test to fail does, TestNg print the offending record or just would say that test fail ? Thanks

The report tells you exactly which parameters were used for each invocation, so it's trivial to find out exactly which data set caused the test to fail.

--
Cedric
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Cedric Beust:
Hi Pradip,


The report tells you exactly which parameters were used for each invocation, so it's trivial to find out exactly which data set caused the test to fail.

--
Cedric


Thanks Cedric
Darvesh Niz
Ranch Hand

Joined: May 12, 2008
Posts: 119
Extending on this topci of dataprovider, can i provide two dataprovider for one test method.
like for example i have oneDataprovider which provides queryString and i use that to get values from SOLR for different criteria.

then i have to sort of various datapoint like last name, firstname and i have to again provide a sort by criteria. hence i need to have one more dataprovider.

LEt me know
Thanks
Hermann Kuschke
Greenhorn

Joined: Dec 13, 2011
Posts: 1
Cedric,

First of all, even though I'm sure many people have told what a great technology this is, I want to still thank you because it helps many coders out more than you can imagine.

My questions is related to dataprovider methods. In my case I am simply looking to test around 200 pages on a site on our intranet. Nothing complicated. Everything is working, but in the report the only thing that I am wondering about it why every single parameter is shown for each test.

Let me explain. My dataprovider method creates an Object[][] array for which each Object[] contains only an array of type String and length 1. The emailable report correctly reports that 200 tests were run and so on, but when I scroll down in the report, for each test (of 200) it shows all the parameters (all 200). So it doesn't just show the 1 parameter that relates to that instance of the test method, but instead it shows all the parameters every time.

I hope I have explained myself well enough. I am sure I am missing something. It is one of those cases where it feels like the technology should be able to display only the related parameter so for that reason I am fairly positive that I am doing something wrong.

Thanks in advance,

Hermann
 
 
subject: Dataprovider in TestNg