Tuesday, 27 May 2014

Basic Code

1.  Find the top 3 elements of an array, Do not use sorting use 3 variables.
(Amazon Interview Question)
public class LargeNumberArray {
 public static void main(String args[]){
   int a[]={7,2,8,1,3,5,10,0,12,11};
   int large=a[0],second=a[0],third=a[0];
   int index=0,index1=0,index2=0;
   for (int i=0;i<a.length;i++)
   {
     if(a[i]>=large)
     {
        large=a[i];
        index=i;  
     }
   }
   for (int i=0;i<a.length;i++)
   {
      if(a[i]<large && a[i]>second))
      {
         second=a[i];
         index1=i;
      }
    }
   for (int i=0;i<a.length;i++)
   {
      if(a[i]<second && a[i]>third))
      {
         third=a[i];
         index2=i; 
      }
   }
   System.out.println("Large Number: "+large+ " Index: "+index);
   System.out.println("Large Number: "+second+ " Index: "+index1);
   System.out.println("Large Number: "+third+ " Index: "+index2);
  }
}

2.  Program for Fibonacci series.
import java.io.*;
public class Fibonacci {
public static void main(String args[])throws Exception
{
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ir);
System.out.println("Enter Number: ");
String s=br.readLine();
int n=Integer.parseInt(s);
System.out.print("Series=");
fibonacci(n);
}
public static void fibonacci(int n)
{
int a=0,b=1;
for(int i=0;i<n;i++)
{
System.out.print(a+", ");
a=a+b;
b=a-b;
}
}
}

3. Program to check Palindrome Number.
import java.io.*;
public class Pallendrome {
public static void main(String[] args) throws Exception
{
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ir);
System.out.print("Enter Number: ");
String s=br.readLine();
int n=Integer.parseInt(s);
palindrome(n);
}
public static void palindrome(int n)
{
int temp,reversed=0;
int number=n;
while(number>0)
{
temp=number%10;
number=number/10;
reversed=(reversed*10)+temp;
}
if (n==reversed)
{
System.out.println(n +"is Pallendrome") ;
}
else
{
System.out.println("Number is not Pallendrome "+ reversed) ;
}
}
}

4. Program to Reverse a string.
import java.io.*;
public class ReverseString {
public static void main(String args[])throws Exception
{
  InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ir);
System.out.print("Enter Number: ");
String s=br.readLine();
char c[]=s.toCharArray();
int length=c.length-1;
int l=0;
char j[]=new char[c.length];
for(int i=length;i>=0;i--)
{
j[i]=c[l];
l++;
}
String st = new String(j);
System.out.println("Reversed String: "+st);
}
}

5. How to find duplicate words in a string.

import java.util.*;
public class DupSearch {
    public static void main(String args[]){
        String s="a b f e a sd g t y uf s a b d x e c ";
        List<String> list = Arrays.asList(s.split(" "));
        Set<String> uniqueWords = new HashSet<String>(list);
        for (String word : uniqueWords) {
            System.out.println(word + ": " + Collections.frequency(list, word));
        }
    }
}


6. Swap two numbers by using two variables use exception handling and function. 

import java.io.*;

public class Swapping {
public static void main(String args[])throws Exception{
    swap();
}
public static void swap()throws Exception{
    InputStreamReader ir=new InputStreamReader(System.in);
    BufferedReader br= new BufferedReader(ir);
    try{
        System.out.print("Enter the Value of A= ");
        String s=br.readLine();
        int a=Integer.parseInt(s);
        System.out.println("A= "+a);
        System.out.print("Enter the Value of B= ");
        String s2=br.readLine();
        int b=Integer.parseInt(s2);
        System.out.println("B= "+b);
        a=a*b; // a=12
        b=a/b; // b=3
        a=a/b; // a=4
        System.out.println("**** Swapping the values ****");
        System.out.println("A=> "+a);
        System.out.println("B=> "+b);
    }
    catch (NumberFormatException e){
        System.out.println("Please Enter valid Number");
        swap();
    }
}
}

Data Driven Frame Work

Data Driven Frame Work

     One of the widely used frame work  .
   
     In this frame work the whole automation process is driven by data( saved in excel,word doc or Data base)
 
     In the link below

    Key Word Driven Framework , i had explained how the key word driven frame work works

Please find the image below which is self explanatory





















In the above image we are using 2 Excel sheet

1. Driver sheet : Which drives the whole automation
2. Data Sheet : Which provides the input to the modules

Driver sheet

Name itself tells it drives the whole automation . In the above Sheet we have 2 coloumns

Module name and ExecuteFlag

Module name = Specifies the name of the module to run or name or the test case

