Browse Author: Aditya

API Testing

API stands for Application Programming Interface. API enables two separate software system to communicate with each other. API contains methods and routines used by the system that other systems call and get the result to consume in the own system.

API testing is totally different from GUI Testing and it focuses on Applications business logic layer.  This testing does not care about the look and feel of the application.

Setup of an API Environment:

Usually, setting up the API Test Environment is not that easy because it doesn’t involve any user Interface.  You need to configure the environment based on the application requirements. You need to study the web service document provided by developers and then design the setup. Using API code, you should make the specific call to API and consume the output for doing verification or other depended API calls.Output could be status (say OK or Error) or any kind of Data (object id) that to call another API method.

Ideally API should catch and handle the problem instead of just failed. If the input is not correct it will let you know the status with great detail like ‘Incorrect request” etc. In a very easy way, I can say, you send a request message to web services and after processing, web service sends you back a response based on that input. It could be ‘Bad Request’ if the message sent incorrectly and contains response in a specific structure based on the architecture of the web services. This response should contain enough information to understand the output and correct if there is some problem with the request.

To understand the API call, let’s see a basic example;

Consider, API functions, which are for an e-commerce web service cart web services;

AddItemToCart(ItemType item, float price, int count)

Once you look at the method, AddItemToCart, you need to pass an item of type ‘ItemType’, price in ‘float’ and count of items in ‘int’ data type to add items to the cart. The output should capture all output message and you need to parse them and get the desired response.

Approach to API Testing:

For say, if you going to test end to end scenario for a purchasing an item, you would be using few API calls.

  1. AddItemIntoCart()
  2. Checkout(), if Item added to Cart.
  3. MakePayment() if you are able to add the item to checkout step.
Based on output response of each API method you proceed to the Next.

API Test Tools:

There are various free and paid tools available in the market, which are specifically designed to test various API for the database application, mobile apps, desktop apps etc. You can download free tools as an extension or as standalone and access web services via the tool. These tools can emulate all or part of the environment in which the API would typically operate. It is not necessary that the tool can emulate all the API calls you need, but I am sure you will find the tool that can do most as per your need. SOAPUI, POSTMAN, Parasoft soaTest are few tools, which you can try.

Seven Steps For Successful Outsourcing

Outsourcing work to overseas is common practice to save money. Sometimes, you get the most out of your work by sending work to low cost resources. You can utilize saved money to put into various initiatives like in infrastructure, hiring skilled reviewers for code review etc. Sometime sending work to overseas can be disastrous for your company too and you can end up either incomplete project or wasting all money with no result. You may have placed all the checks at every level to make sure that project complete successfully, but later you will start noticing some unforeseen events, those you never expected, and you will pay a high price to overcome those situations. While making contracts, outsourcing companies’ sales people over promise you for your project with lowest cost and you decided to go for that. Later they start giving some genuine excuses that you cannot ignore and you pay more to fix that. As a result of that you outsourcing cost increases and it is kind of never ending process.

For a successful outsourced project, you need to take care many things, beginning from selecting the outsourcing company to getting the project delivery.

Check the background of the company you are outsourcing:

The moment you let your vendors know that you are looking for work to outsource, you will start getting proposals. Sales managers will give you presentations that they have the experience and expertise to handle this kind of project. They can do the work quickly on the lowest budget possible. Do not get into the trap of such promises. You will get what you are paying for. It doesn’t mean that you need to pay a high price to get good quality work. There are many good companies where you can get quality work out of them with lower cost. You can find about them with your reference. Ask venders to provide their client list where they have done are currently working on same nature of projects. Try to find some link in that company. LinkedIn can be a good tool to find some reference. You can contact reference to understand vendor’s work commitments and their experience with the vendor. Go through their client vendor agreement. See if they have any certification or affiliation needed for the project. There are many more, check point which can help to Choose right vendor. s

Double check with resources for the project:

Along with selecting the right vendor so you need to finalize suitable resources for the team too. Usually, project demo or proposals are prepared by pre-sales engineer or dedicated resources for new clients. They are quite the experts in doing that. Do not judge working resources and vendor based on the demo. I am not trying to be cynical, but you have to accept this truth. Ask vendors to provide the detailed resume of each resource who are going to work on the project. Check their skill set if these are meeting the minimum needed requirement. Make sure they have done similar work in the past. You may not need all resources equally skilled. choose resources considering many aspects like every aspect like technical skill, teamwork, work ethics etc.

Select the bridge between you and sourcing team:

Selecting coordinator between the team is equally important as selecting vendors and resources. You may be sending your work to another country where English is not the first language like India, China or Ukraine etc. where you can find qualified people but not expert in English. There may be some cultural differences too. You need to select someone from either side who has an experience working as coordinator in the past or have a better understanding of the culture. This will help you in the long run for the project. You should consider having least one trip to the site if budget allows or bring someone at your location to a few weeks. This will help them to understand your companies work culture and expectations from them. Coordinator can help the team based on past experience to explain the problem. Sometime its difficult to explain some critical project strategy and you need to reiterate a number of times where your coordinator can explain them on your behalf. If the vendor is working on another time zone than you coordinator needs to be involved in handling this time zone difference and keep the flow regardless of any time zone difference.

