Automating a Manual Test Case


Automating a Manual Test Case...

1) Create a Manual Test Case
2) Automate the Manual Test Case using Selenium
3) Exception Handling for Selenium Test Case
------------------------------
1) Create a Manual Test Case

I am taking a Manual Test Case, that is Generic Test Case, 
"Verify Gmail Link existence in Google Home Page"

Sample Test Case Template (Manual Test Case):

i) Test Case Id: 
ii) Test Case Title: 
iii) Precondition: 
iv) Test Steps: 
v) Test Data: 
vi) Expected Result: 
vii) Post-condition: 
viii) Actual Results: 
ix) Status: 
x) Comments: 
------------------------------
Test Case Document...

i) Test Case Id: TC_001
ii) Test Case Title: Verify "Gmail" Link beingness inwards Google Home page
iii) Precondition: NA
iv) Test Case Step/s: 
                     i) Launch the Browser together with Navigate to www.google.com             
v) Test Data: NA
vi) Expected Result: Gmail Link volition live on available inwards Google Home Page
vii) Post-Condition: Google Home Page alongside Gmail Link, together with Other Links...
viii) Actual Results: (* During Test Case Execution)
ix) Status: (* After Test Case Execution)
x) Comments: 
---------------------------------------------
Note: We tin sack choose existing Manual Test Cases for Automation, or nosotros tin sack withdraw write automated Test Cases using Test Scenarios.

we tin sack start the Test Automation procedure at beginning of the Project or middle of the Project (only for Regression Testing), or terminate of the Testing (for Maintenance Testing) based on the Project together with the Company.
---------------------------------------------
 Automate the Manual Test Case using Selenium Automating a Manual Test Case
2) Automating the Manual Test Case using Selenium WebDriver

> Using Element Locators together with WebDriver methods nosotros work Test Steps, together with piece of work Java programming Statements to heighten the Test case.

Steps:

i) First Create Instantiate Browser Driver (Mozilla Firefox or chrome or IE etc..)

ii) Create the Browser driver

iii) Generate the Test Steps using Element Locators together with WebDriver Commands.

iv) Enhance the Test Case using Java programming Statements.

Selenium Test Case / Test Script

package abcde;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public bird Class1 {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
WebDriver driver = novel ChromeDriver();
driver.get("https://www.google.com");
boolean LinkStatus =driver.findElement(By.linkText("Gmail")).isDisplayed();

if (LinkStatus=true){
System.out.println("Gmail Link is Exists inwards Google Homepage - Passed");
}
else
{
System.out.println("Gmail Link is Not Exits inwards Google Homepage -Failed");
}
driver.close();
}
}
---------------------------------------------
Note: Whenever nosotros depository fiscal establishment gibe an Element beingness inwards spider web pages, if the Element is exists thus It volition exhibit "Pass", if the Element is non exists thus it volition exhibit Error / NoSuchelement exception instead of showing "Fail" status, thus nosotros require to render "NoSuchElement" exception thus nosotros tin sack larn electrical flow consequence (If the Element is exists or not). 
---------------------------------------------
Selenium Test Case alongside Exception Handling

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
WebDriver driver = novel ChromeDriver();
driver.get("https://www.google.com");

try
{
boolean LinkStatus =driver.findElement(By.linkText("Gmail")).isDisplayed();

if (LinkStatus=true){
System.out.println("Gmail Link is Exists inwards Google Homepage - Passed");
}
}
catch (NoSuchElementException e){
System.out.println("Gmail Link is Not Exists inwards Google Homepage -Failed");
}
driver.close();
}
-------------------------------------------------------------------------------------------------
Note: Exception Handling is mandatory for around Selenium Test Cases only, non for all Selenium Test Cases.

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post