|
I used junit and data driven.
Though, all this can't be explained here itself, I will provide some brief description
Mostly used annotations are @Test, @After and @Ignore.
Please refer to web.
We need to attach Junit jar file and import all classes.
We have to have driver script from which we call all other Page related classes (Page Objects). In this page related classes we should have page related functions.
From XLS or flat file, the test data should be fetched and stored into some variables / arrays.
Based on some logic that specific page related object should be created / or those static methods should be called.
E.g.:
For, Login Page, I have 3 fields to interact with.
So, I have a class, and one method to do the login task.
---------------------
public class Login{
public loginfunction(String testdata)
throws Exception
{
driver.findElement(By.id("UserName")).sendKeys(testdata);
//after entering the data, the fail or pass result maybe written to flat file / XLS
av.writePOI(passflag,pagename,fnamearr[rc],fnamearr[rc+1],excelrc,"c:\\resultsall.xls",passdescription)
break;
}
}
----------------- code ends here
I create Login class's object like this:
Login loginobj = new Login()
I call the method to enter test data in the user name field. In the testdata variable, the value ="Michael"
loginobj.loginfunction(testdata)
So, the test data will be entered using the method above.
Data driven works like this.
|