Integration Testing

Integration testing is carried out after unit testing and before integration testing when individual software units/module are combined and tested as a group. The purpose of an integration test is to expose the issues/bug that appears after the integration of separate modules. It can use any method white box, black box, and gray box testing method. It is performed by either developer themselves or by the individual tester.There are various approaches that are followed for integration test:-

Top Down Integration Test

In this approach, top level units are tested first and lower level of units are tested step by step after that. This approach is opted when top down development approach is followed. Test stubs are needed to simulate lower level units which are not developed during the initial phase of development, especially when interaction with the external environment is needed. Thus these stubs act as a temporary replacement for those modules that will be completed in future. For example, in below diagram, we know that upper modules 1,2,3 are available for integration test while below modules are still under development and thus are replaced by stubs for testing.

top_down_testingThe Top-down approach provides a consistency because integration is performed in an environment which is almost equivalent to reality But the drawback with this is that stubs sometimes are more complex to write than they seem to be and basic functionality is tested at the end of the cycle.

Bottom Up Integration test

In this approach testing flows from bottom to top, thus smaller unit integration are tested first. This approach is an option when development is done from Bottom to up. Drivers programs are created to simulate the main module. Thus these driver programs act as a replacement for the main module if they are not developed.
bottom_up_testing

In this approach development and testing can be done together so that product will be efficient as per customer requirement but in this driver, the module must be produced and the program as an entity does not exist until the last module is developed.

Stubs and Drivers

Stubs and Drivers are two types of test harness i.e, they are the collection of software and test data which is configured so that we can test a program unit by simulating the different set of conditions while monitoring the behavior and outputs. They both are dummy modules which are just created for test purpose.

Why do we have stubs?

Suppose we have a function
Function A:– Calculates the total marks obtained by a student in an academic year and its derive its value from another Function B.
Function B:– Calculates the marks obtained in a particular subject.

Now you have finished working on Function A and wants to test it. But the problem you will face is that you cannot test Function A until you have inputs from Function B. And Function B is still under development.
In this scenario, you have to create a dummy function to replace Function B to test your function. This dummy function gets called by another function. Such a dummy is called a Stub. Also, you can see that since Function A is dependent on function B and Function A is developed earlier, which means we are following top-down testing approach. So in a simple language stubs are “called” programs, which are called in to test the major module’s functionality.
To understand why we need a driver, suppose we are finished with Function B and is waiting for Function A to be developed. In this case, we will create a dummy to call the Function B. This dummy is called the driver. Drivers are thus the ones, which are the “calling” programs. Drivers are used in bottom-up testing approach. Drivers are dummy code, which is used when the sub-modules are ready but the main module is still not ready.

User Acceptance testing (UAT)

Acceptance testing is carried out to test if the contract between customer and developer is still on track. It ensures that software product met all customer requirement and changes that happened during the development phase.

It is useful because:-
  • It allows customer to verify the product
  • Identify the issue or provide suggestion which unit or integration test cannot.

A product is said to pass acceptance testing successfully after fulfilling these criteria:- timely delivery, performance, scalability and upgradeability, functional correctness and completeness, requirement completion etc.

An acceptance test is a level of software testing and its purpose is to evaluate whether a product is acceptable for delivery. Let me explain it with an example of a desktop machine. During the process of manufacturing a keyboard, mouse, monitor, CPU and others are developed separately and thus unit tested separately. When two or more unit is ready then they are assembled and again tested, so integration test is performed. When the complete desktop is integrated, system test is performed. Once system test is completed, the acceptance testing is performed to ensure that the desktop is ready as per the requirement of an end user.

There are several roles that are involved in acceptance test:-

Alpha Acceptance testing

This is performed by the organization who developed the application but were not directly involved in the development (developer). They can be managers, sales person or anyone else from the organization who will verify the product created in accordance with client requirement. This testing is done before beta testing to find out any possible issues/bugs before releasing product to the client. Alpha testing uses both white box and black box testing, issues are usually fixed immediately by developers, ensures product quality before moving to beta testing and it is carried on the test environment.

User Acceptance (Beta) testing

This testing is performed by an end user of the software, the product is released to some of the end-users (a limited number of user) to perform the testing on real environment, this reduces the risk of issues/bugs that other end-users might find after full product delivery. It takes direct feedback from customer thus it adds an advantage to product quality delivery. Beta testing mainly uses black box testing, most of the issues or suggestion collected will then be implemented in the future version, and it is to make sure that product is ready for real time users.

Unit Testing

Unit testing is performed on the smallest testable part of the application like methods, class etc. A Unit test is mainly carried out by developers or can also be carried by software tester. This mainly involves writing the test case of application in the same language which is used for development or there are some framework that provides the structure to write the test case and execute them effectively like we have PHP Unit in PHP for writing unit test cases. These are thus programs written in batches or test files and are verified with some input and with their expected output. A unit test is a key component of software programming, its permit the easy code changes with minimal time for the test at later stages of development.

Why is unit testing important?

