DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Moving From Full-Stack Developer To Web3 Pioneer
  • Effective Code Reviews For Remote Teams
  • Idempotency Under Concurrency: Why Your Application Check Isn't the Last Line of Defense
  • Running a Self-Hosted WAF in Production: Practical Lessons From SafeLine

Trending

  • How Performance Engineers Find and Fix Hidden System Bottlenecks
  • 5 Proven Strategies for Modernizing Legacy .NET Applications
  • Why Your Test Automation Is Always Behind the Code And the Architecture That Fixes It
  • Giving AI Agents Safe Access to Legacy Systems: Introducing legacy2mcp

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

A Complete Guide to State Transition Testing

For “finite-state” systems (FSM) - the systems that depend upon a limited number of predetermined sequences, state transition testing is particularly effective.

By 
Matthew Cooper
·
Dec. 18, 21 · Opinion
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Image Source

When developing software for machines and applications, each aspect of the software's functionality needs to be tested. The software engineers need to understand how the software functions internally, with consideration of the inputs and outputs that are needed for the software to function effectively.

For businesses reliant on software for their employees or customers, such testing is paramount. Where the relevant personnel is available, this can be done in-house via team task management when delegating to the appropriate members of the IT team.

Where nobody is qualified, or if there are skill gaps, it is necessary to use an external software testing outsourcing firm to ensure best practices are used. This will alleviate the possibility of mistakes being made in the testing process, some of which could cause the software designers a slew of problems that later need to be rectified. 

A variety of testing techniques can be employed, depending on the software and the machine in question. For “finite-state” systems (FSM) - the systems that depend upon a limited number of predetermined sequences, “state transition testing” is particularly effective. In this guide, we’ll take a closer look at this form of testing and where it might be useful. 

What Is State Transition Testing?

As you can probably guess by the phrasing, “state transition testing” refers to the testing of various states within a particular system. It’s a black-box testing technique in which changes made via input conditions cause transitional states in the application being tested. Testers will consider each facet of the application and record how it behaves according to positive and negative input test values. 

Many applications rely on state transition testing, including those that we use in our everyday lives. Login pages are a common part of our online existence and this is indicated by the diagram below. The tester might use such a diagram during testing when considering the various inputs the user might use as they attempt to access an application's homepage. 

Example #1

State transition testing: Example 1

Image Source

The inputs are based on the passwords the user will enter when using the application. When entering the correct password on the first, second, or third attempts, they’re redirected to where they want to be: the homepage.  When the password is entered incorrectly, a message will be displayed, such as “try again”, which allows for a second or third attempt to enter the password. 

Entering the incorrect password on the third attempt would redirect the user to a page stating the words “account locked”. In this example, the login password is the input and the outcomes of each combination are the transitory states. The sequence of events varies, depending on whether or not the user entered the correct password or not. 

As the diagram demonstrates, state transition testing involves mapping out the scenarios that are expected when using the application. It shows how a particular update will lead first to a transitional state and then the eventual output within the system.

Example #2

Let's relate state transition testing to an ATM. The ATM goes through a number of transitional states, depending on the inputs of the user. Should they enter the right PIN, the user will end up at the “Access Granted” state. 

If they enter the wrong PIN, they will pass to another state whereby they’ll be given a second chance. If they enter the wrong PIN again, they will reach the “third chance” state. If they then enter the PIN incorrectly again, another state arises, typically one that indicates that their account has been blocked.  You can understand this in relation to the diagram below. We previously used it as an example in an article covering the comparison of test design methods. 

 

State transition testing: Example 2

Image Source

In relation to both examples given, software testing is essential. If bugs exist, the user could get to the homepage despite using the wrong password and the person at the ATM could withdraw cash, despite entering the wrong PIN. The reverse could also be true, as a person could be locked out of an account despite entering the correct details. 

To determine no problems exist, the software engineer would have to employ state transition testing. As such, they would map out each sequence or pathway and then take the necessary steps to ensure the correct outcomes happen for the user. 

Automation tools can be used within the testing process so not everything has to be conducted manually. Take this into consideration when determining when to automate your testing for your business applications. 

When Is It Right to Use State Transition Testing?

Instances when state transition testing can be recommended:

  • When the tester is testing an application for a finite set of input values.
  • When the tester is testing the sequence of events that should occur within the application.
  • When the system being tested is dependant on conditions of the past.
  • When the application encompasses different states and transitions.

Instances when state transition testing shouldn't be relied upon:

  • When sequential input conditions are not being tested.
  • When more complex functionalities within the application need to be tested.

As you can now understand, state transition testing has its place but it is not always recommended. It is best used when trying to ensure a finite system responds correctly to expected conditions. Using tables, graphs, and other diagrams, the tester will have a birds-eye view of how the application should work during the testing process. 

The diagrams we used for login and ATM processes are fairly simple. More intricate graphs and tables should be used for more complex applications. 

However, when it comes to more complex applications, a broader form of testing, such as exploratory testing, is preferential. Other forms of testing should also be used for infinite-state systems. 

Conclusion 

State transition testing works well with certain finite systems, such as those we have discussed here. It does not work effectively when software systems need an exploratory approach, such as those that are particularly complex. 

Consider these points when determining the testing needed for the applications you are designing. 

application Software engineer

Opinions expressed by DZone contributors are their own.

Related

  • Moving From Full-Stack Developer To Web3 Pioneer
  • Effective Code Reviews For Remote Teams
  • Idempotency Under Concurrency: Why Your Application Check Isn't the Last Line of Defense
  • Running a Self-Hosted WAF in Production: Practical Lessons From SafeLine

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook