Skip to content

Basic Theory

Statistical usage models are used to automatically deploy individual test cases or complete test suites with simple push-button operations.

Main testing problem

Testing a software system is a complex and time-consuming process that is essential to ensuring the quality and reliability of the system. One of the main problems in testing a software system is the sheer number of possible combinations of inputs, configurations, and scenarios that must be tested to adequately cover the functionality of the system.

Since complete testing of real systems is not feasible in practice, a suitable set of test cases must be selected to achieve a specific test objective. A statistical usage model, also called a Markov Chain Usage Model (MCUM), can be used to (automatically) derive individual test cases or complete test suites by traversing the MCUM. Statistical usage models are graphical representations for defining all possible usage steps and scenarios at a given level of abstraction, as shown in the figure below.

Statistical usage models

Statistical usage models consist of
  • usage states to model user behavior during the interaction with the system, and
  • state transitions to specify the system's response to the user's interaction.

The probability that a user interaction triggers an event ej is called transition probability and is given after a colon, e.g. e4:0.3 to go from usage state A into usage state B. By adjusting the probability values of the usage distribution, i.e. the operational usage profile, it is easy to specify different usage behavior for different user classes. This allows the test engineer to automatically create different test cases for different system users.

Example: Usage states and transitions

For example, entering a search term into the search field of an Internet browser is an interaction between the user and the browser, and displaying a list of web pages that match the search term is the expected response of the system. Both the usage states search item and web page list as well as the state transition between these usage states that is triggered when the interacting user presses the input key are described in the usage model.

Usually, there are many alternatives to move from a given usage state to possible successor states. For example, instead of pressing the input key in our example another action can be performed, such as select another web site tab with the mouse. This takes the user to another usage state.

Statistical usage models and test cases

A test case is given by a statistical traversal of the usage model beginning in the Start State and ending in the final End State, considering the probabilities of the selected usage profile. A test suite is a set of test cases to achieve a specific test objective, such as covering all usage states or traversing all transitions at least once during the test execution.

The main goals of using a MCUM for statistical test case generation can be summarized as follows
  • Automatic generation of a sufficient number of test cases
  • Calculation of meaningful metrics for the test suite
  • Determine stopping criteria for terminating the test execution.

Interesting test metrics can be calculated immediately after the test suite generation, e.g.
  • Average number of test cases required to cover all states and transitions of the usage model (steady state analysis)
  • Probability of occurrence of a given state/transition in each test case (feature usage)
  • Average length of a test case to estimate the test duration (source entropy)
and after the test execution the number of test cases that passed or failed the test or the reliability of the SUT can be presented.