Pages

Saturday 28 February 2015

Testing Concepts

15. What are the Structure-based (white-box) testing techniques?
Structure-based testing techniques (which are also dynamic rather than static) use the internal structure of the software to derive test cases. They are commonly called 'white-box' or 'glass-box' techniques (implying you can see into the system) since they require knowledge of how the software is implemented, that is, how it works.
For example, a structural technique may be concerned with exercising loops in the software. Different test cases may be derived to exercise the loop once, twice, and many times. This may be done regardless of the functionality of the software.

16. What are the Experience-based testing techniques?
In experience-based techniques, people's knowledge, skills and background are a prime contributor to the test conditions and test cases. The experience of both technical and business people is important, as they bring different perspectives to the test analysis and design process.
Due to previous experience with similar systems, they may have insights into what could go wrong, which is very useful for testing.






Java Questions

What is the Difference between Enumeration and Iterator interface?
Enumeration and Iterator are the interface available in java.util package. The functionality of Enumeration interface is duplicated by the Iterator interface. New implementations should consider using Iterator in preference to Enumeration.
Iterators differ from enumerations in following ways:
Enumeration contains 2 methods namely
·        hasMoreElements()
·        nextElement()
whereas Iterator contains three methods namely
·        hasNext(),
·        next(),
·        remove().
Iterator adds an optional remove operation, and has shorter method names. Using remove() we can delete the objects but Enumeration interface does not support this feature.
Enumeration interface is used by legacy classes. Vector.elements() & Hashtable.elements() method returns Enumeration. Iterator is returned by all Java Collections Framework classes. java.util.Collection.iterator() method returns an instance of Iterator.

What are transient variables? What role do they play in Serialization process?
The transient keyword in Java is used to indicate that a field should not be serialized. Once the process of de-serialization is carried out, the transient variables do not undergo a change and retain their default value. Marking unwanted fields as transient can help you boost the serialization performance.

Friday 27 February 2015

Testing Concepts

13. Consider the following techniques. Which are static and which are dynamic techniques?
Equivalence Partitioning.
Use Case Testing.
Data Flow Analysis.
Exploratory Testing.
Decision Testing.
Inspections.
Data Flow Analysis and Inspections are static; Equivalence Partitioning, Use Case Testing, Exploratory Testing and Decision Testing are dynamic.
14. What is the role of moderator in review process?
The moderator (or review leader) leads the review process. He or she determines, in co-operation with the author, the type of review, approach and the composition of the review team.
The moderator performs the entry check and the follow-up on the rework, in order to control the quality of the input and output of the review process.
The moderator also schedules the meeting, disseminates documents before the meeting, coaches other team members, paces the meeting, leads possible discussions and stores the data that is collected.


JAVA QUESTIONS

What is the difference between java.util.Iterator and java.util.ListIterator?
Iterator : Enables you to traverse through a collection in the forward direction only, for obtaining or removing elements
ListIterator : extends Iterator, and allows bidirectional traversal of list and also allows the modification of elements.
What is Metadata and why should I use it?
JDBC API has 2 Metadata interfaces
·        DatabaseMetaData
·        ResultSetMetaData.
 The DatabaseMetaData provides Comprehensive information about the database as a whole. This interface is implemented by driver vendors to let users know the capabilities of a Database Management System (DBMS) in combination with the driver based on JDBC technology ("JDBC driver") that is used with it. Below is a sample code which demonstrates how we can use the DatabaseMetaData

DatabaseMetaData md = conn.getMetaData();
 System.out.println("Database Name: " + md.getDatabaseProductName());
 System.out.println("Database Version: " + md.getDatabaseProductVersion());
 System.out.println("Driver Name: " + md.getDriverName());
 System.out.println("Driver Version: " + md.getDriverVersion());
The ResultSetMetaData is an object that can be used to get information about the types and properties of the columns in a ResultSet object. Use DatabaseMetaData to find information about your database, such as its capabilities and structure. Use ResultSetMetaData to find information about the results of an SQL query, such as size and types of columns. Below a sample code which demonstrates how we can use the ResultSetMetaData
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
     ResultSetMetaData rsmd = rs.getMetaData();
     int numberOfColumns = rsmd.getColumnCount();

     boolean b = rsmd.isSearchable(1);

Thursday 26 February 2015

Testing concepts

11. What is random/monkey testing? When it is used?