Cross Cultural Training for outsourcing team:

If your budget allows then have some money aside to have cross-cultural training. As I said in the previous section if you are outsourcing our work to another country with cultural difference then this kind of training will help you on a daily basis. They will understand how you want them to respond in any situation. Office culture in India is different as compared to US. They way of responding in email is also different for the same situation. It is very important to understand the culture of each other and these things increase the chance of success of the work. It’s not necessary if resources have good experience with working similar project.

Consider outsourcing team as a part of your team:

Treat your new team as your own team. Sometime we outsource monotonous kind of work, which your employees do not want to do like running regression tests suites on a daily basis. If this work is monotonous for your team then it could be same for them after a month or so. Try to send some interesting work too. Like every other employee they are also looking for some interesting work and learn new things. Give them window of learning new and working on interesting things will encourage them. These will help to increase the productivity of the team. Many managers feel that they outsource the project for low cost mean that they can use contractors to get the maximum work out of them. That is really a very bad strategy. Give them the opportunity to learn and welcome any kind of improvement they are offering. Consider their proposal and ask them to implement if they are capable of. Let them feel that they are equally important as other team in your company. Research shows that happy employees give maximum productivity at work.

Have Contingency Plans Ready:

Attrition is the biggest problem you should be ready to deal with. Most vendors are facing this problem with their employees. Many managers experienced 100% turn around in their team within a year. Some will not give you enough time to do knowledge transfer to replacement member. You need to prepare yourself for any unforeseen situation. Make sure you have work rotations in your team to do various kinds of task to avoid any boredom. Make sure each one of you team can do all kinds of task in case of any situation. Do not try to make a dependency on one person. Distribute the work. Periodically conduct cross-functional training in team. In case of a sudden exodus of team member you will not be impacted severely.

Well defined process:

Make sure you have defined all plans at his place. Have a well defined project process. Document points of contact that may require any kind of involvement in the project. Defined proper checkpoints for review. Have best practices and lesson learned document ready so you can save time to review. If possible, before start of project conduct training about the process. Go through all documents and explain the team how to follow the flow and how to define work-completed criteria. Try to conduct various kinds of reviews each delivered work. Have lesson-learned meeting.

Overall outsourcing work is not that easy as we think. You should consider these points as initially thought before taking decision of outsourcing. There are many more point you should consider which is actually not given here but exist and that depends upon the process you defined in past.

Please share your experience about outsourcing? Do not forget to share.

Singleton Design Pattern

Singleton Design Pattern


In some cases, it is important to have exactly one instance of a class. Although you have many electric appliance in your house but you have only one main switch box for incoming electricity in house. You have only one control panel in your windows Operating system. There is only one payroll software system to handle paychecks.

How do you ensure that you have only one instance of a class and that is also easily accessible? A global variable makes an object accessible but it does not prevent you from instantiating multiple objects.

A better solution is to make class itself responsible for keeping track of its single instance. The class can ensure that no other instance can be created and it can provide a way to access the instance. This is called Singleton Pattern.


Whenever you are looking for single point of connection to use at multiple places. Best example is logging. To access logging process in a program in various classes you don’t want to end up with creating objects of logger class and access methods. Rather you would prefer to have one instance of class and use everywhere in solution or project. Thus in Singleton pattern, Information flows in one way.


Client can access a Singleton instance solely through Singleton’s Instance operation. Instance is a class operation similar to static member function in C++.


The Singleton pattern has several benefits.

1. Controlled access to its solo instance: Singleton class encapsulates its solo instance, which has strict control over how and when client can access it.

2. Flexibility over instances: Because the class controls the instantiation process, the class has the flexibility to change the instantiation process too.


1. Overhead: Though the is minimal time but still there is some overhead involving to check whether an instance class already exists every time an object request a reference.

2. Object lifetime:


Following implementation is singleton Pattern given in MSDN

using System;
public class Singleton {
	private static Singleton instance;
	private Singleton() {}
	public static Singleton Instance {
		get {
			if (instance == null) {
				instance = new Singleton();
			return instance;

Look at the code, you will notice at line 5; class constructor is defined as private which ensures that no other object can create a new instance of this Singleton class.

This implementation has two advantages:

1. Because instance has created inside the instance property method, the class can perform another actions as well like instantiating subclasses, though it may introduce unwanted dependencies.

2. Instantiation is not performed until an object asks for the instance.

The disadvantage of this pattern is that it is not safe in multi threaded environment. If at the same time, two separate thread ask for instance, it will check at line 10 before creating a instance. At this point, there is a possibility of race condition. To avoid that, Static Initialization is the solution.

Static Initialization

public sealed class Singleton
	private static readonly Singleton instance = new Singleton();
	private Singleton() {}
	public static Singleton Instance
			return instance;

In this strategy, member of the class is creating the instance first time inside class itself. The Common Language Runtime (CLR) will take care of variable initialization. The class is marked sealed to prevent any derivation. The variable marked as read-only, which means that it can be assigned only during static initialization or in the class constructor.

For detailed implementation of Singleton Design Pattern refer the section 4.


1. Design Pattern: Element of Reusable Object-Oriented Software By: Erich Richard Ralph and John.

2. MSDN Library.