When you need to pass complex parameters for example created from Java (complex objects, objects read from a property file or a database, etc…), in such cases parameters can be passed using Dataproviders. A Data Provider is a method annotated with @DataProvider. A Data Provider returns an array of objects.
Let us check out the same Search examples using Dataproviders.
Video Tutorial -
Let us check out the same Search examples using Dataproviders.
Video Tutorial -
How to do it ?
1) Define the method searchValue() which is defined as a Dataprovider using the annotation. This method returns array of object array.
2) Add a method test() to your DataProviderTest class. This method takes two strings as input parameters.
3) Add the annotation @Test(dataProvider = “search”) to this method. The attribute dataProvider is mapped to “search”.
4) Run the below code as testNG test case then the test will execute two times as we are passing two Data Values.
package test; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class TestNGDataProvider { private static WebDriver driver; @DataProvider(name = "search") public static Object[][] searchValue() { return new Object[][] { { "appium" }, { "selenium" }}; } // Here we are calling the Data Provider object with its Name @Test(dataProvider = "search") public void test(String searchtext) throws Exception { System.setProperty("webdriver.chrome.driver", "C:\\Softwares\\chromedriver_win32\\chromedriver.exe"); driver=new ChromeDriver(); driver.get("http://www.qaautomated.com"); Thread.sleep(5000); driver.findElement(By.xpath("*//input[@class='search-field']")).sendKeys(searchtext); driver.findElement(By.xpath("*//input[@class='search-submit']")).click(); driver.quit(); } }
ReplyDeleteThanks for sharing such a valuable information selenium training institute
Great Article Cloud Computing Projects
DeleteNetworking Projects
Final Year Projects for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
Your site has a lot of useful information for myself. I visit regularly. Hope to have more quality items.
ReplyDeleteludo king
Nice Sharing..! I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.
ReplyDeleteRegards
software quality assurance companies
Awesome blog. Thanks for sharing such a valuable information.Keep giving like this.
ReplyDeleteBest Selenium Training Institute In Hyderabad | Online Selenium Training
AWS Training in Bangalore - Live Online & Classroom
ReplyDeletemyTectra Amazon Web Services (AWS) certification training helps you to gain real time hands on experience on AWS. myTectra offers AWS training in Bangalore using classroom and AWS Online Training globally. AWS Training at myTectra delivered by the experienced professional who has atleast 4 years of relavent AWS experince and overall 8-15 years of IT experience. myTectra Offers AWS Training since 2013 and retained the positions of Top AWS Training Company in Bangalore and India.
IOT Training in Bangalore - Live Online & Classroom
IOT Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Reading data through the sensors and processing it with applications sitting in the cloud and thereafter passing the processed data to generate different kind of output is the motive of the complete curricula. Students are made to understand the type of input devices and communications among the devices in a wireless media.
Hello,
ReplyDeleteI just come through your blog while searching more about the software testing. Read your blog and love the way you have implemented the unique content about software testing and other testing related information. Thanks for sharing this and I will wait for your next updates. Keep it up!
Regards
software development company
Informative post, thanks for sharing.
ReplyDeleteccna Training in Chennai
ccna course in Chennai
RPA Training in Chennai
RPA courses in Chennai
AWS Training in Chennai
AWS course in Chennai
I am really enjoying reading your well written articles.
ReplyDeleteIt looks like you spend a lot of effort and time on your blog.Keep Doing.
Digital Marketing Training in Bangalore
Digital Darketing Courses in Bangalore
Best Digital Marketing Courses in Bangalore
Devops Certification in Bangalore
Devops Training and Certification in Bangalore
Best Devops Training in Bangalore
Really great blog… Thanks for your useful information.
ReplyDeleteBest Spoken English Institute in Coimbatore
Spoken English Course in Coimbatore
Best Spoken English Coaching Center in Coimbatore
Coimbatore Spoken English Center
English Speaking Course in Coimbatore
Nice post. Thanks for sharing such a worthy information.
ReplyDeleteTOEFL Coaching in Tambaram
TOEFL Training in Chrompet
TOEFL Classes at Tambaram West
Best TOEFL Coaching Institute near omr Chennai
TOEFL Coaching in omr
TOEFL Training in Perungudi
TOEFL Classes near Thoraipakkam
Wonderful blog!!! Thanks for your information… Waiting for your upcoming data.
ReplyDeleteArticle submission sites
Guest posting sites
Thanks for sharing,this blog makes me to learn new thinks.
ReplyDeleteinteresting to read and understand.keep updating it.
devops Course in Anna Nagar
Best devops Training Institute in Anna nagar
devops Certification Training in Anna nagar
devops Training in Ambattur
Nice blog
ReplyDeletedevops course in Marathahalli
best devops training in Marathahalli
Devops certification training in Marathahalli
devops training in Marathahalli
devops training institute in marathahalli
Nice blog..! I really loved reading through this article. Thanks for sharing such an amazing post with us and keep blogging...Well written article Thank You for Sharing with Us pmp training institute in chennai | pmp training class in chennai | pmp training near me | pmp training courses online | pmp training fee |
ReplyDeleteGood Post and thanks for sharing this things with us. Get the Best Selenium Training Institute in Bangalore
ReplyDeletegood work thanks for the post
ReplyDeleteccna training institute chennai
Wonderful Post. Brilliant piece of work. It showcases your in-depth knowledge. Thanks for Sharing.
ReplyDeleteIonic Training in Chennai
Ionic Course in Chennai
Ionic Course
Ionic 2 Training
Ionic 2 Course
Ionic Training in Adyar
Ionic Training in Porur
Great going. Amazing Post. Extra-ordinary work. Thanks for sharing.
ReplyDeleteXamarin Training in Chennai
Xamarin Course in Chennai
Xamarin Classes
Best Xamarin Course
Xamarin Training Institute in Chennai
Xamarin Training Institutes in Chennai
Xamarin Training in Anna Nagar
Xamarin Training in Tnagar
Awesome Post. Great Content. It is very inspiring to read your post. Waiting for your future updates.
ReplyDeleteIoT courses in Chennai
IoT Courses
IoT Training
IoT certification
IoT Training in Porur
IoT Training in Adyar
IoT Training in Anna Nagar
This is very great thinks. It was very comprehensive post and powerful concept. Thanks for your sharing with as. Keep it up...
ReplyDeleteSoftware Testing Training in Chennai | Software Testing Training Institute in Chennai
ReplyDeleteThanks for sharing this information!
I totally agree with you. Your information is very interesting and important. I really like this information.
Our easy web plans company is famous in Advanced AWS Online Training Institutes in Hyderabad.
If you want to see our training venue then click on links:
https://www.futureqtech.com/aws-online-training.php
Call Now: 9581111796
Drop Mail: online@futureqtech.com
Thank you for excellent article.You made an article that is interesting.
ReplyDeleteBest AWS certification training courses. Build your AWS cloud skills with expert instructor- led classes. Live projects, Hands-on training,24/7 support.
https://onlineidealab.com/aws-certification/
Thanks for sharing,you have done a very good job.Keep it up.The content is very interesting and impressive.If you are looking for any online training visit our site.
ReplyDeleteBest Big Data Hadoop Online Training
Very informative post. Thanks for sharing.
ReplyDeleteSAP training in chandigarh
CCNA training in Delhi