• 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

Dataprovider in TestNg

 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
author
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic