Complete Excel Library

Using this excel library we can perform following manipulations on excel sheet.
  • How to get total row count - int getRowCount(String sheetName)
  • How to read the value  - String getCellData(String sheetName,String colName,int rowNum), String getCellData(String sheetName,int colNum,int rowNum).
  • How to set the value -  boolean setCellData(String sheetName,String colName,int rowNum, String data)
  • How to add a New work sheet - boolean addSheet(String  sheetname)
  • How to remove a work sheet -  boolean removeSheet(String sheetName)
  • How to add a column - boolean addColumn(String sheetName,String colName)
  • How to remove a column - boolean removeColumn(String sheetName, int colNum)
  • How to check if a sheet is exist or not - boolean isSheetExist(String sheetName)
  • How to get total column count -  int getColumnCount(String sheetName)
  • How to get cell row number - int getCellRowNum(String sheetName,String colName,String cellValue)
Complete Excel Library:
package com.utility;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Calendar;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class NewExcelLibrary {

 public static String path = System.getProperty("user.dir") + "/TestData/TestData.xlsx";

// public  String path;
 public FileInputStream fis = null;
 public FileOutputStream fileOut = null;
 private XSSFWorkbook workbook = null;
 private XSSFSheet sheet = null;
 private XSSFRow row = null;
 private XSSFCell cell = null;

 public NewExcelLibrary() {

  // this.path=path;
  try {
   fis = new FileInputStream(path);
   workbook = new XSSFWorkbook(fis);
   sheet = workbook.getSheetAt(0);
   fis.close();
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

 public NewExcelLibrary(String path) {

  this.path = path;
  try {
   fis = new FileInputStream(path);
   workbook = new XSSFWorkbook(fis);
   sheet = workbook.getSheetAt(0);
   fis.close();
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

 // returns the row count in a sheet
  public int getRowCount(String sheetName){
   int index = workbook.getSheetIndex(sheetName);
   if(index==-1)
    return 0;
   else{
   sheet = workbook.getSheetAt(index);
   int number=sheet.getLastRowNum()+1;
   return number;
   }
   
  }
  
  public String getCellData(String sheetName,String colName,int rowNum){
   try{
    if(rowNum <=0)
     return "";
   
   int index = workbook.getSheetIndex(sheetName);
   int col_Num=-1;
   if(index==-1)
    return "";
   
   sheet = workbook.getSheetAt(index);
   row=sheet.getRow(0);
   for(int i=0;i<row.getLastCellNum();i++){
    //System.out.println(row.getCell(i).getStringCellValue().trim());
    if(row.getCell(i).getStringCellValue().trim().equals(colName.trim()))
     col_Num=i;
   }
   if(col_Num==-1)
    return "";
   
   sheet = workbook.getSheetAt(index);
   row = sheet.getRow(rowNum-1);
   if(row==null)
    return "";
   cell = row.getCell(col_Num);
   
   if(cell==null)
    return "";
   //System.out.println(cell.getCellType());
   if(cell.getCellType().name().equals("STRING"))
      return cell.getStringCellValue();
   else if(cell.getCellType().name().equals("NUMERIC") || cell.getCellType().name().equals("FORMULA") ){
      
      String cellText  = String.valueOf(cell.getNumericCellValue());
      if (HSSFDateUtil.isCellDateFormatted(cell)) {
              // format in form of M/D/YY
       double d = cell.getNumericCellValue();

       Calendar cal =Calendar.getInstance();
       cal.setTime(HSSFDateUtil.getJavaDate(d));
               cellText =
                (String.valueOf(cal.get(Calendar.YEAR))).substring(2);
              cellText = cal.get(Calendar.DAY_OF_MONTH) + "/" +
                         cal.get(Calendar.MONTH)+1 + "/" + 
                         cellText;
              
              //System.out.println(cellText);

            }

      
      
      return cellText;
     }else if(cell.getCellType().name().equals("BLANK"))
         return ""; 
     else 
      return String.valueOf(cell.getBooleanCellValue());
   
   }
   catch(Exception e){
    
    e.printStackTrace();
    return "row "+rowNum+" or column "+colName +" does not exist in xls";
   }
  }
 
  // returns the data from a cell
  public String getCellData(String sheetName,int colNum,int rowNum){
   try{
    if(rowNum <=0)
     return "";
   
   int index = workbook.getSheetIndex(sheetName);

   if(index==-1)
    return "";
   
  
   sheet = workbook.getSheetAt(index);
   row = sheet.getRow(rowNum-1);
   if(row==null)
    return "";
   cell = row.getCell(colNum);
   if(cell==null)
    return "";
   
    if(cell.getCellType().name().equals("STRING"))
     return cell.getStringCellValue();
    else if(cell.getCellType().name().equals("NUMERIC") || cell.getCellType().name().equals("FORMULA") ){
     
     String cellText  = String.valueOf(cell.getNumericCellValue());
     if (HSSFDateUtil.isCellDateFormatted(cell)) {
             // format in form of M/D/YY
      double d = cell.getNumericCellValue();

      Calendar cal =Calendar.getInstance();
      cal.setTime(HSSFDateUtil.getJavaDate(d));
              cellText =
               (String.valueOf(cal.get(Calendar.YEAR))).substring(2);
             cellText = cal.get(Calendar.MONTH)+1 + "/" +
                        cal.get(Calendar.DAY_OF_MONTH) + "/" +
                        cellText;
             
            // System.out.println(cellText);

           }

     
     
     return cellText;
    }else if(cell.getCellType().name().equals("BLANK"))
        return "";
    else 
     return String.valueOf(cell.getBooleanCellValue());
   }
   catch(Exception e){
    
    e.printStackTrace();
    return "row "+rowNum+" or column "+colNum +" does not exist  in xls";
   }
  }
  
  // returns true if data is set successfully else false
  public boolean setCellData(String sheetName,String colName,int rowNum, String data){
   try{
   fis = new FileInputStream(path); 
   workbook = new XSSFWorkbook(fis);

   if(rowNum<=0)
    return false;
   
   int index = workbook.getSheetIndex(sheetName);
   int colNum=-1;
   if(index==-1)
    return false;
   
   
   sheet = workbook.getSheetAt(index);
   

   row=sheet.getRow(0);
   for(int i=0;i<row.getLastCellNum();i++){
    //System.out.println(row.getCell(i).getStringCellValue().trim());
    if(row.getCell(i).getStringCellValue().trim().equals(colName))
     colNum=i;
   }
   if(colNum==-1)
    return false;

   sheet.autoSizeColumn(colNum); 
   row = sheet.getRow(rowNum-1);
   if (row == null)
    row = sheet.createRow(rowNum-1);
   
   cell = row.getCell(colNum); 
   if (cell == null)
          cell = row.createCell(colNum);

      // cell style
      //CellStyle cs = workbook.createCellStyle();
      //cs.setWrapText(true);
      //cell.setCellStyle(cs);
      cell.setCellValue(data);

      fileOut = new FileOutputStream(path);

   workbook.write(fileOut);

      fileOut.close(); 

   }
   catch(Exception e){
    e.printStackTrace();
    return false;
   }
   return true;
  }
 
  // returns true if sheet is created successfully else false
  public boolean addSheet(String  sheetname){  
   
   FileOutputStream fileOut;
   try {
     workbook.createSheet(sheetname); 
     fileOut = new FileOutputStream(path);
     workbook.write(fileOut);
        fileOut.close();      
   } catch (Exception e) {   
    e.printStackTrace();
    return false;
   }
   return true;
  }
  
  // returns true if sheet is removed successfully else false if sheet does not exist
  public boolean removeSheet(String sheetName){  
   int index = workbook.getSheetIndex(sheetName);
   if(index==-1)
    return false;
   
   FileOutputStream fileOut;
   try {
    workbook.removeSheetAt(index);
    fileOut = new FileOutputStream(path);
    workbook.write(fileOut);
       fileOut.close();      
   } catch (Exception e) {   
    e.printStackTrace();
    return false;
   }
   return true;
  }
  
  // returns true if column is created successfully
  public boolean addColumn(String sheetName,String colName){
   //System.out.println("**************addColumn*********************");
   
   try{    
    fis = new FileInputStream(path); 
    workbook = new XSSFWorkbook(fis);
    int index = workbook.getSheetIndex(sheetName);
    if(index==-1)
     return false;
    
   XSSFCellStyle style = workbook.createCellStyle();
   //style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
   //style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
   
   sheet=workbook.getSheetAt(index);
   
   row = sheet.getRow(0);
   if (row == null)
    row = sheet.createRow(0);
   
   //cell = row.getCell(); 
   //if (cell == null)
   //System.out.println(row.getLastCellNum());
   if(row.getLastCellNum() == -1)
    cell = row.createCell(0);
   else
    cell = row.createCell(row.getLastCellNum());
          
          cell.setCellValue(colName);
          cell.setCellStyle(style);
          
          fileOut = new FileOutputStream(path);
    workbook.write(fileOut);
       fileOut.close();      

   }catch(Exception e){
    e.printStackTrace();
    return false;
   }
   
   return true;
   
   
  }
  
  // removes a column and all the contents
  public boolean removeColumn(String sheetName, int colNum) {
   try{
   if(!isSheetExist(sheetName))
    return false;
   fis = new FileInputStream(path); 
   workbook = new XSSFWorkbook(fis);
   sheet=workbook.getSheet(sheetName);
   XSSFCellStyle style = workbook.createCellStyle();
   //style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
   //XSSFCreationHelper createHelper = workbook.getCreationHelper();
   //style.setFillPattern(HSSFCellStyle.NO_FILL);
   
      
  
   for(int i =0;i<getRowCount(sheetName);i++){
    row=sheet.getRow(i); 
    if(row!=null){
     cell=row.getCell(colNum);
     if(cell!=null){
      cell.setCellStyle(style);
      row.removeCell(cell);
     }
    }
   }
   fileOut = new FileOutputStream(path);
   workbook.write(fileOut);
      fileOut.close();
   }
   catch(Exception e){
    e.printStackTrace();
    return false;
   }
   return true;
   
  }
   // find whether sheets exists 
  public boolean isSheetExist(String sheetName){
   int index = workbook.getSheetIndex(sheetName);
   if(index==-1){
    index=workbook.getSheetIndex(sheetName.toUpperCase());
     if(index==-1)
      return false;
     else
      return true;
   }
   else
    return true;
  }
  
  // returns number of columns in a sheet 
  public int getColumnCount(String sheetName){
   // check if sheet exists
   if(!isSheetExist(sheetName))
    return -1;
   
   sheet = workbook.getSheet(sheetName);
   row = sheet.getRow(0);
   
   if(row==null)
    return -1;
   
   return row.getLastCellNum();
   
  }
  
  public int getCellRowNum(String sheetName,String colName,String cellValue){
   
   for(int i=2;i<=getRowCount(sheetName);i++){
       if(getCellData(sheetName,colName , i).equalsIgnoreCase(cellValue)){
        return i;
       }
      }
   return -1;
   
  }  
}

Created Sample Test Class to call the methods from above excel library and perform the tasks.
import org.testng.annotations.Test;
import com.utility.NewExcelLibrary;

public class ExcelTest {
 
 NewExcelLibrary obj= new NewExcelLibrary("D:\\Workspace_Eclipse\\ReadExcel\\TestData\\TestData.xlsx");
 
 @Test(priority = 1)
 public void testCase1() {
  int totalRows=obj.getRowCount("Employee");
  System.out.println("Total rows: "+totalRows);
 }
 @Test(priority = 2)
 public void testCase2() {
  String salary=obj.getCellData("Employee", "Salary", 4);
  System.out.println("salary is: "+salary);
 }
 @Test(priority = 3)
 public void testCase3() {
  String rating=obj.getCellData("Employee", 4, 2);
  System.out.println("rating is: "+rating);
  int a=1;
  Double sum= Double.valueOf(rating)+a;
  System.out.println("The rating is now: "+sum);
 }
 @Test(priority = 4)
 public void testCase4() {
  obj.setCellData("Employee", "ID", 2, "105");
 }
}


Please refer below YouTube video for more details:

How to write data into Excel file

Below is the code to write data into excel sheet:

Library class to write data into excel sheet
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class WriteExcel {
 
 public void writeExcel(String sheetName, String cellvalue, int row, int col) throws Exception {
  
  String excelPath="D:\\Workspace_Eclipse\\ReadExcel\\TestData\\TestData.xlsx";
  
  File file= new File(excelPath);
  
  FileInputStream fis= new FileInputStream(file);
  
  XSSFWorkbook wb= new XSSFWorkbook(fis);
  
  XSSFSheet sheet= wb.getSheet(sheetName);
  
  sheet.getRow(row).createCell(col).setCellValue(cellvalue);
  
  FileOutputStream fos= new FileOutputStream(new File(excelPath));
  
  wb.write(fos);
  
  wb.close();
  
  fos.close();
 }
}

Sample Test Class
import org.testng.annotations.Test;
import com.writeExcel.WriteExcel;

public class WriteExcelTest {

 WriteExcel obj= new WriteExcel();
 
 @Test
 public void writeExcelTest() throws Exception {
  obj.writeExcel("Test", "Male", 0, 2);
 }
 
 @Test
 public void writeExcelTest1() throws Exception {
  obj.writeExcel("Test", "Female", 1, 2);
 }
 
}

Please refer below YouTube video on how to write data into excel sheet

Read excel file in Selenium using Apache POI

How to Read/Write Excel File?
  • To Read and Write excel files in Selenium we have to take help of third party API like JXL and Apache POI.
  • To read or write an Excel,Apache provides a very famous library POI. This library is capable enough to read and write both XLS and XLSX file format of Excel.
Difference between JXL and Apache POI
  • Most significant difference is that Java JXL does not support ".xlsx" format; it only supports ".xls" format.
  • JXL doesn't support Conditional Formatting, Apache POI does.
  • JXL doesn't support rich text formatting, i.e. different formatting within a text string.
Different Classes and Interfaces in Apache POI:
Classes and Interfaces
Explanation of classes and interfaces POI for reading XLS and XLSX file
  • Workbook: XSSFWorkbook and HSSFWorkbook classes implement this interface.
  • XSSFWorkbook: Is a class representation of XLSX file.
  • HSSFWorkbook: Is a class representation of XLS file.
  • Sheet: XSSFSheet and HSSFSheet classes implement this interface.
  • XSSFSheet: Is a class representing a sheet in an XLSX file.
  • HSSFSheet: Is a class representing a sheet in an XLS file.
  • Row: XSSFRow and HSSFRow classes implement this interface.
  • XSSFRow: Is a class representing a row in the sheet of XLSX file.
  • HSSFRow: Is a class representing a row in the sheet of XLS file.
  • Cell: XSSFCell and HSSFCell classes implement this interface.
  • XSSFCell: Is a class representing a cell in a row of XLSX file.
  • HSSFCell: Is a class representing a cell in a row of XLS file.
Download Apache POI Jars and configure in your project to work with excel.
1. If you are using plain java project then download the jars from below link and configure in your project's build path.
http://poi.apache.org/download.html
2. And if you are using maven use below dependencies in your POM.xml file.
                        <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>

We have a excel file in project directory and it contains below data:

Please refer below program to read above excel file in selenium:
import java.io.File;
import java.io.FileInputStream;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.testng.annotations.Test;

public class ReadExcel {
 
 @Test
 public void readExcel() throws Exception {
  
  String excelPath="D:\\Workspace_Eclipse\\ReadExcel\\TestData\\TestData.xlsx";
  String fileName="TestData";
  String sheetName="Test";
  //Create the object of File Class to get the excel path
  File file= new File(excelPath);
  //To read the file
  FileInputStream fis= new FileInputStream(file);
  XSSFWorkbook wb= new XSSFWorkbook(fis);
  XSSFSheet sheet=wb.getSheet(sheetName);
  //Get Total Rows in Excel Sheet
  int rowCount=sheet.getLastRowNum();
  System.out.println("Total Rows: "+(rowCount+1));
  //Print a particular cell value
  String data=sheet.getRow(0).getCell(1).getStringCellValue();
  System.out.println("Particular cell value: "+data);
  
  //Loop to print all values of the excel sheet
  for(int i=0; i<=rowCount;i++) {
   Row row=sheet.getRow(i);
   for(int j=0; j<row.getLastCellNum();j++) {
    String data1=sheet.getRow(i).getCell(j).getStringCellValue();
    System.out.print(data1+" ");
   }
   System.out.println();
  }
  wb.close();
 }
}

Output:
[RemoteTestNG] detected TestNG version 6.14.3
Total Rows: 10
Particular cell value: LastName1
FirstName1 LastName1 
FirstName2 LastName2 
FirstName3 LastName3 
FirstName4 LastName4 
FirstName5 LastName5 
FirstName6 LastName6 
FirstName7 LastName7 
FirstName8 LastName8 
FirstName9 LastName9 
FirstName10 LastName10 
PASSED: readExcel

How to create Excel Library so that we can use it inside out test cases. For that please refer below program.

Excel Library class:
import java.io.File;
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ExcelLibrary {
 
 XSSFWorkbook wb;
 XSSFSheet sheet;
 //Below Constructor is to load the excel configuration 
 public ExcelLibrary() throws Exception {
  String excelPath="D:\\Workspace_Eclipse\\ReadExcel\\TestData\\TestData.xlsx";
  File file= new File(excelPath);
  FileInputStream fis= new FileInputStream(file);
  wb= new XSSFWorkbook(fis);
 }
 public String readData(String sheetName, int row, int col) {
  sheet=wb.getSheet(sheetName);
  String data=sheet.getRow(row).getCell(col).getStringCellValue();
  return data;
 }
}

TestClass:
import org.testng.annotations.Test;
import com.readExcel.ExcelLibrary;

public class ReadExcelTest {
 
 @Test
 public void readExcelTest() throws Exception {
  ExcelLibrary obj= new ExcelLibrary();
  //Call readData method from ExcelLibrary class to get the value of Particular cell
  String datString=obj.readData("Test", 5, 1);
  System.out.println("The data is: "+datString);
 }
}

Please refer below YouTube video to get more details:

Types of Software Testing

In this post, we will describe different types of software testing. Various types of software testing are performed to achieve different objectives when testing a software application.

Unit Testing or Component Testing: UNIT TESTING is a level of software testing where individual units/ components of a software are tested. ... A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output. In procedural programming, a unit may be an individual program, function, procedure, etc.This testing is conducted by developer or white box tester.
For Example : if a developer is developing a loop for searching functionality of an application which is a very small unit of the whole code of that application then to verify that the particular loop is working properly or not is known as unit testing.

Structural Testing Techniques: Structural testing is the type of testing carried out to test the structure of code. It is also known as White Box testing or Glass Box testing. This type of testing requires knowledge of the code, so, it is mostly done by the developers.
For Example : Testing each line in the programme at least one time , verify the conditional statement are working properly or not

Different method of Structural Testing Techniques  
Branch testing: Branch Testing is defined as a testing method, which has the main goal to ensure that each one of the possible branches from each decision point is executed at least once and thereby ensuring that all reachable code is executed.
Path Testing: Path testing is a structural testing method that involves using the source code of a program in order to find every possible executable path. It helps to determine all faults lying within a piece of code. This method is designed to execute all or selected path through a computer program
Statement testing:  A test strategy in which each statement of a program is executed at least once. It is equivalent to finding a path (or set of paths) through the control-flow graph that contains all the nodes of the graph.
Condition Testing: It is another structural testing method that is useful during unit testing, using source code or detailed pseudocode as a reference for test design. Its goal is the thorough testing of every condition or test that occurs in the source code.

Functional Testing:   FUNCTIONAL TESTING is a type of software testing whereby the system is tested against the functional requirements/specifications. Functions (or features) are tested by feeding them input and examining the output. Functional testing ensures that the requirements are properly satisfied by the application. Functional testing is a quality assurance process and a type of black-box testing that bases its test cases on the specifications of the software component under test
Examples of Functional testing are. Unit Testing, Smoke Testing, Sanity Testing, Integration Testing etc.

Error Based Testing: Testing is conducted to analyze  the impact of the defect on the application. Intentionally adding the defect in application.

Mutation Testing: Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors. It is a type of White Box Testing which is mainly used for Unit Testing. 

Integration testing:  INTEGRATION TESTING is a level of software testing where  individual units are combined and tested as a group. The purpose of this level of testing is to expose faults in the interaction between integrated units. Test drivers and Test stubs are used to assist in Integration Testing.
Test Driver and Stub:  This are the temporary components which are used in place of main and sub module 
Driver: A substitute for main module in bottom-up integration 

Bottom-up Integration
Stub: It is a substitute for sub module in Top-down integration

Top-Down Integration
Different type of approaches in integration testing 
1. Big Bang integration:  Big Bang Integration Testing is the Integration testing where no incremental testing takes place prior to all the system's components being combined to form the system. In this approach, individual modules are integrated until all the modules are ready, and all or most units are combined and tested in one go.
However, if there are too many modules and the system is multilevel and complex, it is better not to apply the big-bang integration testing.

2. Top-down integration:  Top-down testing is an approach to integrated testing where the top integrated modules are tested and the branch of the module is tested step by step until the end of the related module.

3. Bottom – up Integration: A type of integration testing, bottom-up approach is a testing strategy in which the modules at the lower level are tested with higher modules until all the modules and aspects of the software are tested properly. 

4. Mixed / Sandwich integration: Sandwich Testing is the combination of bottom-up approach and top-down approach, so it uses the advantage of both bottom up approach and top down approach. ... It is also known as the Hybrid Integration Testing

System Testing:   SYSTEM TESTING is a level of testing that validates the complete and fully integrated software product. The purpose of a system test is to evaluate the end-to-end system specifications. System testing takes, as its input, all of the integrated components that have passed integration testing. It’s a black box testing . during system test we will conduct both functional and non functional testing.

User Interface Testing: Verify the page or window displayed , testing technique used to identify the presence of defects is a product/software under test by using Graphical user interface [GUI].

Object Properties: Verify the properties of an object like enabled , disabled ,colors, X and Y coordinates etc . 

Error guessing: Testing is conducted by performing invalid operations to validate the error msg is displaying or not.

Input Domain Testing: Validate the data accepted by the system , the testing is conducted for the Edit box, input fields etc.

Database Testing:  Database Testing is a type of software testing that checks the schema, tables, triggers etc. of the database under test. It involves creating complex queries for performing the load or stress test on the database and check its responsiveness. It checks integrity and consistency of data.

  • Validate the data in table
  • Constrain primary, foreign key
  • Data migration
  • Security 
  • Performance 
Calculation Testing:  The test is important for bank application , functional application etc. to verify all the calculated values are correct.

Links and URL’s Testing:  this test is only for web application , verify all the links are working correct or not, verify the navigation is as per expected or not. Verify the text link , image link , broken links etc.

Non functional Testing:  NON-FUNCTIONAL TESTING is defined as a type of Software testing to check non-functional aspects (performance, usability, reliability, etc) of a software application. It is designed to test the readiness of a system as per nonfunctional parameters which are never addressed by functional testing. 

Usability testing: Usability testing is a technique used in user-centered interaction design to evaluate a product by testing it on users. This can be seen as an irreplaceable usability practice, since it gives direct input on how real users use the system.

Load Testing:  Load testing is a type of non-functional testing. A load test is type of software testing which is conducted to understand the behavior of the application under a specific expected load. Load testing is performed to determine a system's behavior under both normal and at peak conditions.

Stress Testing: STRESS TESTING is a type of Software Testing that verifies the stability & reliability of the system. This test mainly measures the system on its robustness and error handling capabilities under extremely heavy load conditions. Stress Testing is done to make sure that the system would not crash under crunch situations.

Soak Testing: Soak testing involves testing a system with a typical production load, over a continuous availability period, to validate system behavior under production use. It may be required to extrapolate the results, if not possible to conduct such an extended test.
Note Conducting Load , stress testing etc… for 100 of users is not possible to do manually the tools are : 
  • Load Runner
  • Jmeter Web load
  • RPT (rational performance test tool)
  • Silk Performance 
Memory Testing/ Memory leakage testing:  Some memory got allocated and not used for any purpose are called memory leakage. When accessing the application verify the usage of memory. To find a memory leak, you've got to look at the system's RAM usage.

Volume Testing: VOLUME TESTING is a type of Software Testing, where the software is subjected to a huge volume of data. It is also referred to as flood testing. Volume testing is done to analyze the system performance by increasing the volume of data in the database. Usually conducted when accessing the data from database , performance is calculated by increasing the data transfer b/w the system.

Performance test: Performance testing is the process of determining the speed, responsiveness and stability of a computer, network, software program or device under a workload. Performance testing can involve quantitative tests done in a lab, or occur in the production environment in limited scenarios. This test is needed for application which are accessed by more no of users, accessed from remote locations.
During performance test we are calculate:
  • Response time: Time taken to get response from server to client.
  • Hit per second: No of request revived by the server in 1 second of time
  • Throughput: Throughput – indicates the number of transactions per second an application can handle, the amount of transactions produced over time during a test. 
  • Elapsed Time: Elapsed time is measured by the time from the first moment of sending the data and the time of the last byte of the received response.
Performance of application depends on:
  • Configuration of the system 
  • Network Speed
  • Load on the server
  • Configuration Setting
  • Programming Logic

Different type of software testing Method

1. White Box testing:  (also known as Clear Box Testing, Open Box Testing, Glass Box Testing, Transparent Box Testing, Code-Based Testing or Structural Testing):
White box testing is a software testing method in which the internal structure/design/implementation of the item being tested is known to the tester.

Different Types and Techniques of white box testing 
Unit Testing : The developer carries out unit testing in order to check if the particular module or unit of code is working fine. The Unit Testing comes at the very basic level as it is carried out as and when the unit of the code is developed or a particular functionality is built.
Static and dynamic Analysis: Static analysis involves going through the code in order to find out any possible defect in the code. Dynamic analysis involves executing the code and analyzing the output.
Statement Coverage: In this type of testing the code is executed in such a manner that every statement of the application is executed at least once. It helps in assuring that all the statements execute without any side effect.
Branch Coverage:  No software application can be written in a continuous mode of coding, at some point we need to branch out the code in order to perform a particular functionality. Branch coverage testing helps in validating of all the branches in the code and making sure that no branching leads to abnormal behavior of the application.
Security Testing: Security Testing is carried out in order to find out how well the system can protect itself from unauthorized access, hacking – cracking, any code damage etc. which deals with the code of application. This type of testing needs sophisticated testing techniques.
Mutation Testing:  A kind of testing in which, the application is tested for the code that was modified after fixing a particular bug/defect. It also helps in finding out which code and which strategy of coding can help in developing the functionality effectively.

Advantages of White Box Testing:
  • As the knowledge of internal coding structure is prerequisite, it becomes very easy to find out which type of input/data can help in testing the application effectively.
  • Its helps in optimizing the code and in removing the extra lines of code, which can bring in hidden defects.
Disadvantages of White Box Testing:
  • As knowledge of code and internal structure is a prerequisite, a skilled tester is needed to carry out this type of testing, which increases the cost. 
  • It is nearly impossible to look into every bit of code to find out hidden errors, which may create problems, resulting in failure of the application.
2. Black box testing: BLACK BOX TESTING, also known as Behavioral Testing, is a software testing method in which the internal structure/design/implementation of the item being tested is not known to the tester. These tests can be functional or non-functional, though usually functional.

The purpose of black box testing
Black-box testing checks that the user interface and user inputs and outputs all work correctly. Part of this is that error handling must work correctly. It's used in functional and system testing..
Example : an operating system like Windows, a website like Google, a database like Oracle or even your own custom application. Under Black Box Testing, you can test these applications by just focusing on the inputs and outputs without knowing their internal code implementation.

Types of Black Box Testing:

There are several phases of which are segregated into different types:
Regression testing: Regression testing verifies that recent code changes haven't altered or destroyed the already existing functionality of a system. Regression testing examples include iteration regression and full regression, and both can be covered with manual and automated test cases.
Unit testing: UNIT TESTING is a level of software testing where individual units/ components of a software are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output.
Beta testing: Beta Testing is performed by real users of the software application in a real environment. Beta testing is one of the type of User Acceptance Testing. Beta version of the software, whose feedback is needed, is released to a limited number of end-users of the product to obtain feedback on the product quality.
Integration testing: INTEGRATION TESTING is a level of software testing where individual units are combined and tested as a group. The purpose of this level of testing is to expose faults in the interaction between integrated units. Test drivers and test stubs are used to assist in Integration Testing.
System testing: SYSTEM TESTING is a level of testing that validates the complete and fully integrated software product. The purpose of a system test is to evaluate the end-to-end system specifications. Usually, the software is only one element of a larger computer-based system.
Functional testing: FUNCTIONAL TESTING is a type of software testing whereby the system is tested against the functional requirements/specifications. Functions (or features) are tested by feeding them input and examining the output. Functional testing ensures that the requirements are properly satisfied by the application.
Load testing: Load testing is a type of non-functional testing. A load test is type of software testing which is conducted to understand the behavior of the application under a specific expected load. Load testing is performed to determine a system's behavior under both normal and at peak conditions.

Advantages of Black Box Testing
  • The test is unbiased because the designer and the tester are independent of each other.
  • The tester does not need knowledge of any specific programming languages.
  • The test is done from the point of view of the user, not the designer.
  • Test cases can be designed as soon as the specifications are complete.
Disadvantages of Black Box Testing
  • The test can be redundant if the software designer has already run a test case.
  • The test cases are difficult to design.
  • Testing every possible input stream is unrealistic because it would take a inordinate amount of time; therefore, many program paths will go untested.
3. Gray box testing: GRAY BOX TESTING is a technique to test the software product or application with partial knowledge of the internal workings of an application. The purpose of this testing is to search for defects due to improper code structure or improper functioning usage of an application
Example of Gray Box Testing would be when the codes for two units/modules are studied (White Box Testing method) for designing test cases and actual tests are conducted using the exposed interfaces (Black Box Testing method).

Gray-box testing Techniques:
Regression testing: Regression testing verifies that recent code changes haven't altered or destroyed the already existing functionality of a system. Regression testing examples include iteration regression and full regression, and both can be covered with manual and automated test cases.
Pattern Testing: A pattern tester is someone who tests a sewing pattern and provides feedback to the pattern designer before it is launched into the market . This process is done in order to check the sewing instructions, as well as the fit of the pattern on different body types, before the pattern is released to the public.
Orthogonal array testing: Orthogonal array testing. Orthogonal array testing is a black box testing technique that is a systematic, statistical way of software testing. It is used when the number of inputs to the system is relatively small, but too large to allow for exhaustive testing of every possible input to the systems.
Matrix testing: A matrix is a concise organizer of simple tests, especially useful for function tests and domain tests. It groups test cases that are essentially the same. For example, for most input fields, you'll do a series of the same tests, checking how the field handles boundaries, unexpected characters, function keys, etc

Advantages of Gray Box Testing:
  • Gray-box testing provides combined benefits of both white-box and black-box testing
  • It is based on functional specification, UML Diagrams, Database Diagrams or architectural view
  • Gray-box tester handles can design complex test scenario more intelligently
  • The added advantage of Gray-box testing is that it maintains the boundary between independent testers and developers.
Disadvantages of Gray Box Testing:
  • In Gray-box testing, complete white box testing cannot be done due to inaccessible source code/binaries.
  • It is difficult to associate defects when we perform Gray-box testing for a distributed system.