Black-box testing

A cat inside a black box

In black-box testing we only have access to the external interface, through which we interact with an application.

We don’t have access to the source code. So we will rely on requirements and explore testing techniques that help us uncover defects.

Внешний интерфейс приложения

The interface is the outer layer that allows users to interact with an application.

Let’s compare two such interfaces: GUI (Graphical User Interface) and CLI (Command Line Interface).


GUI

We fill in the form through the application's graphical interface.

When we click “Submit”, an HTTP POST request with a JSON body is sent.

The details of the HTTP request are hidden from us as users.

But if we want, we can inspect them usingDevTools → Network

CLI
tester-today@pc ~ % curl \
https://www.tester-today.com/endpoint \
-H "Content-Type: application/json" \
-X POST \
-d '{"name":"Mia"}'

The same request can be sent using the curl tool in the CLI.

To open the console:

  • On Windows, type “cmd” in the search bar next to Start.
  • On macOS, open Launchpad in the Dock and search for “Terminal”.

curl — a cross-platform tool preinstalled in most distributions.

You can download it from the official website.

Black-box testing techniques

Let’s look at two techniques that will help us test a GUI application «Rate your mood today» which accepts values from 1 to 100 inclusive.

Rate your mood today
Boundary value analysis
Boundary value analysis diagram

Boundary value analysis focuses on selecting values at the edge between valid and invalid inputs.

Let’s identify boundary values for the program «Rate your mood today»:

  • Valid boundary values 1 and 100
  • Invalid boundary values 0 and 101

Defects often occur at boundaries because programs are usually written to correctly handle typical values within the valid range, while edge cases may trigger unexpected behavior.

Equivalence partitioning
Equivalence partitioning diagram

Equivalence partitioning involves splitting all possible inputs into groups based on the requirements.

The program accepts values from 1 to 100 inclusive, so we can split inputs into three equivalence classes:

  • Valid inputs within 1 to 100, for example, 50
  • Invalid inputs below the allowed range, for example, -100
  • Invalid inputs above the allowed range, for example 150

This technique reduces the number of test cases because instead of testing each possible value, we select representative ones from each class.

The requirements were updated: the program now returns different messages for acceptable mood values below 50 and from 50 inclusive. Try the form and extend the checks to cover all boundaries and equivalence classes.

Task
Task available to premium users!
Sidebar arrow