42 – Selenium Project Part-3
Selenium Class 42 – Selenium Project Part-3
Selenium Project
1) Project Information
2) Project Description
3) Stake Holders of the Project
4) Interfaces of the Project/AUT
5) Features to be tested in Admin Interface
6) Features to be tested in User Interface
7) Test Requirements, Test scenarios, and Test cases…
8) Derive Sanity Test Scenarios for Admin Interface
9) Derive Sanity Test Scenarios for User Interface
10) Derive Comprehensive (All Possible) Test Scenarios for Admin Interface
11) Derive Comprehensive (All Possible) Test Scenarios for User interface
Selenium Integration with Maven….
Advantages of Maven Integration:
a) Selenium Test Environment Setup
(You can add all required dependencies like Selenium WebDriver, TestNG etc…to Maven Project (POM xml) then it will download and add those jar file to your project)
b) Maintanence of Selenium Test Environment
(If any new version of project dependencies comes then you just add those dependencies to POM XML then it will download add those jar files…)
c) All of your project team members can get same configuration (by using the POM XML)
(Maintain Common Configuration for all Team Members)
………………………………………….
Create Maven Project,
Launch Eclipse IDE
- File Menu
- New
- Project
- Type Maven and Select Maven Project,
- Enter
- Next
- Next
- Enter Group Id
- Enter Artifact Id
- Finish
Then It will create New Maven project
…………………………………………. - Add Dependencies from Internet for your Automated Testing in POM (Project Object Model)
- XML file between “Dependencies” tags (Open and Close tag) and Save Then it will download those dependencies jar files and add to Maven Project
Note: You can edit Dependencies, and share the XML file to your team members, By using this POM XML file, all team members can get same project configuration
Selenium WebDriver-java, TestNG etc…
Create Selenium Test Cases under src/test/java> Java Package>…
Smoke Test Cases for User Interface of gcrShop Application..
i) Launch the user Interface of the Application
ii) Verify Required Elements availability of user Interface Homepage…
iii) Verify Customer Registration with valid data
iv) Verify Customer Login with valid data
v) Add product to Shopping cart
vi) Verify Checkout process
vii) Verify Customer Track order status etc…
1) Launch the User Interface of the Application
Steps:
i) Launch the Browser
ii) Navigate to gcrShop User Interface
Verification Point/s
Capture the Page Title and Compare with expected
Expected:
“GCR Shop” as Page Title
2) Verify “Required Elements” availability of the Home Page
Steps:
i) Launch the Browser
ii) Navigate to gcrShop User Interface Home page
Verification Point/s
Verify the existence of “login” and “create an account” Elements
3) Verify Customer “Registration” with valid data
Steps:
i) Launch the Browser
ii) Navigate to gcrShop User Interface Customer Registration page
iii) Enter all mandatory fields
Verification Point/s:
Capture the Conformation Message and Compare with expected
Expected:
“Your Account Has Been Created!”
4) Verify Customer Login” with valid data
Steps:
i) Launch the Browser
ii) Navigate to gcrShop User Interface Customer Login page
iii) Enter “Email Address”
iv) Enter “Password”
v) Click “Sign In” Button
Verification Point/s:
Check the Existence of “Log Off” Link after Login…
Expected:
“Log Off” Link…
Selenium Automated Test Batch (Using Selenium WebDriver, Java, TestNG, and Maven)
public class User {
public static WebDriver driver;
@BeforeMethod
public void launchBrowser(){
System.setProperty(“webdriver.chrome.driver”, “E:/chromedriver.exe”);
driver =new ChromeDriver();
driver.manage().window().maximize();
}
@Test (priority=1)
public void launchApplication(){
driver.get(“http://www.gcrit.com/build3/”);
Assert.assertEquals(“GCR Shop”, driver.getTitle());
}
@Test (priority=2)
public void verifyElements(){
driver.get(“http://www.gcrit.com/build3/”);
Assert.assertEquals(true, driver.findElement(By.linkText(“login”)).isDisplayed());
Assert.assertEquals(true, driver.findElement(By.linkText(“create an account”)).isDisplayed());
}
@Test(priority=3)
public void customerRegistartion() throws InterruptedException{
driver.get(“http://www.gcrit.com/build3/create_account.php”);
driver.findElement(By.name(“gender”)).click();
driver.findElement(By.name(“firstname”)).sendKeys(“abcdef”);
driver.findElement(By.name(“lastname”)).sendKeys(“xyza”);
driver.findElement(By.name(“dob”)).sendKeys(“10/10/1990”);
driver.findElement(By.name(“email_address”)).sendKeys(“satyajamal123e@gmail.com”);
driver.findElement(By.name(“street_address”)).sendKeys(“abc xyz”);
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(“9876545456”);
driver.findElement(By.name(“password”)).sendKeys(“abcd4321”);
driver.findElement(By.name(“confirmation”)).sendKeys(“abcd4321”);
driver.findElement(By.id(“tdb4”)).click();
Thread.sleep(5000);
Assert.assertEquals(“Your Account Has Been Created!”, driver.findElement(By.tagName(“h1”)).getText());
}
@Test (priority=4)
public void login(){
driver.get(“http://www.gcrit.com/build3/login.php”);
driver.findElement(By.name(“email_address”)).sendKeys(“satyajamal123d@gmail.com”);
driver.findElement(By.name(“password”)).sendKeys(“abcd4321”);
driver.findElement(By.id(“tdb5”)).click();
Assert.assertEquals(true, driver.findElement(By.id(“tdb4”)).isDisplayed());
}
@AfterMethod
public void closeBrowser(){
driver.close();
}
}
………………………………………….