Execute Flag =  Specifies whether the Module to be run or not ( if the value is "Y" execute the corresponding code else skip it )


Complete flow 


Let us see with an example the

We have 3 rows inside the Driver sheet , as per the above description only code related to LoginMail and SendMail as to be execute .

Steps


  1.  main() Method reads the Driver sheet
  2. Checks for Execute Flag for "Y" , if its Y , it captures the Module name 
  3. Checks with the case statement and compare with the case values , if anything is matched , it has to execute the corresponding code , Here comes the Data Sheet , This sheet can be used to give the input for the modules (in the above example we can see LoginName and Pwd required for logining in )
  4. Repeat the above steps until no rows in Driver sheet







Friday, 23 May 2014

Key Word Driven Framework

Key Word Driven Framework
Framework where for a particular test case, you would first identify a set of Keywords and then associate a method (or function) to each of these keywords.
Consider for example login flow of Face book is the case to be automated
Steps 1 . Login to Face Book
Steps 2 . Check any notifications
Steps 3 . Logout

Now we have got the steps ( taking pure modular approach we can divide the steps into modules or functions )
So there are 3 methods / functions

Test cases

  1. Login to Facebook
  2. Check the notifications
  3. Logout from Face book

Once Test cases are identified 

        Identify the Keywords ( Keywords can be any name which is easier to remember or understand)
       

  1. FBLogin 
  2. FBNotificationCheck
  3. FBLogout

Once keywords are identified next step is to associate the Keywords to Methods





Now according to the above case we need to do 3 steps
1. Create a keyword and save it somewhere
2. Develop a module 
3. Associate the keyword and the respective modules

Part of the work is done , now the flow comes to picture

Below is the list of common components or questions appears in most of the keyword driven  frameworks.
1. Where to save the Keywords and Modules

         Once the Keywords are identified we can use Excel sheet to save the Keywords, but write a 
          Method(Main() ) to open the excel sheet and get the keywords 

2. Where to save the Modules ?

         In Keyword Driven framework methods play a very important role , so You would have to built all the          necessary intelligence in the java methods so that it can read the excel sheets and call the different                  Modules/Methods based on the Keywords.

         Better we save the methods in a separate folder naming Business flow ( as per individuals interest or              project requirements)

         Build all your business flow or function intelligence here and save as separate files or single , depends            on the developer and requirements

3. Data sheet needed ? 

         It depends – To save the data we need to for the Test case to be used by the application

4. Test Scripts ( As per project requirement)
        
         You can have separate test scripts for each manual test case or a single driver script that will execute            all the test cases

below flow indicates the full flow 


















From the above figure, you can see that the generic flow of a Keyword Driven Framework is something like this -

1) MAIN Method  calls the other Methods which has code to read the excel sheet

2) The Methods called from the Main method opens the excel sheet and reads the first keyword associated with the test case.

3) Once the keyword is read from the excel sheet , It searches for the associated Methods ,Once the associated methods are identified  then the method is excuted on the application that is being tested.

4) Control returns back to main function (in Step 2) which then reads the next keyword. Steps 2 to 4 are repeated till all the keywords associated with a particular test case are called.



Now how to associate the keywords is important ( it depends on project )

If we search in the net for Key word Driven Framework . We can find wide variety of answers .
It depends on the requirements

Broadly dividing it into 2 ways

1 . Associate the keywords to a whole function or method

2 . Associate the keywords to a object level operations like
associating one key word for entering username , one for entering password , one for clicking button and so on


To Explain the above two implementation let us consider 3 test cases

TC_01= Login to Facebook , check for notification's , logout
TC_02 = Login to Facebook , check for friends request , logout
TC_03 = Login to Facebook , check for birthday notifications , logout


Associate the keywords to a whole function or method

  This is the most general format that is used in many of the places


 
   In the above diagram we can see how the associations are done

   Now when the Main method is called it opens the excel sheet , reads the first line .

  1. It captures the Test case name TC_01 , once the Test case name is captured
  2. It capture the first Keyword i.e FBLogin in this case, once the keyword is got , it checks for the associated method and execute it against the AUT
  3. Step 2 is repeated until all the keywords are done for First case ( TC_01)
  4. Once the TC_01 is done it jumps to next Test case(TC_02) and repeat the 2 step for its corresponding keywords



Associate the keywords to a object level operation

This is another method of implementation



In the above diagram we can see how the associations are done on operations level ( its self explanatory)

Now when the Main method is called it opens the excel sheet , reads the first line .


  1. It captures the BrowserType , Title , now the element is captured .
  2. Once the element is captured it checks the properties 
  3. Once the properties are captured it checks for the operations to be performed 
  4. Here the values are associated to it 


