Here we are going to learn how to create a data driven framework in selenium.
Problem definition : gmail log in page testing.
Project Creation and setup:
Step 1. Download Maven2.
Step 2. Unzip the zip file we have downloaded above.
Step 3. Set MAVEN_HOME path.
-> go to System Properties and click on Environment variables.
-> Click on "New" Under System Variables.
-> Enter Variable name as "MAVEN_HOME" and Variable Value as "Path of maven folder" and click on ok
-> edit the path variable and append ;%MAVEN_HOME%\bin
-> click ok.
Step 4. open command prompt.
Step 5. test whether path has set properly by below command.
Step 6. run below command to create a maven project.
"mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.gmail.test -DartifactId=gmailTest"
after this a project folder named gmailTest will be created.
Step 1. Open eclipse.
Step 2. Import the project we have created above.
Step 3. Create below 3 files.
Step 4.Create Excel data file.
In the above Excel file we have below three column.
a. Key : this column contains key word through which we can search locator.
b. Properties : this column contains attribute of HTML Element through which selenium will find the element.
c. Value : this column contains value of attribute.
Step 5. place the excel file under resource folder of project.
Step 6. LoginPage.java
Step 7. Gmail.java