Random testing often known as monkey testing. In such type of testing data is generated randomly often using a tool or automated mechanism. With this randomly generated input the system is tested and results are analyzed accordingly. These testing are less reliable; hence it is normally used by the beginners and to see whether the system will hold up under adverse effects.

12. Which of the following are valid objectives for incident reports?

Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary.
Provide ideas for test process improvement.
Provide a vehicle for assessing tester competence.
Provide testers with a means of tracking the quality of the system under test. 








JAVA QUESTIONS

What is the difference between creating String as new() and literal?
When we create string with new() Operator, it’s created in heap and not added into string pool while String created using literal are created in String pool itself which exists in PermGen area of heap.
String s = new String("Test");
does not  put the object in String pool , we need to call String.intern() method which is used to put  them into String pool explicitly. its only when you create String object as String literal e.g. String s = "Test" Java automatically put that into String pool.
What does Class.forName() method do?
Method forName() is a static method of java.lang.Class. This can be used to dynamically load a class at run-time. Class.forName() loads the class if its not already loaded. It also executes the static block of loaded class. Then this method returns an instance of the loaded class. So a call to Class.forName('MyClass') is going to do following
·        Load the class MyClass.
·        Execute any static block code of MyClass.
·        Return an instance of MyClass.

JDBC Driver loading using Class.forName is a good example of best use of this method. The driver loading is done like this
Class.forName("org.mysql.Driver");
All JDBC Drivers have a static block that registers itself with DriverManager and DriverManager has static initializer method registerDriver() which can be called in a static blocks of Driver class. A MySQL JDBC Driver has a static initializer which looks like this:
static {
    try {
        java.sql.DriverManager.registerDriver(new Driver());
    } catch (SQLException E) {
        throw new RuntimeException("Can't register driver!");
    }
}
Class.forName() loads driver class and executes the static block and the Driver registers itself with the DriverManager.


Wednesday 25 February 2015

Testing Concepts

9. What is component testing?

Component testing, also known as unit, module and program testing, searches for defects in, and verifies the functioning of software (e.g. modules, programs, objects, classes, etc.) that are separately testable. Component testing may be done in isolation from the rest of the system depending on the context of the development life cycle and the system. Most often stubs and drivers are used to replace the missing software and simulate the interface between the software components in a simple manner. A stub is called from the software component to be tested; a driver calls a component to be tested.

10. What are the different Methodologies in Agile Development Model?

There are currently seven different agile methodologies that I am aware of:
Extreme Programming (XP)
Scrum
Lean Software Development
Feature-Driven Development
Agile Unified Process
Crystal
Dynamic Systems Development Model (DSDM) 


JAVA QUESTIONS

What is Anonymous Inner Classes?
As the name suggests ,  word anonymous means not identified with name. So, there is no name of the anonymous inner classes , and their type must be either a subclass of the named type or an implementer of the named interface.
Example of Anonymous class below  :
class Apple {
    public void iphone() {
        System.out.println("iphone");
    }
}
class Mobile {
    Apple apple = new Apple() {
        public void iphone() {
            System.out.println("anonymous iphone");
        }
    };
An anonymous inner class is always treated like a statement in the class code , and remember to close the statement after the class definition with a curly brace. It is rare to found the curly braced followed by semi colon in java .
When finally block is NOT called?
Finally is the block of code that executes always. The code in finally block will execute even if an exception is occurred. Finally block is NOT called in following conditions
If the JVM exits while the try or catch code is being executed, then the finally block may not execute. This may happen due to System.exit() call.
if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.
If a exception is thrown in finally block and not handled then remaining code in finally block may not be executed.

Tuesday 24 February 2015

Testing Concepts

7. What qualities would you look for while hiring a test engineer?

- Test to break attitude
- Ability to put self in customer's shoes
- Desire for quality and attention to details.
- Tact and diplomacy while dealing with others.
 
- Ability to communicate on technical lines with development team and on non-technical lines with the customer.
- Good understanding of SDLC
- Good judgment skills are needed to assess high-risk areas of an application.

