Functional Testing
- Unit Testing - writing tests for 1 small part of the application or testing 1 method/class. They can be easily automated and easily run through a continuous integration server
- White Box Testing - Internal code structure of an app is visible to the tester; easier to find loop holes and faults
- Gorilla Testing - Thorough testing of the module/application
- Integration Testing - Groups of modules are grouped together and tested as a whole to see if they work correctly together
- Grey Box Testing - Testers have partial knowledge of the internal structure or code of an application
- System Testing - Tester evaluates the whole system for some specified requirements
- End to End Testing - Replicates user behavior in a prod environment. It performs things like: loading a web page, logging in or more complex scenarios verifying email notifications, online payments ...
- Black Box Testing - Testing is performed without the knowledge of the internal code structure
- Smoke Testing - Performs basic checks and critical functionality of the system/app.
- Sanity Testing - Checks if newly added feature or bug fix works correctly
- Happy Path Testing - Tests with only correct inputs (ie: no wrong passwords)
- Monkey / Ad-Hoc Testing - Test with random/incorrect input values (ie: as if a monkey is using the app)
- Acceptance Testing / UAT (User Acceptance Testing) - Tests performed to check if business requirements are met w/ real-time business scenarios
- Alpha Testing - The UAT team finds as much defects of the app before releasing to client
- Beta Testing - Testing done by the client side before releasing it to the market
Non-Functional Testing
- Security Testing
- Penetration Testing - Perform authorized cyber attacks / ethical hacking
- Performance Testing - Ability to handle high traffic to site; checks for stability and response time; scalability; volume; endurance (long-lasting)
- Usability Testing - Exploratory (ability to explore from one page to another); Cross browser testing; Accessibility Testing (for disability)
- Recovery Testing - How well the application recovers after a crash
- Regression testing - tests unchanged features of the application just so that any bug fixes or adding new features does not impact the working application
- Stress Testing - Testing with unfavorable conditions: maximum users; maximum memory usage ...
Selenium
It is a portable automated software testing tool for testing web applications
Selenium Tools
WebDriver
TestNG
Scripting Using WebDriver
Selenium Tools
- - Selenium IDE: a Firefox plugin that lets testers to record their actions as they follow the workflow that they need to test
- - Selenium WebDriver: Sends commands directly to browser and retrieves the results
- Download and Install Java
Download and Configure Eclipse
Configure FireBug and FirePath
Configure Selenium WebDriver
- Download and Install Java
- - Selenium Grid: Helps run parallel tests across different machines and different browsers simultaneously
WebDriver
- Selenium Test (Java, C#, Ruby, Python ...) <=> Selenium WebDriver <=> Web Browser <=> Web Application
TestNG
- TestNG can be installed in eclipse. - It helps run test scripts in parallel.
Scripting Using WebDriver
- 1) Launch "Eclipse" from the Extracted Eclipse folder
- 2) Select the Workspace by clicking the 'Browse' button
- 3) Now create a 'New Project' from 'File' menu
- 4) Enter the Project Name and Click 'Next'
- 5) Go to Libraries Tab and select all the JAR's Selenium WebDriver Library folder and also selenium-java-2.42.2.jar and selenium-java-2.42.2-srcs.jar
- 6) Package gets created
- 7) Now right-click on the package and select 'New' >> 'Class' to create a 'class'
- 8) Now name the class and make it the main function
- 9) The output of the below script would be printed in Console
SELEnium WebDriver script Example
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class webdriverdemo {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
//Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//Launch website
driver.navigate().to("http://www.calculator.net/");
//Maximize the browser
driver.manage().window().maximize();
// Click on Math Calculators - google how to find xpath
driver.findElement(By.xpath(".//*[@id = 'menu']/div[3]/a")).click();
// Click on Percent Calculators
driver.findElement(By.xpath(".//*[@id = 'menu']/div[4]/div[3]/a")).click();
// Enter value 10 in the first number of the percent Calculator
driver.findElement(By.id("cpar1")).sendKeys("10");
// Enter value 50 in the second number of the percent Calculator
driver.findElement(By.id("cpar2")).sendKeys("50");
// Click Calculate Button
driver.findElement(By.xpath(".//*[@id = 'content']/table/tbody/tr[2]/td/input[2]")).click();
// Get the Result Text based on its xpath
String result =
driver.findElement(By.xpath(".//*[@id = 'content']/p[2]/font/b")).getText();
// Print a Log In message to the screen
System.out.println(" The Result is " + result);
//Close the Browser.
driver.close();
}
}
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class webdriverdemo {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
//Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//Launch website
driver.navigate().to("http://www.calculator.net/");
//Maximize the browser
driver.manage().window().maximize();
// Click on Math Calculators - google how to find xpath
driver.findElement(By.xpath(".//*[@id = 'menu']/div[3]/a")).click();
// Click on Percent Calculators
driver.findElement(By.xpath(".//*[@id = 'menu']/div[4]/div[3]/a")).click();
// Enter value 10 in the first number of the percent Calculator
driver.findElement(By.id("cpar1")).sendKeys("10");
// Enter value 50 in the second number of the percent Calculator
driver.findElement(By.id("cpar2")).sendKeys("50");
// Click Calculate Button
driver.findElement(By.xpath(".//*[@id = 'content']/table/tbody/tr[2]/td/input[2]")).click();
// Get the Result Text based on its xpath
String result =
driver.findElement(By.xpath(".//*[@id = 'content']/p[2]/font/b")).getText();
// Print a Log In message to the screen
System.out.println(" The Result is " + result);
//Close the Browser.
driver.close();
}
}
SELENIUM WEBDRIVER SCRIPT EXAMPLE (With TEstng)
package TestNG;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TestNGClass {
WebDriver driver = new FirefoxDriver();
@BeforeTest
public void launchapp() {
// Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Launch website
driver.navigate().to("http://www.calculator.net");
driver.manage().window().maximize();
}
@Test
public void calculatepercent() {
// Click on Math Calculators
driver.findElement(By.xpath(".//*[@id='menu']/div[3]/a")).click();
// Click on Percent Calculators
driver.findElement(By.xpath(".//*[@id='menu']/div[4]/div[3]/a")).click();
// Enter value 10 in the first number of the percent Calculator
driver.findElement(By.id("cpar1")).sendKeys("10");
// Enter value 50 in the second number of the percent Calculator
driver.findElement(By.id("cpar2")).sendKeys("50");
// Click Calculate Button
driver.findElement(By.xpath(".//*[@id='content']/table/tbody/tr/td[2]/input")).click();
// Get the Result Text based on its xpath
String result =
driver.findElement(By.xpath(".//*[@id='content']/p[2]/span/font/b")).getText();
// Print a Log In message to the screen
System.out.println(" The Result is " + result);
if(result.equals("5")) {
System.out.println(" The Result is Pass");
} else {
System.out.println(" The Result is Fail");
}
}
@AfterTest
public void terminatetest() {
driver.close();
}
}
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TestNGClass {
WebDriver driver = new FirefoxDriver();
@BeforeTest
public void launchapp() {
// Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Launch website
driver.navigate().to("http://www.calculator.net");
driver.manage().window().maximize();
}
@Test
public void calculatepercent() {
// Click on Math Calculators
driver.findElement(By.xpath(".//*[@id='menu']/div[3]/a")).click();
// Click on Percent Calculators
driver.findElement(By.xpath(".//*[@id='menu']/div[4]/div[3]/a")).click();
// Enter value 10 in the first number of the percent Calculator
driver.findElement(By.id("cpar1")).sendKeys("10");
// Enter value 50 in the second number of the percent Calculator
driver.findElement(By.id("cpar2")).sendKeys("50");
// Click Calculate Button
driver.findElement(By.xpath(".//*[@id='content']/table/tbody/tr/td[2]/input")).click();
// Get the Result Text based on its xpath
String result =
driver.findElement(By.xpath(".//*[@id='content']/p[2]/span/font/b")).getText();
// Print a Log In message to the screen
System.out.println(" The Result is " + result);
if(result.equals("5")) {
System.out.println(" The Result is Pass");
} else {
System.out.println(" The Result is Fail");
}
}
@AfterTest
public void terminatetest() {
driver.close();
}
}
SoapUI is an open-source tool used for functional and non-functional testing, widely used in WebServices testing. It requires basic understanding of the client/server environment, and knowledge of SOAP, WSDL, XML, and XML namespace. It is purely implemented using JAVA platform. It supports Windows, Mac, multiple Linux dialects. It allows testers to execute automated functional, regression, compliance, and load tests on different Web API.
TestRail is a test management tool used to track and maintain records of all STLC phases, from Test Plan, Testcase Execution, and Report creation. It can be integrated with many other tools – JIRA, Bugzilla, Fogbugz, Version One, TFS, GitHub etc.
TestRail is a test management tool used to track and maintain records of all STLC phases, from Test Plan, Testcase Execution, and Report creation. It can be integrated with many other tools – JIRA, Bugzilla, Fogbugz, Version One, TFS, GitHub etc.
SOAPUI Tutorial |
TestRail Tutorial |