These are various levels of code coverage with increasing complexity. Take this example single line of code
if (A&B || C&D) somestatement;
- Line coverage will tell you that the if statement got executed, but since somestatement is on the same line, you will not know if that was executed or not.
- Statement coverage will tell you whether both were executed
- Branch coverage will tell you if the if statement executed both the true and false branches. since there is no else clause, statement coverage would not uncover the false branch.
- Since different tools have different terminology and metrics for expression and focused expression coverage, it is best to consult the documentation for the tool you are using. The basic premise is for each of the 4 variables in the expression, the state of each variable needs to control the state of the entire expression. For example, if B==1, and C or D = 0, then the state of A will control whether the expression is true or false. If B was always false, there is no way to cover the expression true by making A true.