Tuesday 23 July 2019

Database testing in selenium - DB validation


Database Testing In Selenium


So Database connectivity or Database testing is the most important and frequently used task that we all need to perform in selenium - Data base connectivity.

DB connection is always required to make automation script cover maximum of the task such as validation and verification of data entered or stored in DB.

In Java we can use JDBC driver which help to connect to other db and execute queries and fetch the required data. In Selenium we will take the same approach with JDBC.

Lets see how can we connect to DB in selenium with below code. Before starting if want to know more about selenium click here -> Learn Selenium


JDBC connection ->


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

import org.apache.log4j.Logger;

public class DBr {

static Logger dbLogger= Logger.getLogger(DBHelper.class);

public static Connection getConnection() throws AccountException
{

Connection conn=null;

try {
FileInputStream fin=new FileInputStream("database.properties");
Properties prop= new Properties();
prop.load(fin);
dbLogger.info("Property file loaded..");
System.out.println("properties loaded..");
String driver= prop.getProperty("driver");
String url= prop.getProperty("url");
String user= prop.getProperty("username");
String passwd= prop.getProperty("password");
Class.forName(driver);
conn=DriverManager.getConnection(url,user,passwd);
dbLogger.info("database connected...");
return conn;
} catch (SQLException e) {
dbLogger.error(e.getMessage());
throw new AccountException(e.getMessage());
} catch (FileNotFoundException e) {
dbLogger.error(e.getMessage());
throw new AccountException(e.getMessage());
} catch (IOException e) {
dbLogger.error(e.getMessage());
throw new AccountException(e.getMessage());
} catch (ClassNotFoundException e) {
dbLogger.error(e.getMessage());
throw new AccountException(e.getMessage());
}
}
public long insertAccountHolderDetails(AccountHolder acc) 
throws AccountException{
try {
Connection conn= getConnection();
String sql= "insert into AccountHolder values(custId_seq.nextval,?,?,?,?)";
PreparedStatement ps= conn.prepareStatement(sql);
ps.setString(1,acc.getFirstName());
    ps.setString(2,acc.getLastName());
    ps.setLong(3,acc.getMobilenumber());
    ps.setString(4, acc.getAddress());
    int rec=ps.executeUpdate();
    if(rec==1){
    sql= "select custId_seq.currval from abc
    ps= conn.prepareStatement(sql);
    ResultSet rs= ps.executeQuery();
    if(rs.next())
    {
    long custId= rs.getLong(1);
    dbLogger.info("record inserted :" +custId);
    return custId;
    }
    }
    
} catch (SQLException e) {
dbLogger.error(e.getMessage());
throw new AccountException(e.getMessage());
}
return 0;
}

}







Validate table in selenium,database testing in selenium,database testing,selenium,selenium database testing,selenium webdriver,database,selenium,selenium database connection using jdbc,database connection,database testing selenium,java database connection,database connection in java 1.8


Saturday 13 July 2019

Selenium - Validate table in web page

Selenium - Validate table in web page


Often in Selenium we come across scenarios where we have to validate a web table for a entry or click a cell based on the row value. Not clear?

let me place this in easiest way, before starting please see other post and understand about selenium webdriver and Tables in html from here - Selenium Webdriver

As we all know we have scenarios in selenium webdriver where we have to validate data in web table or click on a row based on the column value of particular row. For such scenarios it is very difficult to validate and get the result.It become even more painful when we have to repeat the process frequently for different table in the web page.Below are the things that we can struggle with

  • Identifying particular table 
  • Identifying row of the table or row count in web table selenium webdriver
  • Identifying column of the table or column count in web table selenium webdriver

We can get the xpath for table, row or column but that needs to be modified if we have more than one table in the page. So we came up with below code which can be used as a generic method to validate any table in webpage. Below is the script.


Selenium webdriver table validation method:

public void ValidteTable(String DocumentsTable_Columns,String DocumentsTable_Rows, String ColumnName,String ColumnValue)
{

       int temp1=1;
for (int i=1;i<=DocumentsTable_Columns.size();i++)
{
 if(driver.findElement(By.xpath("(//table)[1]/thead/tr/th["+i+"]/div")).getText().equals("ColumnName"))

{
break;
}

temp1=temp1+1;
}

System.out.println("temp1 : " + temp1);

temp2=1;

for(int i=1;i<=DocumentsTable_Rows.size();i++)
  {
   if(driver.findElement(By.xpath("(//table)[1]/tbody/tr["+i+"]/td["+temp1+"]/div/p")).getText().equalsIgnoreCase("ColumnValue"))
   {
   break;
   }
   temp2=temp2+1;
  }
try
{

Assert.assertEquals(driver.findElement(By.xpath("(//table)[1]/tbody/tr["+temp2+"]/td["+temp1+"]/div/p")).getText(),ColumnValue);
System.out.println("##Validated "+columnvalidate+" is present");
 
}catch(AssertionError e)
{
System.out.println("Not Equal");
}
}





