How To Work Unit Testing Unveiled: Levels & Techniques

The system development phases involve many activities where chances of human errors are huge with unit testing. Logical error, carelessness, improper communication, the need to hurry through the whole process of software development due to time constraint, cost constraint etc.

The system must be tested thoroughly so that such errors are detected and corrected ae soon as possible. The systems are not designed as entire system and they are not tested as a single system. Tests are frequently grouped by where they are added in the system development process, or by the level of specificity of the test.

 Unit Testing: Overview

unit testing, Techniques

In unit testing, the analyst tests the programs, which makes up a system. It is also known as program testing or module testing. Unit testing focuses on the modules to find the errors. This enables the tester to detect errors in coding and logic that is contained within that module alone.

For Example, A hotel Information System have modules such as to handle reservation, guest check-in and check-out, restaurant, room service, and account billing and so on. Unit testing can be performed bottom up, that is starting with the smallest and lowest level modules and proceeding one at a time.

Advantages of Unit Testing:

  • More reusable code and easier debugging.
  •  Reduced cost for testing and bug-fixing.
  •  Increased efficiency of code improvement and maintenance.
  • Simplified interaction due to separate and complex modules testing.
  •  Errors can be detected at the early stages of the SDLC

Disadvantages of Unit Testing

  • It’s difficult to write quality unit tests and the whole process can be time-consuming. Human factor.
  • A developer can make a mistake that will impact the whole system.
  • Not all errors can be detected, since every module it tested separately and later different integration bugs may appear.

Integration Testing: Overview:

A System is made up of multiple components or modules that can comprise hardware and software. Integration is defined as the set of interactions among components.

Testing the interaction between the modules and interaction with other systems externally is called integration testing.

Integration testing starts when two of the product components are available and end when all components interfaces have been tested.

The final round of integration involving all components is called Final Integration Testing (FIT), or system integration.

Integration Testing as A Type of Testing:

Integration testing means testing of interfaces. When we talk about interfaces, there are two types of interfaces that have to be kept in mind for proper integration testing. They are internal interfaces and exported or external interfaces.

Internal interfaces are those that provide communication across two modules within a project or product, internal to the product, and not exposed to the customer or external developers.

Exported interfaces are those that are visible outside the product to third party developers and solution providers.

There are several method of integration testing which are as follows :

1. Top-Down Integration: Integration testing involves testing the topmost component interface with other components in same order as you navigate from top to bottom, till you cover all the components. In Top to down approach, testing takes place from top to down following the control flow of the software system.

Advantages of Top-Down Integration Testing:

  • Easily faults or errors can be detected in this approach. Crucial modules are tested thoroughly and prior to other modules. Software system integration testing can be done in less time as when compared with other approaches.

Disadvantages of Top-Down Integration Testing:

  •  Bottom level modules may not be tested to the expected level or may not be tested to the requirements. Stubs are needed and are required for the testing process to progress further.

2. Bottom-Up Integration: Bottom-up integration is just opposite of top-down integration, where the components for a new product development become available in reverse order, starting from the bottom.

– In the bottom-up strategy, each module at lower levels is tested with higher modules until all modules are tested. It takes help of Drivers for testing.

Advantages of Bottom-Up Integration Testing:

  • Development of individual modules can be done while the integration testing bottom- up approach is being used, as the coupling and integration testing is done after the bottom level modules are tested first.
  • If some error exists/arises, it can be fixed at the same time and at the same level. The error identification and correction are much easier than other approaches.
  • Time required for error identification and error correction is much less as compared with other approaches. Errors can be solved at the same instance bottom level or at the top level.

Disadvantages of Bottom-Up Integration Testing:

  • Time taken for the whole process is more, the process of testing does not finish till all the modules of both, the top and the bottom level are included and tested. Drivers are necessary to call the high-level modules.
  • If the software system contains, more and more small, but complex modules, it may take more time for completion of the software testing process.

Techniques: Graph based & Path based

Techniques