Suppose you develop two module unit1 and unit2 and you neither performed unit test nor integration test and you keep modifying them. At the time of final delivery of product you found an issue, now where can the issue be:-

  • It could be a bug with unit1
  • It could be a bug with unit2
  • It could be a bug with both unit1 and unit2
  • It could be a bug in the interface that manages unit1 and unit2

Now you need to debug all your code, but if a unit test was carried out these issues can have resolved earlier (might be they never appeared), or at least you would have known where the issue is, by executing your test cases.

Unit testing is often neglected but it is the most important part of testing especially in a big project where multiple developers are working on the various module. Unit test is the first level of testing and is performed before integration test can be done, it is performed by using white box testing method.

Pros of Unit testing:-

  • It helps in finding a bug at an early stage of development and also helps to recognize if there is any flaw in the implementation of the specification.
  • The process of writing test cases forces a developer to think about the multiple scenarios of errors with various inputs and output conditions. Thus it also forces a developer to write function and object in a structured way, making code reusable and more modular.
  • Development is faster initially, you may find it tedious or may feel that writing the test case is an extra overhead for you but later on when you make any modification in your code and wants to test then you need not enter various input combination again and again, just you need is to execute your test case. Efforts required to fix a bug during the unit testing is less in comparison to that of defects detected at a higher level.
  • Debugging is easy, as already given example above unit test makes debugging easy for you by providing you the precise region or module where an error is related too.

Software testing – Overview

Software testing is a process to identify the issues or bug of developed software. It is a way to test the correctness, completeness, quality and validity of requirements and efficiency of the application. Software bug can be very dangerous if we talk about embedded programming. There are lots of examples of the software failure that report the loss of life and finance. For example:-

  1. Screwfix price glitch

Price glitch in e-commerce companies is the most common one. Once Screwfix had a price glitch on their website which made the customer to buy a product at 34.99 euros. From garden tractor to expensive toll were available at same price. This could be avoided if automation testing would have been done as this was a data validation error and required a redo of testing.

  1. False Alarm would have caused world war III

In 1983, a false alarm could have caused world war III. There was a software glitch which generated wrong alarm indication missile launches by the US. Soviet early warning system Oko reported that the US has fired a missile against the Soviet Union, it reported five successive alarm launch. Petrov smart decision prevented the confusion as he knows that the system was programmed and setup a year ago so they could not totally rely on its alarm.

  1. Terac-25 machine glitch

From 1985-1986, Canada’s Terac-25 a radiation therapy machine malfunction due to a software glitch and delivered overdose radiation leaving 3 people died and some injured. The FDA declared the machine as defective. AECL then issued several software patches and updates which then allowed the machine to return to service. Though there was an issue with the software but the root cause was the entire design.

So, as it can be seen from above examples testing of software is very important to prevent any danger or expensive loss. We all should follow certain software development life-cycle, all of them focus on testing and helps to deliver the final product as bug-free or with the minimal bug.

Software Testing Myth

Being in an IT company I have seen that most of us do not take testing as a priority. Even some of the developer are so smart that they code directly on production and finally clients’ needs to suffer. There are several myths and wrong beliefs associated with testing among client and developers:-

  1. Testing is too expensive and time-consuming

Testing an application in modular form is never expensive rather it is fruitful. Also, some of us consider that testing should be done once the product is fully developed, there is no doubt final testing will  be good but testing product simultaneously during development and creating test case will reduce time to test in future. As prevention is better than cure, fixing the bug or changing the implementation later may severely impact on project timely delivery. Testing a product during the development phase is very important to prevent any future issues which will take more time to fix later on.

  1. A tested software is bug-free

Here the question arises, if tested software is not bug-free then what’s the need to put an extra overhead of testing. Well, nothing is 100% accurate so the software is, there is always a chance of improvement. No one can claim that the software is 100% bug-free even if it is tested by experts. Complete testing is never possible as there might be various test cases that are never executed. We cannot always blame tested if there is some software glitch that occurs in the later stage of software. However, we can make sure about the test strategy that testing team is following to maximize the accuracy level.

  1. Anyone can test a software application

Most of the companies do manual testing and specifically the just test design issues, which should not be the case. If a person is technically good then he can test the application efficiently and can explore and report bugs considering all possible alternative approach. Also, tester task is not just to find the bugs but also to suggest improvement as per market trends in an application, as they are domain experts of that particular software.

Before any product is released to end-user, it should undergo a testing process to ensure that the product is working in the same manner as intended. There are mainly four stages of testing that needs to be completed before a product is ready to use: Unit test, integration test, system test, and acceptance test.

Testing

 

Unit testing is performed on the smallest testable part of the application like methods, class etc. A Unit test is mainly carried out by developers or can also be carried by software tester. Continue Reading

Integration testing is carried out after unit testing and before integration testing when individual software units/module are combined and tested as a group. Continue Reading

Acceptance testing is carried out to test if the contract between customer and developer is still on track. It ensures that software product met all customer requirement and changes that happened during the development phase. Continue Reading