Static and dynamic testing are the types of testing techniques completes each other in which static testing is performed in the initial stages of the software development whereas dynamic testing is carried out after the completion of the development process. Dynamic testing is like validating a software but static testing is verification of the software.
Testing is a combination of multiple software life cycle activities related to planning, designing and evaluation of the software product in order to find the defects and determine whether the software fulfils the specified requirements or not.
Content: Static Testing Vs Dynamic Testing
|Basis for comparison||Static Testing||Dynamic Testing|
|Basic||Does not execute the software.||Execution of the software is necessary.|
|Uncovers||Large variety of bugs||Limited types of bugs|
|Performed||Before compilation||Only when executables are available|
Definition of Static Testing
Static testing is a form of analysis of the program where the source code of the product is only needed rather than executable files or binaries. In simple words, while performing static testing the programs are not needed to be executed. This technique is considered to be preventive, which is carried out in the verification phase.
An individual who did not involve in writing the code of the software would be preferable for performing static testing. The static testers are provided with a requirements document, design document, application, user manuals and related documents so that the SRS can be tested to check whether the requirements satisfy the user or not.
Static Testing Methods
The primary static testing methods are Static Analysis, Reviews, Inspection and Walkthrough.
Static Analysis – Static analysis aims to discover the defects in the software even if they do not cause failure devoiding the execution of the program.
- Characteristics of static analysis
- The static analysis can be done before or after the compilation of the code.
- It can also help in finding bugs in the development phase as the bugs discovered in the earlier phase generates less cost when fixed.
- There is no requirement of program inputs, which reduces the expense of generating test cases and removes bugs easily.
- It also facilitates dynamic testing at the time of developing dynamic test cases.
- Static analysis covers
- Unreachable code
- Parameter type mismatches
- Array bound violations
- Defects detected by the compiler
- Program complexity
- Static analysis metrics
- Cyclomatic complexity measure
- Lines of code
- Fan-out and fan-in
- Nesting levels
Walkthrough – It is a process of reviewing the software related document in an informal way. It involves a team of technical and non-technical individuals who shares their perspectives over the requirements. The team discusses about all functional and non-functional requirements of the software, whether it is clear and consistent and match user needs or not. The detailed report is produced at the end of the walkthrough.
Program inspections – It is a group of procedures or error detection techniques performed to improve the code quality at a lower expense. A specific inspection team performs the formal code inspection through the following procedure as given below.
- Specification of the purpose, inspection policies and plans.
- Inspection of the work product and setting of the data.
- Formation of the team along with defined roles.
- Distribution of the documents.
- Setting up deadlines.
- Running the inspection meeting.
- Results are recorded and systematically stored in the database.
- Monitoring the follow-up period.
- Preparing the checklist of the items.
Static Testing Tools
Static testing follows a symbolic approach of testing hence does not require actual input and output.
- Flow analyzers: It analyzes the flow of data from input to output whether it is consistent or not.
- Path tests: It discovers the ambiguous, unused and unreachable code.
- Coverage analyzers: It confirms that all the logic paths incurring in the software have been tested.
- Interface analyzers: It inspects the effects of passing data between the modules.
Definition of Dynamic Testing
Dynamic testing is different from static testing in a way that it is carried out at the time of code execution or after it. It can be comparable to validation testing because it takes data values as the input and then these inputs are validated against the expected outcome. Dynamic testing is a curative method, unlike static testing, where the faults are rectified and corrected.
Types of Dynamic Testing
There can be two types of dynamic testing – Explicit and Implicit dynamic testing.
- Explicit Dynamic Testing – System functions are majorly tested through test cases specially designed for the intended purpose.
- Implicit Dynamic Testing – The testing scenarios are finalized after analyzing the metrics used in the test process and execution.
It can also be categorised on the basis of requirements and implementation where the two types are black-box and white-box testing.
- Black-Box Testing – This technique incorporates the functional behaviour of the system without any additional knowledge of implementation details.
- White-Box Testing – It comprises the internal knowledge of the components and structure, and all of the information regarding the working of an individual unit.
Dynamic Testing Methods
There are various dynamic testing methods which involve unit, integration and system testing.
- Unit testing tests the individual units of the software.
- Integration testing merges individual units and then tests the integrated unit.
- System testing is conducted over the entire system and it checks the software if it is according to the requirements specifications or not.
Dynamic Testing Tools
Dynamic testing utilizes the live data as we know that it tests the software system at the time of execution.
- Test driver: This is used to insert the data in a MUT (Module-under-test).
- Test beds: It displays the program under execution along with source code.
- Emulators: It helps in emulating the parts of the software system that are to be developed.
- Mutation analyzers: This conducts the test to check the fault tolerance of the system for which the errors are purposely fed into the code.
Key Differences Between Static and Dynamic Testing
- The static testing does not need to execute the software code whereas in the dynamic testing the executables must be ready and it also executes the software.
- When it comes to the cost of the testing the dynamic testing is more costly than the static testing which is very effectual.
- Static testing achieves the maximal level of statement coverage. As against, dynamic testing obtains a minimal level of statement coverage as it discovers the bugs in only those portions of the software which are executed.
- The time consumption of static testing is less as compared to dynamic testing because it runs a variety of test cases which can consume more time than compiling the software.
- Dynamic testing detects a limited amount of bugs. In contrast, static testing may uncover a variety of bugs.
- The static testing can be conducted before compilation. Conversely, when a software is ready to execute, it can be dynamically tested.
The static testing and dynamic testing are methods of verifying and validating the software product and these are crucial to make the software bug-free. Static testing primarily checks the logic and correctness of the software code while the dynamic testing is used for checking the response of the system when predefined inputs are applied.