Fake Testers

Hi Readers,

This article is not related to any tutorial but yes its a lesson learnt and still i am learning. In my career, I have seen so many tester mates whom I feel are fake tester, not because I don't like them but because of the ways they find and apply to sign off things from their end. I am surprised how easily they are able to do so but sad that it affects the image of other testers. Hence, I am sharing few ways used by these fake testers to get there job done.

- Blocker ! Blocker ! We are blocked : This is one the common instance, I have seen done by few fake testers. They simply run 1 flow gets a blocker in form of Blank/Error pages and start running all over the floor without even studying the logs and trying to find out what could be the RCA of it.

- We need More time : Yes, we need more time to test this requirement. This requirement is too complex to test. This is one of the thing I noticed quite regularly when a new release is about to start. Main point of concern is the time which is not justifiable. I agree that a requirement is complex but ultimately there is a time constraint which is required to be met for a release cycle. Hence, working on new requirements rather than demanding of more time will reduce the burden.

- It was working fine earlier : Wooo... This point will definitely put me under radar whether i am on tester side or other team. However, i am true tester and want to deliver a quality product. There are situation where build arrive thrice in a day. On the contrary, build also arrive once in a week. Now, during this course of time, if someone test a requirement, assures that he/she has tested it completely and then comes a defect in new build which was a basic flow to be covered and is missed, fake tester say this line "It was working fine in previous build". Goosh !! Why to lie ? This is the common thing I see so often and feel sad.

Group Tests

package com.gaurav.testNG;

import org.testng.annotations.*;

public class GroupTest {

    @Test(groups = "method1")
    public void testingMethod1() {
        System.out.println("Method - testingMethod1()");
    }

    @Test(groups = "method2")
    public void testingMethod2() {
        System.out.println("Method - testingMethod2()");
    }

    @Test(groups = "method1")
    public void testingMethod1_1() {
        System.out.println("Method - testingMethod1_1()");
    }

    @Test(groups = "method4")
    public void testingMethod4() {
        System.out.println("Method - testingMethod4()");
    }

}

Select Record

/*********************************

Title  : Selecting Records
Author : Gaurav Khanna

 *********************************/

package com.gaurav.jdbc;

import java.sql.*;
import org.testng.annotations.Test;

public class SelectRecord {

    @Test
    public void testselectRecord() throws SQLException, ClassNotFoundException {

        // Causes the class "oracle.jdbc.driver.OracleDriver" to be
        Class.forName("oracle.jdbc.driver.OracleDriver");

        //
        System.out.println("Oracle JDBC Driver Registered!");

        // Declaring Connection type variable

        Connection connection = null;

        Statement stmt;

        // Create Connection Object
        connection = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:orcl", "gaurav", "gaurav");

        if (connection != null) {

            //
            System.out.println("Database Connection Successful !! ");

            //
            System.out.println("Creating statement...");

            //
            stmt = connection.createStatement();

            //
            String sql = "SELECT id, first, last, age FROM Registration";

            ResultSet rs = stmt.executeQuery(sql);

            //
            while (rs.next()) {
                // Retrieve by column name
                int id = rs.getInt("id");
                int age = rs.getInt("age");
                String first = rs.getString("first");
                String last = rs.getString("last");

                // Display values
                System.out.print("ID: " + id);
                System.out.print(", Age: " + age);
                System.out.print(", First: " + first);
                System.out.println(", Last: " + last);

            }
        }

        // Closing Statement and Connection
        connection.close();
    }
}

Insert Record

/*********************************

Title  : Inserting Records
Author : Gaurav Khanna

 *********************************/

package com.gaurav.jdbc;

import java.sql.*;
import org.testng.annotations.Test;

public class InsertRecord {

    @Test
    public void testinsertRecord() throws SQLException, ClassNotFoundException {

        // Causes the class "oracle.jdbc.driver.OracleDriver" to be

        Class.forName("oracle.jdbc.driver.OracleDriver");

        //
        System.out.println("Oracle JDBC Driver Registered!");

        // Declaring Connection type variable
        Connection connection = null;

        //
        Statement stmt;

        // Create Connection Object
        connection = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:orcl", "gaurav", "gaurav");

        if (connection != null) {

            //
            System.out.println("Database Connection Successful !! ");

            //
            System.out.println("Inserting records into the table...");

            stmt = connection.createStatement();

            String sql = "INSERT INTO Registration "
                    + "VALUES (100, 'Zara', 'Ali', 18)";

            stmt.executeUpdate(sql);

            sql = "INSERT INTO Registration "
                    + "VALUES (101, 'Mahnaz', 'Fatma', 25)";

            stmt.executeUpdate(sql);

            sql = "INSERT INTO Registration "
                    + "VALUES (102, 'Zaid', 'Khan', 30)";

            stmt.executeUpdate(sql);

            sql = "INSERT INTO Registration "
                    + "VALUES(103, 'Sumit', 'Mittal', 28)";

            //
            stmt.executeUpdate(sql);

            //
            System.out.println("Inserted records into the table...");

        }
        connection.close();
    }

}

