You are on page 1of 9

LaptopDetails New - ApachePOI

Instruction: 

Please start working on the template code provided in the Tekstac platform.
Template code will provide the base template or format in which the end solution is
expected from you. Template code is not an executable code and will help you add
code on top of it to ensure you make your submissions in the right format.

Note: You are free to directly implement the code in the Tekstac code editor.

The Case Study starts here....

Objective:

To understand the basic concepts of POM and Excel Apache POI by passing the
excel data to the field in the application 

Problem Description:

An application has been designed to collect the below details of the laptop.

Product Id, Product name, Product description, Product model, Product price.

Upon submitting the valid details for laptop, the product displayed below

Please refer below link for Application under test

https://webapps.tekstac.com/LaptopDetails/

Test Scenario:

S.NO Actions to be performed              Expected Result

1 Launch the application    Application is launched

2 Navigate to Add Product Add Product form get


displayed

3 Enter the following data Product will get displayed


below

Product Id : 1001

Product Name : Apple MacBook Air

Product Description: 13-inch, 8GB RAM, 128GB


Storage, 1.8GHz Intel Core i5 - Silver

Product Model: MQD32HN

Product Price: 77200

Validation rules:

· Enter valid data for all fields.

· All the field are mandatory

Following are the java classes that contains code snippets.

Create driver (complete implementation is given


DriverSetup.java
for you)

Create the required methods for valid scenario


LaptopDetails.java
using POM (Page object Model)

Create readExcelData(String sheetName) to read


ExcelUtils.java
the test data from excel

Call the excel method to launch the application

Pass the excel data to the input fields


TestLaptopDetails.java
Retrieve the submitted data and print in the
console

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 ‘getWebDriver’ to create a driver wherever required.

b)   DO NOT CHANGE THIS CLASS

2. Class named  LaptopDetails.java is already available in template code.

Hint : Do NOT remove the existing code.

Fill the following methods in  LaptopDetails.java  with required code

Method Name Description

Locate the dropdown named “Products”


public void NavigatetoAddProduct()
and select Add Product.

Locate the Web Element corresponding to


the product id (TextField) using specific
locators.
public void setProductID(String prodID)
Use the sendKeys() method and fill the
input box with 'prodID'

Locate the Web Element corresponding to


the product name (TextField) using
public void setProductName(String specific locators.
prodName)
Use the sendKeys() method and fill the
input box with 'prodName'

Locate the Web Element corresponding to


the product description (TextField) using
public void setProductDesc(String specific locators.
prodDesc)
Use the sendKeys() method and fill the
input box with 'prodDesc'

Locate the Web Element corresponding to


the product model (TextField) using
public void setProductModel(String specific locators.
prodModel)
Use the sendKeys() method and fill the
input box with 'prodModel'

public void setProductPrice(String Locate the Web Element corresponding to


prodPrice) the product price (TextField) using
specific locators.

Use the sendKeys() method and fill the


input box with 'prodPrice'

public void  SubmitForm() Locate the web element corresponding to


the add product and click it to submit the
                        form

  3. TestLaptopDetails.java

public void  setup() Create the driver using method 'getDriver' in


class DriverSetup.

Assign it to the variable 'driver'

public static Call the method 'readExcelData' in class


String[] getExcelData() 'ExcelUtils' using sheet name 'laptops'

public void testAddLaptopDetails() call the method getExcelData() and store the
excel data in an array

call the method required in class 'LaptopDetails'


and pass the excel data

Submit the form

public void  closeBrowser() close the browser

main() Call the method setUp()

Call the method NavigatetoAddProduct()

Call the method testAddLaptopDetails()

Call the method closeBrowser()

4. ExcelUtils.java

public static String[] readExcelData(String sheetName)

--> Parse the excel sheet. 


--> Sheet name is 'laptops'. Read and store the data in an array. Return the array.
[{"isNetworkAvailable":false,"netWorkType":"wifi","wifiRssi":-
64,"wifiSignalLevel":3,"ip":"192.168.1.4","ver":"2.5.1.6","mod":"Mi
A3","os":"30","isp":"40440","cou":"IN","slan":"en_US","brd":"Xiaomi","pf":"android
","verc":"20501006","net":"no_net","aid":"8867c73bcc956e83","cha":"google-
play","did":"3e06a5d9-7b4a-4842-8862-4d19d808b9af"},{"url":"http:\/\/a6.o-
hentai.com\/pool\/pub\/51\/77\/00\/
f06327c2d6f4d1c340d8d55df0517700\/594479125","requestExtHeader":"null","err
or":"com.quantum.dl.exception.DownloadHttpException: Unable to connect to
http:\/\/a6.o-hentai.com\/pool\/pub\/51\/77\/00\/f06327c2d6f4d1c340d8d55df051
7700\/594479125"},{"url":"http:\/\/127.0.0.1:41639\/xdownload\/
eyJ1cmwiOiJodHRwOi8vYTYuby1oZW50YWkuY29tL3Bvb2wvcHViLzUxLzc3LzAwL2Yw
NjMyN2MyZDZmNGQxYzM0MGQ4ZDU1ZGYwNTE3NzAwLzU5NDQ3OTEyNSJ9","requ
estExtHeader":"null","error":"com.quantum.dl.exception.DownloadHttpException:
Unable to connect to
http:\/\/127.0.0.1:41639\/xdownload\/eyJ1cmwiOiJodHRwOi8vYTYuby1oZW50YWk
uY29tL3Bvb2wvcHViLzUxLzc3LzAwL2YwNjMyN2MyZDZmNGQxYzM0MGQ4ZDU1ZGY
wNTE3NzAwLzU5NDQ3OTEyNSJ9"},{"url":"http:\/\/127.0.0.1:41639\/xdownload\/
test","requestExtHeader":"null","error":"com.quantum.dl.exception.DownloadHttpE
xception: Unable to connect to http:\/\/127.0.0.1:41639\/xdownload\/test"},
{"address":"a6.o-
hentai.com","status":200,"ttl":0,"transmitted":0,"receive":0,"lossRate":"0.0%","rtt
Min":"0.0ms","rttAvg":"0.0ms","rttMax":"0.0ms","rttMDev":"0.0ms","allTime":"0ms
","originOutput":""},
{"address":"youtube.com","status":200,"ttl":0,"transmitted":0,"receive":0,"lossRat
e":"0.0%","rttMin":"0.0ms","rttAvg":"0.0ms","rttMax":"0.0ms","rttMDev":"0.0ms","
allTime":"0ms","originOutput":""},
{"127.0.0.1":"host=127.0.0.1,port=41639,running=true,error=null"}]

You might also like