Black box testing: What are they and how are they applied? – Python example

Black box tests, is a software testing technique in which functionality is verified regardless of the internal code structure (unlike the white box test), implementation details or internal execution scenarios in the software.

  • The black box is the first test that must be performed when programming.
  • To develop a black box test you do not need technical knowledge.
  • Try to find data structure errors, initialization and termination, performance, etc.

Equivalent partition test:

It consists of the division of the domains of input data types, evaluating its behavior for a value of each class. Based on this, determine a set of valid and invalid inputs for the program, which will be retaken later.

Types of data to enter:

  • Type of data
  • Data range (numbers)
  • Data subsets
  • Limit values

Program separation:

In modular programming, where a program (or an algorithm) is divided into modules, In the design phase, each module will be a black box within the global system that is the program to be developed., in this way an independence is achieved between the modules that facilitates their separate implementation.


Example with Python and Tkinter:

I have designed a small program to be able to understand the basics of the black box test, It is a simple .py file made with Tkinter whose functionality is to verify that text without special characters is being entered correctly, no numbers:


Black box cases:

The cases help us to speculate the “try and failure”, in other words, It shows us how secure or robust our program is when it comes to receiving information from the user. In this example, we have five possible cases which are:

  • Case 1:
    ○ Input data: chain of 5 characters
    ○ Expected result (exit): the application does not allow the entry of the string and shows us an error message
  • Case 2:
    ○ Input data: chain of 7 characters, including one or more non-alphabetic characters
    ○ Expected result (exit): the application does not allow data entry and displays an error message.
  • Case 3:
    ○ Input data: chain of 7 characters, alphabetic characters only.
    ○ Expected result (exit): The application allows the entry of the data.
  • Case 4:
    ○ Input data: chain of 11 characters.
    ○ Expected result (exit): The application does not allow data entry and displays an error message.
  • Case 5:
    ○ Input data: nothing (empty text field)
    ○ Expected result (exit): The application shows us an error message where it asks us to enter data:

This type of tests help us to avoid possible errors in the program, detect errors in internal code (obviously, if we have access to it), They are mostly used by hackers since they do not have access to the code, perform injection tests.

If you want to know how this simple program works, you can take a look at my GitHub profile: https://github.com/facundokimbo/pruebas-caja-negra

Facundo Kimbo

Leave a Reply

Your email address will not be published. Required fields are marked *

fifteen − eleven =