selenium,selenium webdriver,table in selenium,web tables in selenium,data table in selenium,selenium testing,handling web table in selenium,travelling in table in selenium,selenium training,how to get table data in selenium

Tuesday 9 July 2019

Automation testing resume: Selenium with cucumber


Selenium Resume with cucumber

                                                     

  Tester Name


 EMAIL: Enter E-mail ID       CELL: Enter Mobile number         PLACE: Enter current place
------------------------------------------------------------------------------------------------------------------

Professional Summary:

X years of professional experience in Automation Testing with a solid understanding of overall Software Quality assurance processes. SDLC / STLC and Defect Tracking & Reporting.
 Strong Experience in Automating Web Applications using Selenium WebDriver, Grid with TestNG, Maven & BDD (cucumber).
 Strong Experience in Automating Web Applications using Selenium WebDriver with TestNG.
 Well acquainted with all phases of SDLC and STLC.
  Experience in preparing Cucumber feature files (User Stories) and automated the feature file using Selenium.
 Used GitHub, source code management tool for code re-usage, high portability extending scope of Automation Testing.
 Experience in logging defects using JIRA, performed defect tracking and reporting
 Experience in Java Programming, Selenium WebDriver and TestNG.
 Hands on experience in Agile Methodology.
 Well versed with Handling Elements in Selenium WebDriver.
  Experience in Cross browser testing and Parallel Test execution using Selenium WebDriver, TestNG and selenium Grid.
 Proficient in devising all the artifacts of testing such as Test Scenarios, Test Cases, Defect Reports and Test Summary Report
 Certified in ISTQB Foundation Level.

Education Qualification:

Enter Latest education details (Graduation/Post Graduation)
Work Experience:

Enter latest working organization with designation and period (eg. From March 2018 to till date)
Skills Profile

Operating System
Windows 7,Windows XP, Unix
Test Management Tools
JIRA, HP QC/ALM , MTM
Database
MySQL
Tools
Selenium, Jenkins, IDE, GIT
Languages
JAVA,C
Bug Tracking Tools
JIRA



 Project Profile:


Summary of Projects

Project 01: -                                                                                              Duration: -

Project Name: -
Role: -
Domain:-
Organization:-

Summary of Project-
             Here add summary of project what is project about and what functionality is being developed and tested
Responsibilities Undertaken:

      Involved in identifying the E2E scenario & Creating the Reusable methods & Generic methods.
      Developed the Automation Test Scripts in Selenium WebDriver using Java based on the design pattern Page Object Model for re-usability.
       Prepared Test Cases using Data Driven, Hybrid, Modular, and Keyword Driven Framework in WebDriver. 
      Prepared XML and Excel files for collection of data and Element Locators using object repository used this in test suite with the help of APACHE POI library files. 
      Creating and Executing test scripts for regression testing of web application using selenium & cucumber.
      Validating functional scenarios where Automation is not possible.
      Maintained the Selenium & JAVA automation code and repositories using GIT.
      Providing effort estimation to the client
      Involved in test scripts review and debugging of modification existing scripts
•    Prepared and sent daily reports – test execution report and bug report to management.
     Attending defect triaging calls and meetings on a daily basis with developers, and Client.
-------------------------------------------------------------------------------------------------------------------------------------
Project 02: -                                                                                              Duration: -

Project Name: -
Role: -
Domain:-
Organization:-

Summary of Project-
             Here add summary of project what is project about and what functionality is being developed and tested

Responsibilities Undertaken:

      Analyzing the Functional requirement using FRD and identified test scenarios/test objectives.
      Involved in Test data identification, gathering and validation in different databases by using DB queries.
      Creating and Executing test scripts for regression testing of web application using selenium.
      Validation of different types of trades are flowing to desired applications.
      Providing effort estimation to the client.
      Involved in test scripts review and debugging of modification existing scripts
      Prepared and sent daily reports – test execution report and bug report to management.
      Working with SVN/GIT.
      Attending defect triaging calls and meetings on a daily basis with developers and Client.
      Configuring the build on Jenkins.
      Participated in regular KT Sessions for different modules.
-------------------------------------------------------------------------------------------------------------------------------------

Certification

Here goes all the certification done till date (eg-ISTQB).

PERSONAL DETAILS

      DATE OF BIRTH:                   

      LANGUAGES KNOWN:           




This format can be used for skill set of selenium webdriver with cucumber and selenium with testng and junit. We will bring more format for Automation testing resume format or selenium tester resume.


Check my another blog : Garhwali song
Automation testing resume