Unreachable code

ISTQB Glossary definition In Simple English, Field Notes For

ISTQB Glossary  definition 
Code that cannot be reached and therefore is impossible to execute.
In Simple English,
 
Parts of the software that cannot be tested because there is no way to run the code that was written for those parts.

Field Notes


  • The discussion about unreachable code arises only when you as the testing team have access to code.
  • This means that only when doing a white box or glass box testing is when you can encounter 'Unreachable code'
  • Unit testing is another scenario where 'Unreachable code' can be encountered.
  • There is a difference between a screen element or feature not working and 'Unreachable code'


For Example:


Say for example,
You are testing an software which has a feature to print some reports as PDF documents you can save to the computer.
Say there is also a business rule that is coded in the sofrware that users are allowed to save reports as PDF to the computer only when the report has more than 10 pages.
Say there is un editable default in all the reports that they generated as single page reports.
Now, there is no possible way the “print as PDF” feature will be called, so that become unreachable code.

of reports.and that piece of code to print gets called only when the number of copies being printed is two and you application does not have an feature to change the number of copies to be prineted and defaults the number of copies to one. Now the feature to print PDF is never going to get called and its code is unreachable.

1 comment:

  1. In computer programming, unreachable code is part of the source code of a program which can never be executed because there exists no control flow path to the code from the rest of the program.
    Analysis[edit]

    Detecting unreachable code is a form of static analysis and involves performing control flow analysis to find any code that will never be executed regardless of the values of variables and other conditions at run time. In some languages (e.g. Java [5] ) some forms of unreachable code are explicitly disallowed. The optimization that removes unreachable code is known as dead code elimination.

    ReplyDelete