4.3 White-Box Test Techniques Flashcards

1
Q

What two code-related white-box test techniques are covered in the Foundation syllabus?

A

Statement testing and Branch testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define Statement Testing.

A

Coverage items are executable statements. The aim is to test individual statements in the code with test cases until an acceptable level of coverage is achieved. Coverage is measured as the number of statements divided by the total number of executable statements in the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When 100% statement coverage is achieved, it ensures that all executable statements in the code have been exercised at least once. This in turn means that every statement with a defect will be executed - does this mean all defects will be found?

A

If every statement with a defect will be executed, then those tests may cause a failure demonstrating the presence of a defect.

However, in some cases, simply exercising the defective statement will not generate a failure or result in a detected defect. Also, exercising all statements individually does not ensure that all decision logic has been tested.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a branch in the context of testing code?

A

A branch is a transfer of control between two nodes in the control flow graph, which shows the possible sequences in which source code statements are executed in the test object. Each transfer of control can be either unconditional (straight-line code) or conditional (a decision outcome).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe Branch Testing and Branch coverage.

A

In branch testing, coverage items are branches, and the aim is to design test cases to exercise branches in the code until an acceptable level of branch coverage is achieved. Coverage is measured as the number of exercised branches divided by the total number of branches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When 100% branch coverage is achieved, all branches in the code, unconditional and conditional, are exercised by test cases. Will this capture all defects?

A

No. exercising a branch with a test case will not detect defects in all cases. For example, it may miss defects requiring the full execution of a specific path in the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe possible test outcomes for conditional branches.

A

Conditional branch test results typically correspond to true / false from an “if…then” decision, an outcome from a switch/case statement, or a decision to continue or exit from a loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Is Branch coverage or Statement coverage stronger?

A

Branch coverage subsumes and contains statement coverage. If 100% branch coverage is achieved, then 100% statement coverage is also achieved, but not vice versa.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the biggest strength and weakness of white-box testing?

A

A fundamental strength of white-box testing is that the entire software implementation is taken into account during testing, which facilitates defect detection even when the software spec is outdated or incomplete.

The corresponding weakness is that, since we’re not concerned with specifications in white-box testing, it may not detect missing requirements or features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Is white-box testing suitable for static testing?

A

Yes, these techniques are well suited to reviewing code that is not yet ready to run, as well as pseudocode and other high level or top-down logic which can be modeled using a control flow graph.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Does black-box testing by itself provide a measure of code coverage?

A

No, it does not. Only white-box testing techniques can provide an objective coverage measure for code branches and statements. These techniques also provide the information needed to allow additional tests to be generated to increase that coverage and confidence in the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly