0

I'm new to Selenium... Can anyone please explain me Data Provider annotation of Testing in easy way with examples.

P.S.: I have searched in your site for this topic but I didn't get the basic leveler explanation

Your help is much appreciated.

Curious
  • 282
  • 4
  • 21
Anisha
  • 1
  • 1
  • Hello and welcome to Stack Exchange. Please consider taking the [tour] and going through the help center. – Sampada Apr 24 '16 at 14:41
  • Read [this](http://stackoverflow.com/help/how-to-ask). Reviewers will likely reject your question because it is too broad and shows too little research. Suggest you google *selenium data provider annotation*. – MikeJRamsey56 Apr 24 '16 at 14:54

2 Answers2

1

hi to understand data provider read below

Marks a method as supplying data for a test method. The annotated method must return 
an Object[][] where each Object[] can be assigned the parameter list of 
the test method.The @Test method that wants to receive data from this DataProvider needs 
to use a dataProvider name equals to the name of this annotation.

for more info go to official url http://testng.org/doc/documentation-main.html

0

The @DataProvider annotation is a TestNG feature, not Selenium. The data provider allows you to pass an entire row of test data, from a spreadsheet, directly into your test method, OR you can pass a instance of webdriver (generated inside the dataprovider method, complete with desired Selenium capabilities) directly into each method under test. Also, in @Before annotations, you can access things coming from data provider and make setup decisions before your test starts. For, example, your if CSV row data contains a particular environment name, you can call a environment test fixture based on that value, before the test starts.

The HOW of how it works, is partially explained in the above link.

djangofan
  • 28,471
  • 61
  • 196
  • 289