2016 - All About Testing 2016

What is the recipe for successful achievement?

To my mind there are just four essential ingredients: Choose a career you love, give it the best there is in you, seize your opportunities, and be a member of the team.

“All our dreams can come true, if we have the courage to pursue them.”

“I’m a great believer in luck, and I find the harder I work, the more I have of it.”

Success unshared is failure.

To make our way, we must have firm resolve, persistence, tenacity. We must gear ourselves to work hard all the way. We can never let up.

"Everyone you will ever meet knows something you don't."

he fact that I can plant a seed and it becomes a flower, share a bit of knowledge and it becomes another's, smile at someone and receive a smile in return, are to me continual spiritual exercises.

The secret of success is to do the common things uncommonly well.

Good things come to people who wait, but better things come to those who go out and get them.

Sunday 18 September 2016

Java Concepts for tester

Java Concepts for tester
Abstraction is a process of hiding the implementation details and showing only functionality to the user.
There are two ways to achieve abstraction in java
  1. Abstract class (0 to 100%)
  2. Interface (100%)
An interface in java is a blueprint of a class. It has static constants and abstract methods only.
The interface in java is a mechanism to achieve fully abstraction.
         interface printable{
           void print();
}
       class A6 implements printable{
       public void print(){System.out.println(“Hello”);}
       public static void main(String args[]){
A6 obj = new A6();
obj.print();
}
}
A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated.
differences between abstract class and interface
Abstract class

Interface
1) Abstract class can have abstract and non-abstract methods.

Interface can have only abstract methods.
2) Abstract class doesn’t support multiple inheritance.

Interface supports multiple inheritance.
3) Abstract class can have final, non-final, static and non-static variables.

Interface has only static and final variables.
4) Abstract class can have static methods, main method and constructor.

Interface can’t have static methods, main method or constructor.
5) Abstract class can provide the implementation of interface.Interface can’t provide the implementation of abstract class.
6) The abstract keyword is used to declare abstract class.The interface keyword is used to declare interface.
7) Example:
public abstract class Shape{
public abstract void draw();
}


Example:
public interface Drawable{
void draw();
}
Encapsulation in java is a process of wrapping code and data together into a single unit, for example capsule i.e. mixed of several medicines.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object.
  class Subclass-name extends Superclass-name
{                //methods and fields
}
Polymorphism in java is a concept by which we can perform a single action by different ways.
In java, we use method overloading and method overriding to achieve polymorphism.

Difference between method overloading and method overriding in java


Method Overloading


Method Overriding
Method overloading is used to increase the readability of the program.

Method overriding is used to provide the specific implementation of the method that is already provided by its super class.
Method overloading is performed within class.

Method overriding occurs in two classes that have IS-A (inheritance) relationship.
In case of method overloading, parameter must be different.

In case of method overriding, parameter must be same.
Method overloading is the example of compile time polymorphism.

Method overriding is the example of run time polymorphism.
In java, method overloading can’t be performed by changing return type of the method only. Return type can be same or different in method overloading. But you must have to change the parameter.


Return type must be same or covariant in method overriding.
Serialization in java is a mechanism of writing the state of an object into a byte stream. The reverse operation of serialization is called deserialization.
Factorial of given number
import java.util.Scanner;
public class factorial {
public static void main(String[] args) {
//Scanner object for capturing the user input
Scanner scanner = new Scanner(System.in);
System.out.println(“Enter the number:”);
//Stored the entered value in variable
int num = scanner.nextInt();
//Called the user defined function fact
int factorial = fact(num);
System.out.println(“Factorial of entered number is: “+factorial);
}
static int fact(int n)
{
int output;
if(n==1){
return 1;
}
//Recursion: Function calling itself!!
output = fact(n-1)* n;
return output;
}
}
Prime number or not
import java.util.Scanner;
public class primeNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i,flag=0;
Scanner scan= new Scanner(System.in);
System.out.println(“Enter a number for check:”);
//capture the input in an integer
int n=scan.nextInt();
for(i=2;i<=n/2;i++){
if(n%i==0){
System.out.println(“Number is not prime”);
flag=1;
break;
}
}
if(flag==0)
System.out.println(“Number is prime”);
}
}
Fibonacci Series
public class Fibonacci {
public static void main(String[] args) {
int n1=0,n2=1,n3,i,count=10;
System.out.print(n1+” “+n2);//printing 0 and 1
for(i=2;i<count;++i)//loop starts from 2 because 0 and 1 are already printed
{
n3=n1+n2;
System.out.print(” “+n3);
n1=n2;
n2=n3;
}
}
}
Armstrong number is a number that is equal to the sum of cubes of its digits
153 = (1*1*1)+(5*5*5)+(3*3*3)  = 153
public class amstrong {
public static void main(String[] args) {
int c=0,a,temp;
int n=153;//It is the number to check armstrong
temp=n;
while(n>0)
{
a=n%10;
n=n/10;
c=c+(a*a*a);
}
if(temp==c)
System.out.println(“armstrong number”);
else
System.out.println(“Not armstrong number”);
}
}
Palindrome or not
public class PalindromeExample {
/**
@param args
*/
public static void main(String[] args) {
int r,sum=0,temp;
int n=454;//It is the number variable to be checked for palindrome
temp=n;
while(n>0){
r=n%10;  //getting remainder
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
System.out.println(“palindrome number “);
else
System.out.println(“not palindrome”);
}
}

Read Whole excel file in Selenium Webdriver using JExcel

Selenium support only browser automation so for reading and writing with Excel files we have to user third party API like JExcel and Apache POI.
here we are using JExcel
For this, we have to download jxl.jar file. For downloading this jar file search on google for “download jxl.jar file” or click on below link
download the zip file. extract the same.
Now Add the jxl.jar file to project.
Right Click on project then Click on Build path> then Click on configure build path then Go to Library Section then
Click on add external jars and now attach jar file click on Apply finally click on  Save button.
And Here is the Code.

package TEST;
import jxl.*;
import jxl.read.biff.BiffException;
import jxl.write.*;
import java.io.File;
import java.io.IOException;
public class readExcelFile {
public static void main(String[] args) throws WriteException {
try {
//define workbook
Workbook wb = null;
try {
//initialize work book to read
wb = Workbook.getWorkbook(new File(“D:\\Ashu\\Selenium\\testJexcel.xls”));
} catch (BiffException e) {
e.printStackTrace();
}
//get first sheet
Sheet sh = wb.getSheet(0);
//print first sheet name
String sheetName=sh.getName();
System.out.println(“Sheet name :”+sheetName);
//define cell string or number variable
String cellString = null;
double cellNumber = 0;
//loop through each cell and read content
//you can give here the your excel sheets row and col value in for loop for condition.
for(int row=0;row<4;row++) {
for (int col = 0; col < 3; col++) {
Cell cell = sh.getCell(col, row);
if (cell.getType() == CellType.LABEL) {
cellString = cell.getContents();
System.out.print(cellString +” “);
} else if (cell.getType() == CellType.NUMBER) {
NumberCell nc = (NumberCell) cell;
cellNumber = nc.getValue();
//System.out.print(cellNumber + ” ,”);
}
}
//start new line for new row
System.out.println();
}
//close work book
wb.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

Friday 22 July 2016

My Manual testing interview at Infosys BPO

I got the mail from naukri.com for the skill set "Functional Testing with UNIX + SQL"

No of Rounds

1. First, they took an aptitude on SQL and Manual concepts.

2. HR round

3. Telephonic Technical Round


The first round is aptitude test which includes multiple choice questions
there are two sections 
1. SQL -  Basic
2. Testing - ISTQB questions and answer

Second round is HR round
In this round, HR ask about my previous organization experience
Are you ready to locate
How much salary you expect
how many years you are willing to commit to us
Very simple round and she is very polite

Third round is Telephonic Technical Round
This round is happening there only
She ask me about which tool I use for bug tracking 
All Manual testing questions
Some SQL query
And especially more on QC because they want the guy who uses QC

BEST LUCK