What is static testing?
Static testing is a set of software testing techniques to test code without executing it. It includes static reviews and static analysis, which are a form of static testing.
Static analyses are normally performed using tools due to the complexity of modern programming languages while static reviews are normally done manually.
Benefits of Static Testing
The major benefit of static testing is identifying errors in software documentation and faulty code as early as possible. In a static review of software specifications and design documents, errors are discovered before the code is written, saving time, effort, and money in developing faulty code that would have got discovered later in the life cycle where the expenses of developing it were already incurred.
The purpose of static reviews includes finding errors or gaining an understanding of the documentation or code being reviewed. The type of errors found by static reviews includes non-government compliant coding standards, missing requirements, and bad designs.
Hambling et al. Say that:
Reviews can be used to test anything that is written or typed; this can include documents such as requirement specifications, system designs, code, test plans, and test cases. Reviews represent the first form of testing that can take place during a software development life cycle (p. 62).
Types of reviews
Static reviews are classified as either formal or informal, where the main difference lies in the amount of detail and level of formality in each classification. Typically, the document or code is reviewed for potential errors and then passed down for correction. The difference between the two is that an informal review will usually not get documented while a formal review will incorporate roles and responsibilities and document its findings.
As hambling et al. Put it:
like reviews, static analysis looks for defects without executing the code. However, unlike reviews static analysis is carried out once the code has been written. Its objective is to find defects in software source code and software models [software models are the various graphs and documents written in UML by a designer] (p. 71).
the static analysis uses tools to look for software vulnerabilities, error-prone coding practices, dependencies, invalid validation of data, logical errors, and more. Reference chapter-6 for more details on the type of tools used in static analysis, or get it on amazon.
What is dynamic testing?
Dynamic testing takes place after static testing when most of the faults in documentation, logic, and structure have been identified. Dynamic testing uses test cases to execute the code to test how the system responds to dynamic data, such as sample data and dynamic variables. Test use cases involve supplying the system with input and recording how it responds.
According to Wikipedia, “dynamic testing can be divided into unit testing, integration testing, system testing, acceptance testing, and finally regression testing” (2021).
Regression testing finds faults in code modification and redesign since these modifications can lead to new bugs.
Unit testing aims to test code by units or a group of similar functions. The advantage of unit testing is that it determines the correctness of individual code components, such as modules.
After unit testing takes place, integration testing tests the integration of various modules and how the modules behave as a whole instead of individual units.
System testing takes place after integration testing to test the system as a whole against “functional requirement specifications (FRS) or system requirement specification (SRS), or both. System testing tests not only the design but also the behavior and even the believed expectations of the customer” (“system testing, ” 2021).
Acceptance testing is the last phase in dynamic testing and aims to figure out if the system meets the customer’s requirements and whether it is ready for delivery.
Due to the complexity of modern programming languages and the various input needed to perform tests, dynamic testing uses software testing tools to streamline the process. As a result, false positives are common in dynamic testing.
What are the differences between static and dynamic testing?
Verification and validation
Static testing falls under verification and dynamic testing falls under validation.
The first stage of testing is a combination of static testing techniques, and the next stage of testing is a set of dynamic testing techniques.
Static testing techniques are performed without executing code while dynamic testing executes the code to find errors.
Static testing finds errors at an early stage where the cost is minimal since the SDLC is in its early stages. Dynamic testing is costly compared to static testing because it occurs later in the SDLC. Static testing is also a shorter stage compared to dynamic testing.
Uses cases and checklist
Dynamic testing tests functional and non-functional requirements using test cases. Static testing performs reviews and inspections using a checklist.
Why is it important to use both static and dynamic testing?
It is important to use both static testing and dynamic testing because each plays an important and unique role in the SDLC. Static testing ensures that system development and design can proceed with confidence that everything has been verified. Dynamic testing builds upon static testing to ensure that everything that has been verified is also validated.
System testing. (2021). Wikipedia. https://en.wikipedia.org/wiki/System_testing
Dynamic testing. (2021). Wikipedia. https://en.wikipedia.org/wiki/Dynamic_testing
Hambling, Brian Morgan, Peter Samaroo, Angelina Thompson, Geoff Williams, Peter. (2015). Static testing. Software testing – an ISTQB-BCS certified tester foundation guide (3rd ed., pp. 60-76). BCS The Chartered Institute for IT. Retrieved from https://app.knovel.com/hotlink/toc/id:kpSTAIST01/software-testing-an-istqb/software-testing-an-istqb