Grokking the Behavioral Interview
Get Educative’s popular interview prep course for free.
Code-based testing involves testing out each line of code of a program to identify bugs or errors during the software development process. Specific test cases are checked on the program to see if it performs the functions required.
Moreover, code-based testing can be broken down into structural and static testing.
Below are the definitions of the terms above and what they consist of as a part of code-based testing.
Structural testing: This type of testing is based on the program’s implementation. Structural testing consists of the following:
Dynamic testing: Also known as control-flow-based testing, as it checks that each branch of the control flow is covered by the program. Dynamic testing checks for statement, path, and branch coverage in the control flow.
Complexity-based testing: A mathematical approach using a control flow graph. Complexity-based testing calculates nodes covered, as well as the distance to the next node.
Static testing: Static testing will not require us to execute the program but rather review the code and walk through it. Static testing involves the following:
Code walkthrough: Led by a programmer who goes over the code so that team members understand and identify defects better.
Code inspection: Led by a moderator who outlines the criteria for entry and exit of data. A document is created highlighting how the code can be improved.
Code review: Carried out by programmers to detect each other’s bugs.
Code audit: Done to ensure all rules have been followed and that the code meets standards for requirements, security, and programming conventions.