Static Testing Techniques
Software testing is a process consisting of all life cycle activities, both static and dynamic, concerned with planning, preparation and evaluation of software products and related work products to determine, that they satisfy specified requirements, to demonstrate that they are fit for purpose and to detect defects. ~ Foundation of Software Testing by Dorothy Graham, Erik Van Veenendaal, Isabel Evans, Rex Black.
Software testing has an important role to play in the software development life cycle. It is with the testing process, that the quality of the software is ensured. To ensure the quality of the software product, the testing team aims to unearth as many errors as possible in the software. Different software testing techniques are used for the same. Each of the techniques aims to find different types of and new errors in the software. The software testing techniques used are divided into static testing and dynamic testing techniques. Each of them have advantage over the other. The difference between static testing and dynamic testing, lies in the fact that static testing is performed without actually executing the software code, while dynamic testing, as the name suggests is carried out by executing the software. Like in dynamic testing, there are different techniques used in static testing as well.
Static Testing Methodologies
When static testing is carried out on the software, the software product is examined manually or using certain tools, however, only ‘without’ executing the software. Static testing aims to check sanity of the document, algorithm used and code. It is more or less like primary syntax checking of the code. It is a powerful method for improving the quality and productivity of the software. It aims to find defects in the software product in the early stages of software development, so that they can be fixed easily. There are two static testing types, namely reviews and static testing with tools.
All software products are often tested used different review techniques. Reviews can range from informal to formal. Although there are a few formal review techniques, the informal review techniques are more commonly used. In most cases, reviews start in the early stages of software development and continue till the last stages. The review process goes through six steps.
- Kick Off
- Review Meeting
At this stage it is important to note that a single document or piece of code can be reviewed more than once. It is important to note that from all the review types, none of them is better than the other, but each of them has an important role in the software development process. We will now turn towards the different types of reviews.
Walkthrough: In this review technique, the author of the document or code takes the other participants through his piece of work. The thought process is also conveyed to the participants, to obtain feedback from the participants. In this technique, there is detailed, step-by-step explanation and it is not expected from the participants, that they study the code or document under review before the review meeting. Often this technique is used for higher level document, where there are participants from a broad cross section of skills and discipline. It helps to ensure there is no aspect, which is being missed out on and defects can be unearthed. It also helps in common understanding of the document and to check the validity of the proposed solutions and also viability of the different alternatives.
Technical Review: The aim of this review technique is to achieve consensus about the technical aspect of the document. They are informal in nature and it is the experts, who identify defects in the document. The experts who are a part of the review are architects, chief designers, key users, etc. However, peers are also a part of the review as well. In a technical review, the value of the technical concepts and alternatives is assessed. It is also ensured that right technical concepts are used.
Inspection: Among all the review techniques, inspection is the most formal technique. In this review technique, the document under review is thoroughly studied before the meeting. When the defects are identified, they are recorded and discussion about the document is postponed till the errors are fixed. The aim of this review type is to unearth defects in the document in the early stages of software development and thereby improve the quality of the product.
Static Analysis Using Tools
In this static testing technique, requirement, design and code are examined, using automated tools, before the code is actually executed. The focus of this technique is on software code. This technique is often used by developers before and during component and integration testing. The various tools used in static analysis are:
Coding Standards: The aim of this technique is to conduct a check to verify, if the code written adheres to the coding standards set at the very beginning. Often well-known coding standards are decided upon for which checking tools are available. If this tool is not used, then the chances that the code adheres to coding standards decided upon are reduced. This is due to the fact, that coding standard rules are many and it is often difficult to remember all the standards.
Code Metrics: To measure the structural attributes of the code, different code metrics are used. When the software is being developed, the code becomes increasingly complex. The code metrics are used for designing alternatives and also when portions of the code have to be redesigned. One of the most commonly used metric is cyclomatic complexity. Number of decisions in a program are the basis of this metric.
Code Structure: Different structural measures are a part of the software code. There are different aspects of code structure, namely control flow structure, data flow structure and data structure. As the name suggests, control flow structure works on the sequence in which the instructions of the software are executed. The different iterations and loops are the focus of attention. Dead code can also be identified with this technique. On the other hand, data flow structure, verifies the data item that is accessed and changed by the code. Complex data structures are also verified using this static testing technique.
Although all the techniques of static testing have their own importance in the software development life cycle, the decisions which ones to use and give more importance to depends on the kind of software developed and the organization developing the software. At the same time, factors like severity of the project, urgency of the project, resources in hand also have an important role to play in the decision-making process.