 8. Rapid Application Development?

Rapid Application Development (RAD) is formally a parallel development of functions and subsequent integration. Components/functions are developed in parallel as if they were mini projects, the developments are time-boxed, delivered, and then assembled into a working prototype. This can very quickly give the customer something to see and use and to provide feedback regarding the delivery and their requirements. Rapid change and development of the product is possible using this methodology. However the product specification will need to be developed for the product at some point, and the project will need to be placed under more formal controls prior to going into production.


What is Marker interface? How is it used in Java?
The marker interface is a design pattern, used with languages that provide run-time type information about objects. It provides a way to associate metadata with a class where the language does not have explicit support for such metadata. To use this pattern, a class implements a marker interface, and code that interact with instances of that class test for the existence of the interface. Whereas a typical interface specifies methods that an implementing class must support, a marker interface does not do so. The mere presence of such an interface indicates specific behavior on the part of the implementing class. There can be some hybrid interfaces, which both act as markers and specify required methods, are possible but may prove confusing if improperly used.
 Java utilizes this pattern very well and the example interfaces are:
·        java.io.Serializable
·        java.rmi.
·        java.lang.
·        javax.servlet.SingleThreadModel
·        java.util.EvenListener
The "instanceof" keyword in java can be used to test if an object is of a specified type. So this keyword in combination with Marker interface can be used to take different actions based on type of interface an object implements.

What is the difference between final, finally and finalize?
 “final” is the keyword to declare a constant AND prevents a class from inherting subclasses. And overriding  super class methods.
“finally” is a block of code that always executes when the try block is finished, unless System.exit() was called.
“finalize()” is an method that is invoked before an object is discarded by the garbage collector.

Monday 23 February 2015

Testing Concepts

5. What do you mean by following?

a.)  Test Script:
- It is usually used to refer to the instructions for a particular test that will be carried out by an automated test tool.

b.) Test Specification:
- This is a document specifying the test approach for a software feature or combination or features and the inputs, predicted results and execution conditions for the associated tests.

c.) Test Suite:
- This is a collection of tests which are used to validate the behavior of an application or product.
- Usually a test Suite is a high level concept, grouping together hundreds or thousands of tests related by what they are intended to test.

6. What are 5 common problems in the software development process?

1. Bad requirements - these requirements are unclear, incomplete, too general, or not testable. They cause problems.
2. Unrealistic schedule - Expecting too much result in too less time.
 
3. Inadequate testing - lack of testing causes problem as no one knows if the system will behave as expected.
 
4. Adding new features - after development; quite common.
 
5. Poor communication within the team or with the customer.

JAVA QUESTIONS

What is difference between Executor.submit() and Executer.execute() method ?

There is a difference when looking at exception handling. If your tasks throws an exception and if it was submitted with execute this exception will go to the uncaught exception handler (when you don't have provided one explicitly, the default one will just print the stack trace to System.err). If you submitted the task with submit any thrown exception, 
checked exception or not, is then part of the task's return status. For a task that was submitted with submit and that terminates with an exception, the Future.get() will re-throw this exception, wrapped in an ExecutionException.


Define Serialization? What do you mean by Serialization in Java?

Serialization is a mechanism by which you can save or transfer the state of an object by converting it to a byte stream. This can be done in java by implementing Serialiazable interface. Serializable is defined as a marker interface which needs to be implemented for transferring an object over a network or persistence of its state to a file. Since its a marker interface, it does not contain any methods. Implementation of this interface enables the conversion of object into byte stream and thus can be transferred. The object conversion is done by the JVM using its default serialization mechanism.

DAY:4
What is Marker interface? How is it used in Java?
The marker interface is a design pattern, used with languages that provide run-time type information about objects. It provides a way to associate metadata with a class where the language does not have explicit support for such metadata. To use this pattern, a class implements a marker interface, and code that interact with instances of that class test for the existence of the interface. Whereas a typical interface specifies methods that an implementing class must support, a marker interface does not do so. The mere presence of such an interface indicates specific behavior on the part of the implementing class. There can be some hybrid interfaces, which both act as markers and specify required methods, are possible but may prove confusing if improperly used.
 Java utilizes this pattern very well and the example interfaces are:
·        java.io.Serializable
·        java.rmi.
·        java.lang.
·        javax.servlet.SingleThreadModel
·        java.util.EvenListener
The "instanceof" keyword in java can be used to test if an object is of a specified type. So this keyword in combination with Marker interface can be used to take different actions based on type of interface an object implements.

What is the difference between final, finally and finalize?
 “final” is the keyword to declare a constant AND prevents a class from inherting subclasses. And overriding  super class methods.
“finally” is a block of code that always executes when the try block is finished, unless System.exit() was called.
“finalize()” is an method that is invoked before an object is discarded by the garbage collector.


Sunday 22 February 2015

Testing Concepts

5. What do you mean by following?

a.)  Test Script:
- It is usually used to refer to the instructions for a particular test that will be carried out by an automated test tool.

