Functional Test Automation using Selenium
 
I) Project Info:
Domain: Ecommerce
Sub-Domain: B2C (Business to Customer)
Application: Online Shopping
Type of the Application: Public spider web Application
Application Environment: LAMP (Linux, Apache, MySQL, PHP)
Project Description: Online shopping portal, Vendors sell their products through this spider web portal, together with Customers buy 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 live tested inward 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 live Tested inward Client side Interface
i) Customer Registration
ii) Customer Login
iii) Buy products etc...
----------------------------
II) Pre-requisites to exercise Automated Test cases
i) Test Requirement
Ex: Verify Gmail Login
--------------------------
ii) Test Steps / Navigation
Ex:
1) Launch the Browser together with 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 together with navigate to www.gcrit.com/build3/admin/
b) Enter User Name
c) Enter Password
d) Click Login Button
--------------------------
Verification Point:
Check the being of Logoff Link, if exists together with then transcend otherwise fail.
Example:
public static void main(String[] args) throws InterruptedException {
WebDriver driver = novel 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 together with navigate to www.gcrit.com/build3/
b) Click "create an account" link
c) Enter client details
d) Click "Continue" button
------------------------------
Verification point:
Capture confirmation message together with compare alongside expected.
Example:
WebDriver driver = novel 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 = novel 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 together with navigate to www.gcrit.com/build3/
b) Click "login" link
c) Enter Email Address
d) Enter Password
e) Click SignIn Button
------------------------------------------------
Example:
WebDriver driver = novel 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 second = 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");
}
--------------------------------------------------------
 I) Project Info:
Domain: Ecommerce
Sub-Domain: B2C (Business to Customer)
Application: Online Shopping
Type of the Application: Public spider web Application
Application Environment: LAMP (Linux, Apache, MySQL, PHP)
Project Description: Online shopping portal, Vendors sell their products through this spider web portal, together with Customers buy 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 live tested inward 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 live Tested inward Client side Interface
i) Customer Registration
ii) Customer Login
iii) Buy products etc...
----------------------------
II) Pre-requisites to exercise Automated Test cases
i) Test Requirement
Ex: Verify Gmail Login
--------------------------
ii) Test Steps / Navigation
Ex:
1) Launch the Browser together with 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 together with navigate to www.gcrit.com/build3/admin/
b) Enter User Name
c) Enter Password
d) Click Login Button
--------------------------
Verification Point:
Check the being of Logoff Link, if exists together with then transcend otherwise fail.
Example:
public static void main(String[] args) throws InterruptedException {
WebDriver driver = novel 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 together with navigate to www.gcrit.com/build3/
b) Click "create an account" link
c) Enter client details
d) Click "Continue" button
------------------------------
Verification point:
Capture confirmation message together with compare alongside expected.
Example:
WebDriver driver = novel 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 = novel 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 together with navigate to www.gcrit.com/build3/
b) Click "login" link
c) Enter Email Address
d) Enter Password
e) Click SignIn Button
------------------------------------------------
Example:
WebDriver driver = novel 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 second = 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");
}
--------------------------------------------------------