Graph Based: Graph is one of the most widely used structures. It is a well-defined structure which makes the testing or case studies easier. It is considered as an effective way to determine the systematic test selection of . system. This model is used to represent the desired information to be captured collected.

Next, the information to be shared is also presented and easily understood by the testers For graph-based testing firstly, the tester is asked to collect the data for graph model and then cover all the elements for a particular graph.

In this process of testing, the tester is first assigned by the responsibility of creating a graph followed by other steps.

  1. Build the graph model
  2. ldentitify the test/major requirements
  3. Select the path to cover those requirements
  4. Select the data to be entered.
  5. This graph is helpful in certain circumstances: To determine the e present problem so that decision can be taken fast.
  6. To recognize the main cause of a problem.

Advantages of using cause effect graph are as follows:

  • It highlights the area from which the data is taken and can be taken for additional studies.
  •  It helps in motivating the team.
  •  The data is arranged in such manner that even a non-technical person can also read it.
  • It helps in detecting the reason of differences occurred in a process.
  •  It helps the team to decide the root reason of a problem.
  • It is very appropriate for large systems.

Disadvantages of using cause effect graph are as follows:

  • Difficult to design.
  • It is difficult to choose the important input in limited time.
  • There can be chances where path of drawing the graphs is not clear
  • There are chances of repetition of data already entered in the graph.
  • Path testing is a structural testing method that involves using the source code of a It helps to determine all faults lying within a piece of code.
  • This method is designed to execute all or selected path through a computer program.
  • Any software program includes, multiple entry and exit points In order to reduce the redundant tests and to achieve maximum test coverage, basis path testing is used.
  • Basis Path Testing in software engineering is a White Box Testing method in which test cases are defined based on flows or logical paths that can be taken through the program.
  • The objective of basis path testing is to define the number of independent paths, so the number of test cases needed can be defined explicitly to maximize test coverage.
  • Basis path testing involves execution of all possible blocks in a program and achieves maximum path coverage with the least number of test cases. It is a hybrid method of branch testing and path testing methods.

Steps for Basis Path testing:

The basic steps involved in basis path testing include- Draw a control graph (to determine different program paths) Calculate Cyclomatic complexity (metrics to determine the number of independent. paths) Find a basis set of paths Generate test cases to exercise each path.

Advantages of Basic Path Testing:

  • It helps to reduce the redundant tests.
  • It focuses attention on program logic.
  • It helps facilitates analytical versus arbitrary case design.
  • Test cases which exercise basis set will execute every statement in a program at least.

Disadvantages of Basic Path Testing:

  • Presence of defects cannot be traced out by the path testing due to an error in the specifications.
  • Path testing requires expert and skillfully testers, with in-depth knowledge of programming and code.
  •  It is difficult to test all paths with this type of testing technique when the product becomes more complex.

 Functional Testing:

This is a type of black-box testing that is based on the specifications of the software that is to be tested. The application is tested by providing input and then the results are examined that need to conform to the functionality it was intended for.

Functional testing of a software is conducted on a complete, integrated system to evaluate the system’s compliance with its specified requirements.

There are five steps that are involved while testing an application for functionality. The comparison of actual and expected results based on the executed test cases.

An effective testing practice will see the above steps applied to the testing policies of every organization and hence it will make sure that the organization maintains the strictest of standards s when it comes to software quality.

Functional testing focuses on the requirements of the guidelines for end users to test accepts realistic facts and figures to make testing reports. This type of testing 1s conducted when the project is very close to customers like operating system browsers database Excel.

It is a testing technique which focuses on the business and also helps to reduce the between the business organization and their uses.

Disadvantages of Functional Testing:

  • Functional testing is a process in which various logical mistakes in the software are not detected in the testing process.
  • Where is also a possibility of redundant testing which me in hands the testing cost and efforts of the.
  •  It doesn’t care how the developer implements the actual source code because it only focuses on the results of the source code.

New post

Follow on Twitter

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *