0% found this document useful (0 votes)
44 views8 pages

CustomerRegistration - TestNG

The document describes testing a web application using Selenium with TestNG. It provides a template code to test registration of users on a sample application by reading test data from an Excel sheet and validating the success message. The tasks include setting up the webdriver, reading test data using data provider annotation, entering user details by passing parameters and verifying the results.

Uploaded by

akfelix257
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views8 pages

CustomerRegistration - TestNG

The document describes testing a web application using Selenium with TestNG. It provides a template code to test registration of users on a sample application by reading test data from an Excel sheet and validating the success message. The tasks include setting up the webdriver, reading test data using data provider annotation, entering user details by passing parameters and verifying the results.

Uploaded by

akfelix257
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

CustomerRegistration – TestNG

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 test a web application with Selenium for basic activities. The basic selenium
concepts like Web Driver, Web Elements, Locators, Apache POI, Excel Inputs,
TestNG & Table Grid are covered.

Problem Description:

An application has been designed to collect the below details of the user for address
book:

Name, Mobile, DOB, Gender, Address & Register.

Upon adding the valid details, the data appears in next page in a tabular format in
the same page with Registered successfully message

Extract the Success message & display in console output

Please refer below link for Application under test

https://webapps.tekstac.com/CustomerRegistration_4284/

Test Scenario:

S.NO Actions to be performed Expected Result


1 Launch the application Application is launched
2 Enter the following data The submitted details should
be displayed in tabular
format.
Name : Bendict

Mobile: 34

DOB: chennai

Gender: Male

Address: [email protected]

Click the Register button


3 Extract the data displayed in table The extracted success
with success message& message data is displayed in
print them console output

Validation rules:

· Enter valid data for all fields.

· Extract the data using data provider

· Pass the data to Web elements using data provider

· Extract the entered data from table

· Use of Before Method, Test with priority, Data Provider & After Method
annotations

Following are the java classes that contains code snippets.

Create driver (complete implementation is given for


DriverSetup.java
you)
Test the page for valid scenario (that is, all form data
DataPro.java
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 ‘getWebDriver’ to create a driver wherever required.

b) DO NOT CHANGE THIS CLASS

2. class ‘DataPro’ in DataPro.java

a) This class is used to read the data using data provider annotation

Hint : Do NOT remove the existing code.

Fill the following methods in Main.java with required code

Method Name Description


WebDriver createDriver() Method to invoke the driver
Get the excel file path (note: the excel is located
under the directory)

Using the ‘sheetName’ passed to this method,


read the data and store it in a string array.

public Object[][] Return the array.


usersData()

Apply the required annotation with its essential


attributes for inputs & preference of execution

Use the DataProvider name as ‘Users’


void testUser (String Locate the Web Element corresponding to
Cname,String ‘Name’,’Mobile’, Dob, Address (TextField) by Id.
Mobile,String Dob,String
Address) Pass the ‘cname’, ’Mobile’, ’Dob’ and ’Address’ as
a parameter to this method

Choose the gender (radio button).

Use the sendKeys() method to fill the input


box with data from parameter which extracted
from data provider. Locate the Result Message
text in webpage using id.

Extract the message, store in a static string


variable ‘result’ & display in console output.

Apply the required annotation with its essential


attributes for inputs & preference of execution

Use the dataProvider name as ‘Users’


This method should close the driver
void closeBrowser()
Apply the required annotation with its essential
attributes for inputs & preference of execution

3. TestNG file named testng.xml is already available in template code.

Do NOT remove the existing code.

- Specify the name of the class to be tested in the file

Below is the data from excel sheet. Sheet Name is 'customer_details'

You might also like