A Better Vocabulary for Testing
I have been contemplating the vocabulary used to discuss software testing for some time. The idea of a unit in a unit test is not clearly defined, integration tests encompass a broad range of modules, and the concept of an end-to-end test lacks specificity. It fails to detail the methods employed, such as automated agents, human supervision, predefined actions, or random exploration.
Moreover, stress tests, load tests, and penetration tests exist without a proper classification system. It seems that everything is based on "vibes."
Through a web search, I discovered a classification based on "levels" and an "ad" from Atlassian proposing seven "types" of software tests. It is evident that we need to improve upon this. Should we, I believe it is necessary. We should develop a vocabulary that is practical and adaptable, allowing tests to be upgraded or downgraded based on resource availability.
There should be a set of guidelines to navigate the available options for any given situation. Please note, this article leans heavily towards the topic of random testing, which is my primary focus.
I propose five distinct categories, some of which are mutually exclusive, while others overlap. The first category focuses on the scope of the test unit. This concept is similar to the traditional unit/integration/end-to-end testing classification, but it falls short. There are two axes to consider when determining the scope: the constructs of the programming language used and whether the scope is stateful or stateless.
Functions can be either stateful or stateless, while systems are typically stateful. These scopes vary significantly; one might argue that the entry point of a large system is the system itself, but scopes are useful. They help clarify inputs and outputs; functions, especially stateless ones, accept any structure as input, whereas system inputs, typically serialized data, are more restricted.
This allows for more targeted testing. When state is introduced, tests can be made isomorphic by converting a function with state into a stateless function or transforming the state into a part of the input-output. However, this transformation depends on the complexity of the system. If the state is too complex to create a realistic workload, the system should be treated as a simulation, where messages containing directives or interactions based on the system's API are passed, and responses or confirmations are checked.
This approach ensures invariants, preconditions, and postconditions are maintained. Additionally, employing Design by Contract (DbC) can help make testing more manageable. DbC allows the specification of assumptions about function inputs, which can be checked at runtime and sometimes even at compile time through static analysis.
By constraining the input space of functions, we can better manage the often larger-than-life input space. For example, if a hashmap lookup is expected to always succeed, DbC can enforce this, reducing the tension between the programming language and the developer. Ultimately, testing measures or evaluates something. It creates a hypothesis that can be falsified through testing, with the goal of disproving the hypothesis.
These hypotheses can be formed in various domains, such as functional correctness, performance, or security. Large-scale distributed systems must also be tested for resilience against delays, drops, network faults, and even failures in single machines, like file system corruption or disk damage. Chaos testing often refers to such scenarios, where systems are subjected to unpredictable events to ensure reliability.
Rewritten by urgent.news; may contain errors — check the original.
Source: alperenkeles.com