PARAMETERIZATION IN SELENIUM, Concept used to build Data Driven - TopicsExpress



          

PARAMETERIZATION IN SELENIUM, Concept used to build Data Driven Framework =========================================================== Testing World:: 8743913121,8826257355 ============================= Dataprovider Annotation in TestNG Dataprovider annotation is mainly used for parameterization in Test Cases We have a define a method under the data provide annotation, here we pass test data Data provider method return of 2 dimension object array We can pass this data returned by data provider in our test cases, function will execute in loop for each row of returned 2 dimension array Here is the example package org.abc; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class Case1 { @Test(dataProvider="Dp1") public void TCase(String uname, String pass) { System.setProperty("webdriver.chrome.driver","C:\Documents and Settings\Administrator\My Documents\Downloads\chromedriver_win32_2.1\chromedriver.exe"); ChromeDriver f = new ChromeDriver(); f.get("mail.in"); f.findElementById("f_id").sendKeys(uname); f.findElementById("f_pwd").sendKeys(pass); f.findElementByClassName("signin"); } @DataProvider(name="Dp1") public Object[][] DataRe() { Object arr[][]={{"unam1","pass1"}, {"uname2","pass2"}, {"uname3","pass3"}}; return(arr); } }
Posted on: Thu, 12 Sep 2013 08:59:15 +0000

Trending Topics



Recently Viewed Topics




© 2015