- Mastering Software Testing with JUnit 5
- Boni García
- 603字
- 2021-07-02 15:34:24
Static analysis
Static analysis of a software piece is performed without executing the code. There are several advantages to software analysis over testing:
- During testing, errors can hide other errors. This situation does not happen with static analysis, because it is not concerned with interactions between errors.
- Incomplete versions of a system can be statically analyzed without additional cost. In testing, if a program is incomplete, test harnesses have to be developed.
- Static analysis can consider broader quality attributes of a software system, such as compliance with standards, portability, and maintainability.
There are different methods that can be identified as static analysis:
- Inspection (first proposed by Michael Fagan in 1976) are examinations of software artifacts by human inspectors aimed at discovering and fixing faults in the software systems. All kinds of software assets are subject to be inspected, for example the specification, design models, and so on. The primary reason for the existence of inspection is not waiting for the availability of executable programs (such as in testing) before starting performing inspection.
- Review is the process in which a group of people examine the software and its associated documentation, looking for potential problems and non-conformance with standards, and other potential problems or omissions. Nowadays, reviews are frequently carried out for new code before being merged in a shared source code repository. Typically, the review is done by a different person to the code author within the same team (peer review). This process is quite expensive in terms of time and effort, but on the other side, when correctly performed, it helps to ensure a high internal code quality reducing potential risks.
- Automated software analysis assesses the source code using patterns that are known to be potentially dangerous. This technique is usually delivered as commercial or open source tools and services, commonly known as lint or linter. These tools can locate many common programming faults, analyze the source code before it is tested, and identify potential problems in order to re-code them before they manifest themselves as failures. The intention of this linting process is to draw a code reader’s attention to faults in the program, such as:
- Data faults: This may include variables declared but never used, variables assigned twice but never used between assignments, and so on.
- Control faults: This may include unreachable code or unconditional branches into loops.
- Input/output faults: This may include variables output twice with no intervening assignment.
- Interface faults: This may include parameter-type mismatches, parameter under mismatches, non-usage of the results of functions, uncalled functions and procedures, and so on.
- Storage management faults: This may include unassigned pointers, pointers arithmetic, and so on.
Halfway between static analysis and dynamic testing we find an especial way of software evaluation, called formal verification. This kind of assessment provides mechanisms to check that a system operates according to its formal specification. To that aim, software is treated as a mathematical entity whose correctness can be proved using logical operations, combining different types of static and dynamic evaluation. Nowadays, formal methods are not widely adopted mainly due to scalability problems. Projects using these techniques are mostly relatively small, such as critical kernel systems. As systems grow, the effort required to develop a formal specification and verification grow excessively.
- 編程珠璣(續)
- C語言程序設計教程(第2版)
- React.js Essentials
- Mastering AndEngine Game Development
- 小學生C++創意編程(視頻教學版)
- C++面向對象程序設計習題解答與上機指導(第三版)
- Apache Kafka Quick Start Guide
- OpenCV 4計算機視覺項目實戰(原書第2版)
- Java程序員面試筆試寶典(第2版)
- AutoCAD 2009實訓指導
- Django 3.0入門與實踐
- Apache Camel Developer's Cookbook
- Java 從入門到項目實踐(超值版)
- MySQL數據庫應用實戰教程(慕課版)
- Effective C++:改善程序與設計的55個具體做法(第三版)中文版(雙色)