Black Box vs White Box Testing Techniques - I

Black Box vs White Box Testing Techniques - I

There are two different testing techniques. One is called black box testing and another one is called white box testing. Main difference between those is knowing code or not. Apparently, while the black box means the code is unknown, the white box means the code is known by test designer.

From my personal experience, black box testing is usually hard to apply. In theory, all test cases should be written based on software requirement and specification not having the production code. It is more theoretical than practical. It is not really important how you write the test cases based on black box or white box approach. Eventually, the goal of testing is identifying coding errors, ensuring that each unit of code functions correctly. However, I'd like to talk about theoretical approach today. Some examples of black box techniques are

  1. Equivalence Partitioning

  2. Boundary Value Analysis

  3. Decision Table Testing

  4. State Transition Testing

Here is an example of voltage monitoring system.

Requirement:

  • 5V rail shall be monitored every 100ms.

  • The voltage rail shall be detected overvoltage and undervoltage.

  • The system shall define current state as error, undervoltage, normal and overvoltage.

  • The error shall be reported if current state is not normal zone.

  • The unit shall be voltage.

  • The accuracy of measurement voltage is 0.1V.

Specification

  • Overvoltage is greater than 5.2V.

  • Undervoltage is less than 4.8V.

  • Error condition is less than 4V or greater than 5V.

Based on requirement and specification, five zones can be defined below:

  • Three valid zones(undervoltage, normal, overvoltage)

  • Two invalid zones(0~4V and 6~10V)

Equivalence partitioning is a software testing technique that divides the input data of a program into different equivalence classes. It helps to reduce the number of test cases while ensuring that a wide range of scenarios is covered.

Q: How to apply equivalence partitioning in the voltage monitoring system? A: Derive test case by picking one value within each zone

Boundary value analysis is testing boundary values, which are the values at the edges of equivalence classes. This is because errors frequently occur at the boundaries of input domains. Typically, two-value boundary analysis is used because of the simplest.

Q: How to apply two-value boundary analysis in the voltage monitoring system?

A: Derive test case by picking each border of zone's +0.1V and -0.1V. For example, two value could be 4.7V and 4.9V because 4.8V is where undervoltage zone is started.

Decision table testing is identifying the combinations of input conditions and their corresponding actions or outcomes in a systematic and organized way. It is particularly useful when there are multiple input conditions that can result in different outcomes.

Q: How to apply decision table testing in the voltage monitoring system?

A: Not enough input condition to derive test cases because only condition is measured voltage. If there is another requirement like state transition shall be happened by three consecutive reading, test cases could be derived.

State transition testing is verifying transition to new state based on particular input with current state.

Q: How to apply state transition testing in the voltage monitoring system?

A: There are four states in this system(E(error), U(undervoltage), N(normal), O(overvoltage)). Without any restriction, there are 16 possible cases here (E->E, E->U, E->N, E->O, U->E, U->U, U->N, U->O, N->E, N->U, N->N, N->O, O->E, O->U, O->N, O->O).

Today, black box testing techniques are introduced with how to apply in real world example. Without any code implementation, many test cases are able to be derived. Next time, white box testing techniques will be introduced with examples.

Did you find this article valuable?

Support Hyunwoo Choi by becoming a sponsor. Any amount is appreciated!