b.) Test Specification:
- This is a document specifying the test approach for a software feature or combination or features and the inputs, predicted results and execution conditions for the associated tests.

c.) Test Suite:
- This is a collection of tests which are used to validate the behavior of an application or product.
- Usually a test Suite is a high level concept, grouping together hundreds or thousands of tests related by what they are intended to test.

6. What are 5 common problems in the software development process?


1. Bad requirements - these requirements are unclear, incomplete, too general, or not testable. They cause problems.
2. Unrealistic schedule - Expecting too much result in too less time.
 
3. Inadequate testing - lack of testing causes problem as no one knows if the system will behave as expected.
 
4. Adding new features - after development; quite common.
 
5. Poor communication within the team or with the customer.

JAVA QUESTIONS

What is Immutable Object? Can you write Immutable Class?

Immutable classes are Java classes whose objects can not be modified once created. Any modification in Immutable object result in new object. For example String is immutable in Java. Mostly Immutable classes are also final in Java, in order to prevent sub classes from overriding methods, which can compromise Immutability. You can achieve same functionality by making member as non final but private and not modifying them except in constructor. Apart form obvious, you also need to make sure that, you should not expose internals of Immutable object, especially if it contains a mutable member. Similarly, when you accept value for mutable member from client e.g.java.util.Date, use clone() method keep separate copy for yourself, to prevent risk of malicious client modifying mutable reference after setting it. Same precaution needs to be taken while returning value for a mutable member, return another separate copy to client, never return original reference held by Immutable class

What is the difference between creating String as new() and literal?

When we create string with new() Operator, it’s created in heap and not added into string pool while String created using literal are created in String pool itself which exists in PermGen area of heap. For example, String str = new String("Test")does not put the object str in String pool , we need to call String.intern() method which is used to put them into String pool explicitly. its only when you create String object as String literal e.g. String s = "Test" Java automatically put that into String pool. By the way there is a catch here, Since we are passing arguments as "Test", which is a String literal, it will also create another object as "Test" on string pool.


Saturday 21 February 2015

Testing Concepts

1. How do drivers and stubs relate to manual testing?

- Drivers and stubs are a part of incremental testing.
- The two approaches used in incremental testing are: the top down and the bottom up methods.
- Drivers are used for the bottom up approach.
- Drivers are the modules that run the components that are being tested.
- A stub is used for the top down approach.
- It is a replacement of sorts for a component which is used to test a component that it calls.

2. Explain the following mentioned testing types?

a.) Stress testing: 
- It checks the robustness of application.
- It verifies that application consistently provides satisfactory performance under unfavorable and extreme conditions. This includes - heavy user traffic, heavy process loads, irregular hardware clocking, and heavy utilization of resources.
 
- Stress testing is also useful in verifying the effectiveness of error handling under extreme conditions.
b.) Sanity testing:
- Sanity testing is used to ensure that multiple or conflicting functions or variables do not exist in the system.
- It verifies that the components of the application can be compiled without a problem.
- It is conducted on all parts of the application.
c.) Ad hoc testing:
- It is a type of testing that is performed without the use of planning and/or documentation.
- These tests are run only one time unless a defect is found.
 
- If defect is found, testing can be repeated.
 
- It is considered to be a part of exploratory testing.
d.) Smoke testing:
- Smoke testing covers all of the basic functionality of the application.
- It is considered as the main test for checking the functionality of the application.
- It does not test the finer details of the application.

JAVA QUESTIONS

What will happen if we put a key object in a HashMap which is already there?

If you put the same key again than it will replace the old mapping because HashMap doesn't allow duplicate keys. Same key will result in same hashcode and will end up at same position in bucket. Each bucket contains a linked list of Map.Entry object, which contains both Key and Value. Now Java will take Key object form each entry and compare with this new key using equals() method, if that return true then value object in that entry will be replaced by new value.


What is difference between StringBuffer and StringBuilder in Java ?

StringBuffer:

StringBuffer is mutable means one can change the value of the object . The object created through StringBuffer is stored in the heap .  StringBuffer  has the same methods as the StringBuilder , but each method in StringBuffer is synchronized that is StringBuffer is thread safe . Due to this it does not allow  two threads to simultaneously access the same method . Each method can be accessed by one thread at a time . But being thread safe has disadvantages too as the performance of the StringBuffer hits due to thread safe property . Thus  StringBuilder is faster than the StringBuffer when calling the same methods of each class.

String Buffer can be converted to the string by using  toString() method.

StringBuffer demo1 = new StringBuffer("Hello") ;

demo1=new StringBuffer("Bye");

StringBuilder:

StringBuilder  is same as the StringBuffer , that is it stores the object in heap and it can also be modified . The main difference between the StringBuffer and StringBuilder is that StringBuilder is also not thread safe.

StringBuilder is fast as it is not thread safe . 

StringBuilder demo2= new StringBuilder("Hello");


demo2=new StringBuilder("Bye"); 

Friday 20 February 2015

Testing Concepts

3. Explain the following.

a.) Compatibility testing:
- It is a non-functional test performed on a software system or component for checking its compatibility with the other parts in the computing environment. 
- This environment covers the hardware, servers, operating system, web browsers, other software, etc.

b.) Integration testing:
- This test is performed to verify the interfaces between system components, interactions between the application and the hardware, file system, and other software. 
- A developer can also perform it.
- Ideally an integration testing team should perform it.

4. Explain the following.

a.) Code Complete:
- Phase of development where functionality is implemented in entirety with only bug fixes remaining.
- All functions from the functional specifications are already implemented.

b.) Code Coverage:
- This is an analysis method which determines which parts of the software have already been covered by the test case suite and which are remaining. 

c.) Code Inspection: 
- A formal testing technique where the programmer reviews source code with a group who ask questions analyzing the program logic, analyzing the code with respect to a checklist of historically common programming errors, and analyzing its compliance with coding standards.



Application Architectures

Application  Architectures
Applications are developed  to suport org in their business operations.Applications accept input,process the data based on business rules,and provide data as output. The functions performed by an application can be divided into three categories.They are
1.      User Services
2.      Business Services
3.      Data Services.
Each category is implemented as a layer in an application.
User Services :
            The user service layer constitutes the froent end of a solution.it is also called a presentation layer because it provides an interactive user interface.

Business Services :
            The business service layer controls the enforcement of business rules on the data of an org.
Data Services :
            The data service layer comprises the data and the functions for manipulating this data.

Types of  Application Architectures :
  1. Single-tier Architecture
  2. Two-tier Architecture
  3. Three-tier Architecture
  4. N-tier Architecture


Single-tier Architecture :
      In the case of single-tier architecture,a single executable file handles all functions relating to the user,business,and data services layers.Such an application is called a Monolithic application.Some of the very early COBOL programms performing extermely mission-critical opperations fall under this category.




 






Single-tier Architecture





Two-tier Architecture :
      The Two-tier architecture divides an application into following two components :
                  Client  : Implements the user interface.
                  Server : Stores Data.




 















Two-tier Architecture


In the case of two-tier architecture, the user and the data services are located separately,either on the same machine or on saperate machines.For Example  You might have an VB application ,Which provides the user interface and SQL Server 7.0 which manages data.
      In the two-tier archicturethe business service layer may be implemented in one of the following ways.
      By using FAT Client

      By Using FAT Sever

By Dividing the business services between the user services and the data services.
FAT Client :
                  In the case of fat clients the business service layer is combined with the user service layer.Clients execute the presentation logic and enforce business logic.The Server stores data and processes transactions.
     

FAT Sever :

                        In the two-tier archicture with a fat server, the business services layer is combined with the data services layer.As business services are  stored on theserver,most of the processing takes place on the server.



By Dividing the business services between the user services and the data services:
                  You can also implement a two-tier model in which the business services are distributed between the user sevices and data services.In this case the processing of business logic is distributed between the user and data services.

Three-tier Architecture :

                  In the case of three-tier architecture,all the three service layers reside separately,either on the same machine or on different machines.The user interface interacts with the business logic.The business logic validates the data sent by the interface and forwards it to the database if it conforms to the requirements. The froent-end only interacts with business logic,which inturn interacts with the database.

 







Three-tier Architecture


N-tier Architecture :
                  An n-tire application uses business objects for handling business rules and data access.It has multiple servers handling business services.This application architecture provides various advantages over other types of application architectures. Some of the advantage include extensibility,resilience to change,maintainability,and scalability of the application.