Drop Table

/*********************************

Title  : Droping Table
Author : Gaurav Khanna

 *********************************/

package com.gaurav.jdbc;

import java.sql.*;
import org.testng.annotations.Test;

public class DropTable {

    @Test
    public void testdropTable() throws SQLException, ClassNotFoundException {

        //
        Class.forName("oracle.jdbc.driver.OracleDriver");

        //
        Connection connection = null;

        //
        Statement stmt;

        // Create Connection Object
        connection = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:orcl", "gaurav", "gaurav");

        if (connection != null) {

            //
            System.out.println("Database Connection Successful !! ");

            //
            System.out.println("Droping Table...");

            //
            stmt = connection.createStatement();

            //
            String sql = "DROP TABLE REGISTRATION";

            //
            stmt.executeUpdate(sql);

            //
            System.out.println("Table dropped successfully...");

        }

        //
        connection.close();
    }

}

Delete Record

/*********************************

Title  : Deleting Records
Author : Gaurav Khanna

 *********************************/

package com.gaurav.jdbc;

import java.sql.*;
import org.testng.annotations.Test;

public class DeleteRecord {

    @Test
    public void testdeleteRecord() throws SQLException, ClassNotFoundException {

        // Causes the class "oracle.jdbc.driver.OracleDriver" to be

        Class.forName("oracle.jdbc.driver.OracleDriver");

        // Declaring Connection type variable
        Connection connection = null;

        //
        Statement stmt;

        // Create Connection Object
        connection = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:orcl", "gaurav", "gaurav");

        if (connection != null) {

            //
            System.out.println("Database Connection Successful !! ");

            //
            System.out.println("Creating statement...");

            //
            stmt = connection.createStatement();

            //
            String sql = "DELETE FROM Registration " + "WHERE id = 101";

            //
            String sql1 = "SELECT id, first, last, age FROM Registration";

            //
            stmt.executeQuery(sql);

            //
            ResultSet rs = stmt.executeQuery(sql1);

            //
            while (rs.next()) {

                // Retrieve by column name
                int id = rs.getInt("id");
                int age = rs.getInt("age");
                String first = rs.getString("first");
                String last = rs.getString("last");

                // Display values
                System.out.print("ID: " + id);
                System.out.print(", Age: " + age);
                System.out.print(", First: " + first);
                System.out.println(", Last: " + last);

            }
        }
        connection.close();
    }

}

Create Table

/*********************************

Title  : Creating Table
Author : Gaurav Khanna

 *********************************/

package com.gaurav.jdbc;

import java.sql.*;
import org.testng.annotations.Test;

public class CreateTable {

    @Test
    public void testcreateTable() throws SQLException, ClassNotFoundException {

        // Causes the class "oracle.jdbc.driver.OracleDriver" to dynamically
        Class.forName("oracle.jdbc.driver.OracleDriver");

        // Declaring Connection type variable
        Connection connection = null;

        //
        Statement stmt;

        // Create Connection Object
        connection = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:orcl", "gaurav", "gaurav");

        if (connection != null) {

            //
            System.out.println("Database Connection Successful !! ");

            //
            System.out.println("Creating table in given database...");

            //
            stmt = connection.createStatement();

            String sql = "CREATE TABLE REGISTRATION "
                    + "(id INTEGER not NULL, " + " first VARCHAR(255), "
                    + " last VARCHAR(255), " + " age INTEGER, "
                    + " PRIMARY KEY ( id ))";

            stmt.executeUpdate(sql);

            //
            System.out.println("Created table in given database...");

        }

        connection.close();
    }

}

Locating WebElements using Partial Link Text

/*********************************

Title  : Locate Element By Partial Link Text
Author : Gaurav Khanna

 *********************************/

package com.gaurav.webdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class LocateByPartialLinkText {

    //
    WebDriver webDriver = new FirefoxDriver();

    @Test
    public void testlocateByPartialLinkText() throws InterruptedException {

        //
        webDriver.get("http://book.theautomatedtester.co.uk/chapter2");

        //
        WebElement link = webDriver.findElement(By.partialLinkText("In"));

        //
        link.click();

        //
        Thread.sleep(5000);

        //
        webDriver.quit();

    }

}