Any doubts or any extra information to be added , Please Post a comment




Thursday, 22 May 2014

[24]7 Innovation Labs.



Round - 1.

1. Tell me about youself.
2. Given an array of size n of (0,1) and k where k < n. find the minimum size sub array which contain k no od 1's
3. What are the data structure you are aware of.
4. Implement linked list using Enqueu and Dequeu.
5. Implement stack using linked list.
6. Given a linked list , find whenther it contain cycle or not.

Round - 2

1. Tell Me about yourself.
2. There is page, in selenium how do you check whether it is completely loaded or not.
3. How do you check whether page is stuck in infinite loop.
4. what are the annotation in testng.
5. How do you run dependen testcases, bulk run.
6. Write selenium to login into yahoo, with proper assertation and validation.
7. write tescase for add cart functionality of flip kart.
8. write a program to reverseing a sentance, ex "this is [24]7" o/p "[24]/7 is  this"
9. what are joins in sql, explain with a example.
10. Two table having one colummn common, fetch all the data where, table1.commomcol != table2.commoncol

Round - 3

1. Have you worked on unix.
2. Tel me some command which you have used.
3. How to see process in unix.
4. How to kill a process.
5. How do i find a pattern in a file using unix command
6. what are the diff modes of vi.
7. Given a csv file as follow
ID,Name,Address,Loc
1,a,abc,abc
2,b,abc,abc
3,c,abs,asd
1,a,abc,abc

write a program to read the file and give output only the row having id as unique

o/p

1,a,abc,abc
2,b,abc,abc
3,c,abs,asd

8. Given MxN matrix, write a program to find mim element in the matrix.


Round - 4

1. Tell me abt your self.
2. What is the duration of release in your company.
3. How do you give esitimation for the testing.
4. What if you buffer in the plan is over and you are colse to deadline.
5. We have monthly releases. Work will be little hetic, how will you manage.
6. Its SDET profile, What makes you suite for the profile.
7. Do you have any question to ask.

Round - 5 (HR)

1. Tel me about your self.
2. Why you are looking for the job.
3. The profile we are hiring for sdet and you are manual tester, why should i hire you.
4. Do you have any offer with you.
5. If you have offer with you, the what gurantee you will join us.
6. How much is your expectation..


Indicomm:


 SELENIUM

1.Write the syntax of drop down
2.What is Webdriver-Java interface
3.What is the current Version of Selinum webdriver
4.How to get the text value from text box
5.StrinG x="ABC";
  String x="ab"; does it create two objects?
6.write a program to compare the strings
7.Class a
{
}
class b extends a
{
}
A a= new A();
B b=new B();
A a= new B();
B a=new A();
Which is valid and invalid?

8.Explain webdriver architecture
9.Explain File downloading
10.Explain File attachments other that Auto IT
11.Write the syntax for finding the row count in dynamic web table
12.Differnece between class and Interface
13. What type of class is the string class
14.WHAT are the differnt methods that are used along with Xpath
15.Explain Interface
16 Explain Abstract
17.What is selenum grid
18 what is selenium RC


JAVA 

1.what is the default package in java ?
2. why we use interface why not abstract class ...what if i implements same method in interface and abstract ....then ?? any difference ??
3. what are inner classes ..name them ?
4.in public static void main(String arr[])... what if i replace public with private ........... remove static ........replace void with string
5.in hash map we have (key and value ) pair , can we store inside a value =(key, value ) again ??
5. what are variable scope in java (in class , in method , in static block)
6. what  are the oops concept ? explain them each with real world examples
7.write a program so that when ever u create a object ... u get to know how many object u have created
8. what is singleton classes ?
9.what is difference  between .equals() , (==)  and compare-to();
10. what is the difference   between hash code and equals
11.write a program to get substring of string  ex: javais good ... so result : avais
12.write a program to reverse the string
13. wap for binary search
14.what is the use of package
15. why we use interface and abstract
16.we have 2 interface both have print method , in my class i have implemented the print method , how u wil get to know that i have implemented the first interface and how u will use it .. if u want to use it
17.what is the difference between vector list and arraylist
18. difference between hashmap and hash table, what is synchronization , how it is achieved
19. what is the use of collection, when we use it
20. what is priority queue in collection , what is the use , how u have use in your project
21.where  to use hashmap and hashtable
22. where u have use the concept of interface and abstract in your framework

ROUND 1 SELENIUM 

1. how u handle the pop when u launch your website ?
2.what implementation did in your  framework for blank field or empty cell
3.how to clear the element in the text box : findelement(By.xpath("")).clear();
4.how to get the text of label : findelement(By.xpath("")).gettext();

