Selenium Project


Functional Test Automation using Selenium

I) Project Info:
Domain: Ecommerce

Sub-Domain: B2C (Business to Customer)

Application: Online Shopping

Type of the Application: Public web Application

Application Environment: LAMP (Linux, Apache, MySQL, PHP)

Project Description: Online shopping portal, Vendors sell their products through this web portal, and Customers purchase products.

Stake holder of the project
i) Portal developer

ii) Vendors /Manufacturers

iii) Customers

iv) Payment Gateway service providers etc...
----------------------------
Application Interfaces:
i) Admin Interface / Server side Interface

ii) User Interface / Client side Interface
------------------------------------------
i) Admin Interface / Server side Interface

URL:
------------------------------
www.gcrit.com/build3/

www.gcrit.com -Web domain
build3 -folder

-----------------
http://english.tupaki.com/
-----------------------

www.tupaki.com -Web domain

english-Sub domain
----------------------------
www.gcrit.com/build3/admin/

User name: admin

password: admin@123

Features to be tested in admin Interface:
-------------------------------------
i) Admin Login

ii) Create /Edit /Delete Manufacturers

iii) Create /Edit /Delete Products

iv) Create /Edit /Delete Currencies

v) Product Report

vi) Customer Report etc...
----------------------------------
II) User Interface/Client side Interface

URL:

www.gcrit.com/build3

Features to be Tested in Client side Interface

i) Customer Registration

ii) Customer Login

iii) Buy products etc...
----------------------------
II) Pre-requisites to create Automated Test cases
i) Test Requirement

Ex: Verify Gmail Login
--------------------------
ii) Test Steps / Navigation

Ex:

1) Launch the Browser and navigate to www.gmail.com.

2) Enter Email

3) Click next

4) Enter password

5) Click Sign In
---------------------------
iii) Verification point/s

Ex: Check the existance of User gmail page.

iv) Input Data

ex:

Email: gcrindia

Password: abcd123
----------------------------------
v) Error Handling

Close the Browser
-------------------------
vi) Add Comments
-----------------------------
III) Selenium Test Cases
1) Admin Login
Steps:

a) Launch the Browser and navigate to www.gcrit.com/build3/admin/

b) Enter User Name

c) Enter Password

d) Click Login Button
--------------------------
Verification Point:

Check the existence of Logoff Link, if exists then pass otherwise fail.

Example:

public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.gcrit.com/build3/admin/");
driver.findElement(By.name("username")).sendKeys("admin");
driver.findElement(By.name("password")).sendKeys("admin@123");
driver.findElement(By.id("tdb1")).click();
   
if (driver.findElement(By.linkText("Logoff")).isDisplayed()){
System.out.println("Login Successful");
}
else{
System.out.println("Login Failed");
}
}
}
--------------------------------------------------
Assignment:

Write exception for failed scenario
------------------------------------------------
2) Customer Registration
Steps:

a) Launch the Browser and navigate to www.gcrit.com/build3/

b) Click "create an account" link

c) Enter customer details

d) Click "Continue" button
------------------------------
Verification point:

Capture confirmation message and compare with expected.

Example:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.gcrit.com/build3/");
driver.findElement(By.linkText("create an account")).click();
driver.findElement(By.name("gender")).click();
driver.findElement(By.name("firstname")).sendKeys("Abcdef");
driver.findElement(By.name("lastname")).sendKeys("xyz asd");
driver.findElement(By.id("dob")).sendKeys("10/10/1990");
driver.findElement(By.name("email_address")).sendKeys("abcd321xyz1a@gmail.com");

driver.findElement(By.name("street_address")).sendKeys("abcd asdf");
driver.findElement(By.name("postcode")).sendKeys("12345");
driver.findElement(By.name("city")).sendKeys("Hyderabad");
driver.findElement(By.name("state")).sendKeys("Telangana");
   
Select dropDown = new Select(driver.findElement(By.name("country")));
dropDown.selectByVisibleText("India");

driver.findElement(By.name("telephone")).sendKeys("9876567876");
driver.findElement(By.name("newsletter")).click();
driver.findElement(By.name("password")).sendKeys("abcd123");
driver.findElement(By.name("confirmation")).sendKeys("abcd123");
driver.findElement(By.id("tdb4")).click();
   
String confirmationMessage = driver.findElement(By.xpath(".//*[@id='bodyContent']/h1")).getText();

if (confirmationMessage.equals("Your Account Has Been Created!")){
System.out.println("Customer Registration Successful");
}
else {
System.out.println("Customer Registration Failed");   
}
--------------------------------------------------
3) Customer Login
Steps:

a) Launch the Browser and navigate to www.gcrit.com/build3/

b) Click "login" link

c) Enter Email Address

d) Enter Password

e) Click SignIn Button
------------------------------------------------
Example:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.gcrit.com/build3/");
driver.findElement(By.linkText("login")).click();
driver.findElement(By.name("email_address")).sendKeys("abcd321xyz1a@gmail.com");
driver.findElement(By.name("password")).sendKeys("abcd123");
driver.findElement(By.id("tdb5")).click();
   
String s = driver.findElement(By.xpath(".//*[@id='tdb4']/span")).getText();
//System.out.println(s);
if (s.contains("Log Off")){
System.out.println("Login Successful");
}
else {
System.out.println("Login Failed");
}
--------------------------------------------------------

0 comments:

Post a Comment