May 18, 2020

What is State Transition Testing?

In this article, we’ll explore a method called state transition testing. This type of testing is effective in “finite” systems. These are systems in which certain sequences of events take place within set parameters with specific inputs and outputs. These finite systems are referred to as “Finite State Machines” (FSM).

When building software for all kinds of machines and applications, it is crucial to make sure that you test all aspects of the software’s functionality. Software engineers need to not only understand how a certain piece of software works internally, but how it works in practice. Therefore, they also need to make sure to consider all inputs and outputs before the software is used.

For this reason, software engineers use a number of testing methods. In fact, there are many different types of software, which require varying testing techniques to make sure they work properly.

In this post, we will also provide some state transition testing techniques, and give examples of applications to help further explain this type of software testing. To wrap things up, we’ll explore some of the advantages and disadvantages of using this method.

State Transition Testing 1What Is State Transition Testing?

When we look at the phrase, state transition testing is fairly self-evident. But to clarify, this testing method refers to the testing of various states within a system based on certain inputs and outputs.

While we might not be aware of it, many everyday objects would have been tested using this method. For example, digital alarm clocks, ATMs, and car display settings. A team would have used state transition testing to make sure that they considered all the various inputs and outputs and that they functioned correctly.

Therefore, state transition testing involves mapping out all of the scenarios involved in using a piece of software within an FSM. This involves using diagrams and tables to understand all the states that the software application will move through. It shows how each input leads to a transition and an ultimate output within the system.

To provide a simple example, when you go to an ATM to draw money, you move through various states. These states include entering the correct password to withdrawing a certain amount of money based on the balance in your account.

A software engineer would have used state transition testing to test all of the different scenarios of the ATM software. Everything from entering the incorrect and correct PIN, to drawing money or not being able to draw money. Each sequence of possible functions, or each pathway, requires testing before the product can be approved for use.

State Transition Testing Techniques

As we mentioned above, there are various techniques used with this method of testing – namely graphs and tables. Both of these techniques allow for the software engineer to gain an understanding of how the software works, without having to understand the internal workings of the software itself.

Graphs describe all the various states in boxes or circles. They depict each transition and input from left to right with the use of an arrow. This allows the software engineer to show different steps within the transition process. They can also show, with an arrow, when certain transitions will lead back to the starting point, or when certain inputs will terminate the application.

With tables, you can list all states of the applications process on the left-hand side and all of the different inputs (both valid and invalid) on the right. Using numbers and letters in the right-hand columns, you can then see which inputs lead to different transitory states.

Using both of these techniques, software engineers can get a broad overview of how the software works. To put this into perspective, this process is evident when having to log into an application. The input would be the username and password. The transitory states would be the outcomes of all the different input combinations. This includes granting on the first attempt if the password is right, or denying access if one of the inputs is wrong.

The software engineer can map out all of these combinations in a graph or table to easily see all possible outcomes.

Advantages And Disadvantages

This method of testing can help ensure that a system responds correctly to all conditions. Using tables and graphs, you can easily see all combinations of inputs and their corresponding outputs to ensure the system works as it should.

From the description of the testing process above, it is evident that this is a helpful way to get a bird’s eye view of how an application works. While we have used simple examples like an ATM, and a login process to demonstrate how this approach might be used, it can also be helpful when testing out more complex applications. This would involve using much more intricate graphs and tables.

However, on that point, this testing method is limited when it comes to software applications with a high number of inputs and outputs. Complex software might require a broader form of testing, such as exploratory testing.

Therefore, this approach certainly offers benefits when used to test certain types of systems, but isn’t really applicable to more intricate applications with a large variety of inputs and outputs.

Final Thoughts

In conclusion, this testing method works very well when used within certain finite systems with simpler parameters. But, it would not work as effectively in very complex software systems as they might require a broader and more exploratory approach.

Share article