ROUND 2 SELENIUM 

1. how to handle dynamic object
2. how to work with button which is in div tag and and u have to click without using xpath
3. JVM is dependent or independent platform
4.how many Test script you write in day
5. describe your framework
6. how to parameterized your junit
7.how to handle ssl security
8. how to handle window pops
9. diffnct between implicit and explicit
10.what are the types of assertion and what are assertion in junit

JAVA

1.JVM is dependent or independent platform
2.diffn bw hashmap and hash set, set and linkedlist, arraylist and vector list , linkedhash set and hashset
3.abstract and interface
4.throw and throws
5.how to split
6.checked and unchecked exception
7.how to work with azax aplication
8.why sring is immutable
9.wat is the retru ntype of getwindowhandles();
10.what are the types of assertion and what are assertion in java
other then that:

GENERAL AND WORK RELATED 

1. Describe your frameworks?
2. why this frameworks is called keyword driven ? where is this keyword u r using ?
3.why should i hire u ?
4. why u left your prevous company ?
5. Oracle is big brand name .. we are with small mid size company , why u want to cum in our company ?
5. tell me somthnig about our company ?
6.how to extract all the link from a web page
7.why we use xpath ? what are the locator available?
8.how to use selenium testscript for AJAX application?
9.what are the fields in bugzilla?
10.what the use of junit ? in your project?
11. How your do test unit testcases in TS? 

HCL

1st technical

From Java 

1.What is the Difference between final,finally,finalize
2.what is the difference between Call by value and call by reference
3.How to find out the length of the string without using length function
4.How to find out the part of the string from a string
5.difference between throw & throws
6.What is binding(Early and Late binding)

Programming Round

He give Programes
1.Reverse a number
2.1,2,3,4,5,65,76,5,,4,33,4,34,232,3,2323,    find the biggest number among these
3.simple string programe.
4.what is exception types of exception

From manual
1.what is the testcase technique
2.why we write test case.
3.bug life cycle
4what are the different status of bug
5what is the different between functional and smoke testing
6.what is STLC.
7.from Selenium
8.what is testng and its advantage
9.how to handle SSl/
10.how to handle alert
11.how to take screenshot
12.give the diagram write a scrpt..
13.tell me about Project .What are the challenge face during project
14.what is the difference between RC and webdriver
15.what is freamwork explain it.
16.why we use wait statement.

2nd technical
          1. he gives a application & tell to write the scenario
          2.some manual testing concepts.


All the best....

EMIDS

 INTERVIEW  FOR 2 YEARS SELENIUM TESTING POSITION.

1ST round-TECHNICAL 

• Introduce yourself tell something about your last project.
• Which framework you have used and why?
• Why automation
• How synchronization resolved in automation?
• How many wait statements you know ?
• What is polymorphism?
• Have u used constructor in WebDriver?

2nd round – TECHNICAL

• Tell me about your project and responsibilities?
• Which module u worked on ur project ?
• Tell me the flow of your framework?
• Write a java code to read the data through excel file?
• I have some reusable methods and i have some new feture,so i want to acess the reusable methods to my current application,how can i do that?
• Is it possible to write the xpath using IE browser?
• What exactly your file structure looks like when you are automating something by using of eclipse ?
• How did you verify that given number on webpage in sorted order ?
• How can i do priority based testing using webDriver ?
• Write a login code using page factory ?
• Is that necessary to creat Generic Lib. For every project?
• Write a code for screen shot ?
• Have u ever faced like You don’t have requirement document and You have to test,how wil you do that?
• Why we r using some tool for reporting?
• What is TestNg ?tell me the annotations of TestNG? (if you are using TestNG)
• Can you write a sample for parallel execution in TestNG.xml file?
• How are you maintaining the objects in your project?
• What is constructor ? what is super ()?
• What is Encapsulation?
• What is the difference between interface and abstract class?
• What is poly morphism?
• Actually X-path writing a confusion task for me, is there any way to find webElement in UI?
• How wil you capture the dynamic object using selenium webDrive?
• Tell me the syntax for Implicity wait() and Explicity wait()

3RD round-MANAGER

Gv ur intro with your roles and responsibilities?
How many bug you hv found on your project?
Can you please explain flow of your project?
4th round- Manager
Please explain your project architecture with framework with diagram?
What are the technical challanges you have faced?
If dev not accepted the bug,wat will you do?
Salary discussion?

5th & 6th round –MANAGER

Almost Repeating Questions

7th- HR ROUND

Tell me abt yourself in 3 areas (education,job,hobbies)
What are the challenges u have faced?
Some qsn from your hobby?
Some more qsns?