Customer Registration Apache poi
CustomerRegistration - ApachePOI
Objective:
To test a web application with Selenium for basic activities. The basic selenium
concepts like Web Driver, Web Elements, Locators, Apache POI, Excel Inputs &
Table Grid are covered.
Problem Description:
An application has been designed to collect the below details of the user for address
book:
Name, Age, Address, Phone Number, Email& Submit.
Upon adding the valid details, the data appears in the next page with success
message in a table.
Extract the data from table & display in console output
Please refer below link for Application under test
https://webapps.tekstac.com/CustomerRegistration/
Test Scenario:
S.NO Actions to be performed Expected Result
1 Launch the application Application is launched
2
Enter the following data
Name : Bendict
Age: 34
Addres: chennai
Phone Number: 1231231233
Email: bendict@gmail.com
Click the Submit button
The submitted details should be
displayed in tabular format.
3 Extract the data displayed in
table & print them
The extracted data is displayed
in console output
Validation rules:
· Enter valid data for all fields.
· Extract the entered data from table
Following are the java classes that contains code snippets.
DriverSetup.java Create driver (complete implementation is given for you)
ReadExcelData.java Read the data from excel file
TestForm.java Test the page for valid scenario (that is, all form data are
valid)
Procedure to complete the case study
1. class DriverSetup is completely implemented for your reference. This class is
configured to test using Firefox browser and Firefox driver.
a) Use the method ‘createDriver’ to create a driver wherever required.
b) DO NOT CHANGE THIS CLASS
2. class ‘ReadExcelData’ in ReadExcelData.java
a) This class is used to read the ‘Cust_Details.xlsx’ excel.
b) Fill the given method with required code
Method Name Description
String[] readExcelData(String
fileName)
Get the excel file path (note: the excel is
located in the same path of other java
files)
Using the 'customerdetails' sheetName ,
read the data and store it in a string
array.
Return the array. Only one row in the excel
sheet so keep 'row' as 0.
Store only the column value in the array.
Example array declaration :
String[] customerData= new String[5];
3. Class named TestForm is already available in template code.
Hint : Do NOT remove the existing code.
Fill the following methods in TestForm.java with required code
Method Name Description
WebDriver createDriver() Method to invoke the driver
void ReadExcel() Method to invoke the ReadExcelData
class
void setName(String cname)
Locate the Web Element corresponding
to ‘Name’ (TextField) by name.
Use the sendKeys() method to fill the
input box with array data passed as
parameter
void setAge(String cAge)
Locate the Web Element corresponding
to ‘Age’ (TextField) by name.
Use the sendKeys() method to fill the
input box with array data passed as
parameter
void setAddress(String cAddress)
Locate the Web Element corresponding
to ‘Address’ (TextField) by name.
Use the sendKeys() method to fill the
input box with array data passed as
parameter
void setPhone(String
cPhone)
Locate the Web Element corresponding
to ‘Phone’ (TextField) by name.
Use the sendKeys() method to fill the
input box with array data passed as
parameter.
void setEmail(String cEmail)
Locate the Web Element corresponding
to ‘Email’ (TextField) by name.
Use the sendKeys() method to fill the
input box with array data passed as
parameter
String getTableData()
Locate the Web Element corresponding
to the table after submit. Get the entire
submitted customer data and return it.
void submit()
Locate the Web Element corresponding
to the ‘Submit’ (Button) using id.
Click the ‘Submit’ button to submit the
form.
void closeBrowser() This method should close the driver
main()
Invoke all the above methods.
Declare the string array ‘data’
Call the method readExcelData & store in
the array
Call the method setName() with
its respective data from array passed as
parameter.
Call the method setAge() with its
respective data from array passed as
parameter.
Call the method setAddress() with its
respective data from array passed as
parameter.
Call the method setPhone() with its
respective data from array passed as
parameter.
Call the method setEmail() with its
respective data from array passed as
parameter.
Call the method submit() with its
respective data from array passed as
parameter.
Solution:
Comments
Post a Comment