Latest Posts

May 17, 2020

How to take screenshot in Selenium WebDriver.

 

package demopackage;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.*;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class ScreenshotExample {
 public static void main(String[] args) throws IOException {
  System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe");
  WebDriver driver = new ChromeDriver();
  driver.manage().window().maximize();
  driver.get("https://www.facebook.com");
  File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
  FileUtils.copyFile(src,new File("C:\\Work\\screenshot.png"));
 }

}


May 12, 2020

HOW TO HANDLE MULTIPLE WINDOW HANDLES.

 

package demopackage;
import java.util.Iterator;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class WindowsExample {

 public static void main(String[] args) {
  // TODO Auto-generated method stub

  System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe");
  WebDriver driver = new ChromeDriver();
  driver.manage().window().maximize();
  driver.get("https://www.google.com/intl/en-GB/gmail/about/#");
  System.out.println(driver.getTitle());
  driver.findElement(By.xpath("//ul[@class='h-c-header__cta-list header__nav--ltr']//a[contains(@class,'h-c-header__nav-li-link')][contains(text(),'Sign in')]")).click();
  Set  ids = driver.getWindowHandles();
  Iterator it = ids.iterator();
  String parentid = it.next();
  String childid = it.next();

  driver.switchTo().window(childid);
  System.out.println(driver.getTitle());
  driver.switchTo().window(parentid);
  System.out.println(driver.getTitle());
  driver.quit();
 }

}


May 01, 2020

Test Cases for ATM | Positive and Negative Test Cases for ATM




Test Cases on UI of ATM :

1.   Verify that power backup should be present at ATM.
2.   Verify that card reader should be present.
3.   Verify that receipt printer should be present and working.
4.   Verify that cash dispenser is working as expected.
5.   Verify that the key pad should be working and covered.
6.   Verify that buttons are displayed on screen of ATM machine.
7.   Verify the font of text on the screen, it should be clearly visible.

April 30, 2020

How to automate Date Picker on MakeMyTrip website?

package demopackage;

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

public class CalendarExample {

public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub

System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();

driver.get("https://www.makemytrip.com/");

driver.findElement(By.xpath("//span[contains(text(),'DEPARTURE')]")).click();
Thread.sleep(5000);

String flag = "False";

April 30, 2020

Test Cases For Facebook | Timeline | Notification | Messages

Test Cases on User’s Timeline:

Verify that user is able to login using email id and password.
Verify that user timeline is displayed after user login.
Verify that user is able to change profile picture.
Verify that user is able to upload/change cover picture.
Verify that user is able to upload photos from mobile or computer.
Verify that user is able to post text on his/her timeline.
Verify that user is able to post image/video on his/her timeline.

April 30, 2020

Difference between driver.close() and driver.quit()

The difference between close() and quit() function is as follows:

close() function closes the current tab on which the control of web-driver is present. It will not close other tabs of the browse.

quit() function closes the complete browser that is opened by web-driver.


April 30, 2020

Test Cases for Registration Page/Google SignUp Page

Test Cases on Google Registration page:
Positive Test Cases.
Negative Test Cases.

Test Cases on Registration page:
Verify that Create Account link is present or not.
Verify that Create Account link is clickable or not.
Verify that when clicked on Create Account link:
For myself
To manage my business
Verify that when clicked on For myself, Create your Google Account is displayed.
April 30, 2020

Browser Navigation using Selenium WebDriver



package demopackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Class4 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com"); System.out.println("title is : "+driver.getTitle()); driver.navigate().to("https://www.gmail.com"); // for navigation to another url System.out.println("title is : "+driver.getTitle()); driver.navigate().back(); System.out.println("title is : "+driver.getTitle()); driver.navigate().forward(); System.out.println("title is : "+driver.getTitle()); } }


April 30, 2020

Opening Firefox Browser using Selenium WebDriver



package demopackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class DemoFirefox { public static void main(String[] args) { System.setProperty("webdriver.gecko.driver","C:\\Work\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.facebook.com"); System.out.println("test case is passed"); } }


April 30, 2020

Opening Chrome Browser using Selenium WebDriver

package demopackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class DemoClass { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com"); System.out.println("test case passed"); } }


April 30, 2020

Get Title, URL and Source Code of Webpage

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class DemoClass3 { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver",C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com"); System.out.println("Title of webpage is :" +driver.getTitle()); // we fetch title of webpage System.out.println("URL of webpage is : " +driver.getCurrentUrl()); // we fetch url of webpage System.out.println("Source Code of the page is : " +driver.getPageSource()); // fetching source code of webpage System.out.println("test case passed"); } }


April 30, 2020

Regression Testing | Smoke Testing | Sanity Testing | Exploratory Testing | Adhoc Testing

Regression Testing:

  • Regression testing is one of the black box testing techniques. Regression testing is done to validate a code change in application is not impacting the existing functionality of the software.
  • Regression testing is making sure that the software works fine with a new added functionality, defect fix or any other change in software.
March 30, 2020

Types of Non Functional Testing

Types of Non - Functional Testing.
              Performance Testing.
              Usability Testing.
              Compatibility Testing.
               
Performance Testing:

              Performance testing is the most important testing of non-functional testing.
              This testing tells how fast the server can responds to an users request.
              Performance testing of application concentrates on the Response time, Load, and Stability of the software.
              Response time: Response time is the time taken by the server to respond to the client's request.
              Load:  Load means when many number of users are using the software at the same time, then we see that the application behaves correctly.
               Stability: Stability of the software is that when many users are using the application for a particular duration of time.

March 27, 2020

Types of Manual Testing White Box Testing Black Box Testing.


White Box Testing Black Box Testing.


White box testing is also known as glass box, clear box, transparent box testing. 

White box testing tests the internal code and infrastructure of an application to focus on checking of previously defined inputs for expected or desired outputs. This testing is based on internal working of an application or software. It revolves around internal coding testing.

In white box testing, coding skills are required for designing the test cases. The primary objective of white box testing is to focus on the flow of the software. The inputs and output flow through the application and security of the software are the main objectives of white box testing.

May 09, 2018

Principles of Testing

Principles of Testing:

There are seven principles of software testing which are as follows:

Testing shows presence of defects

An effective testing can show the defects that are present in software, but it cannot prove that the software is defect free. Even after testing the application or software thoroughly we can’t say that the software is defect free. An effective testing always reduce the number of defects remaining in the software but even if no defect is found in testing, it doesn’t prove that software is defect free.

Exhaustive testing is impossible:

April 13, 2018

Severity and Priority of Defects.

Severity and Priority of Defects.


There are two important things related to defects of software testing :
  • Severity
  • Priority

Severity:


Severity is the extent to which the defect can affect the software or application. Severity defines the impact of defect on the system or software. Example: When user clicks on a remote link and the page of application crashes. Being it the remote link on the application the Priority of the defect will be low however the severity will be high.


April 12, 2018

Defect Life Cycle in Software Testing.

Defect Life Cycle in Software Testing.

Defect or bug life cycle is a cycle through which a defect goes in its lifetime. Defect life cycle starts when defect is found and it ends when the defect is closed.

The life cycle of defect can be shown below using flow diagram:


Defect Life Cycle
Defect life cycle contains following status of defect: