I.M. Testy

Treatises on the practice of software testing

State Transition Testing: Thinking in Models

with 7 comments

Well, it has been quite some time since I last posted to this blog, and I apologize to my regular readers for the inconsistency. Since the December timeframe I have been a bit busy behind the scenes searching for a new direction at Microsoft, and last week I was finally able to officially announce that I will soon be a Principal Test Lead in the Windows Phone group on the Communications team. My feature area will be Social Networking. I am so excited about the change, and getting back into the “real-world.” I have already started making the transition (more mentally than physically) and I am recalling the feelings I had when I first started at Microsoft. It’s incredible!

For the past 5 weeks I have also been teaching a course on Software Testing at the UW on Monday and Wednesday evenings. Tonight was my last class with a final that culminated in the attendees writing “scripted tests” from vague requirements, running those tests followed by some exploratory testing, and finally reviewing structural coverage effectiveness and defect detection effectiveness of the testing approaches.All in all, it is a fun class.

One lesson in the class focused state-transition testing.  The focus of the lesson is to identify the important “states” the machine is in at a given time, and identify various ways a customer might navigate from one state to another (traversals). In my opinion, one of the easiest ways to present the concept of modeling states is with a setup or installer of a program with a minimum number of configuration variables. I have found that minimizing the configuration variables helps people focus on “state” rather than be distracted by the different configuration settings (combinatorial testing).

After a brief explanation and a demo, I cut them loose on a problem to solve. In this case I used a shareware application called 3rd Plan It. The objective was to identify all possible paths a customer could navigate while setup is running and the important states the machine might be in at any given moment in time during the installation process. The value of a state diagram or map is that it can help us identify paths that we might miss via exploratory testing. Also, by identifying important characteristics of each state we can better assess whether the machine is in the expected state (oracle) as we navigate the various paths towards the objective of our test (in this situation it is the installation of a program).

The state map below illustrates a model of what we might consider the “important states,” and the various ways to traverse or navigate between states. Coming up with a state transition diagram often requires us to explore the feature. But, it also seems to force us to really understand the feature we are exploring at a much deeper level, and consider paths that we might otherwise have missed. A state transition diagram also helps us think about what “state” the machine should be in at any given moment during the setup process (it is also important to understand the “state” within the appropriate context).

MachineState

This is not to suggest that we need to create a state transition diagram for every feature. That would be silly. But, even if we don’t create a state diagram on paper we certainly create one in our mind. I suspect that most of the time we are purposeful in our testing approach and use heuristic patterns as we design tests (that is of course unless someone is high on PCP or some other hallucinogen and are completely reckless in their test approach and simply bang away indiscriminately in hopes of finding bugs).

Of course, some people found 1 or 2 issues using an exploratory approach without first creating a state diagram. But, after viewing the state diagram those folks were also able to realize paths they had not considered or traversed and were able to find more issues. The single biggest epiphany that most people have after participating in this exercise is how much more they understand the feature they are modeling compared to what they thought they knew.

Then of course, when the setup is littered with problems, the uninstall functionality which is part of the setup engine has its own set of problems as well.

image

Often, after teaching concepts and demoing examples of situations where various testing techniques might apply I am asked how diligently we should apply these patterns of testing. Of course, functional techniques are only one way to think though a problem. Test techniques are useful to help us systematically analyze a problem, and come up with some model of what we are testing. Models are sometimes useful to help us think of the problem differently, or identify things we might otherwise miss. State transition testing is a useful functional technique that is useful for helping us visualize various ways a customer might use a feature, and in turn come up with various tests and potentially find more issues.

Written by Bj Rollison

February 21st, 2011 at 1:27 pm

7 comments on “State Transition Testing: Thinking in Models

  1. thanks made whole lot of more sense than my testing mentor

    [Bj's Reply] Thanks Justin. I am glad it helped you understand the concept better. State transitions and modeling are difficult concepts to grasp initially, but become easier with practice.

  2. Pingback: OpenQuality.ru | Качество программного обеспечения

  3. “This is not to suggest that we need to create a state transition diagram for every feature.”

    Can you elaborate on this? When is it a good idea to apply state transition modeling? What types of features does it lend itself to? I’ve had a hard time applying it to my features so far.

    [Bj's Reply]This is a great question, and there is no single answer that is applicable for everyone. If I were actually testing this setup program used in this post I likely would not have sat down and penciled out a state transition diagram. It simply is not that complex, and I suspect most people can visualize a map of the transitions in their mind. But, with that being said sometimes a state diagram of relatively simple things might be valuable if a lot of issues are exposed just to make sure we are not missing something. I will also create diagrams (state, data, etc.) when I don’t understand how something is working, or I want to make sure I understand how I think something is working. For example, when I build a data generator I often use data-flow diagrams.

    All in all, I would say that when we don’t understand something a model might help. When we need to comprehend something in-depth, then a state transition model (or other model) can be a forcing mechanism to better understand it. Many of my students have repeatedly told me that producing a state diagram forced them to learn more about the thing they are testing as compared to simply ‘poking around’ and trying stuff.

  4. Hi,

    State transition diagram is a UML diagram which can be better understood if the testers are strong in Object Oriented Programming concepts. Being skilled in this can definitely help testers influence critical design decisions. But I am concerned if the testers will be completely comfortable with these programming concepts. Please let me know your thoughts on this.

    Regards,
    Aruna
    http://www.technologyandleadership.com
    “The intersection of Technology and Leadership”

    [Bj's Reply]Hi Aruna,

    State transition models (and other static and dynamic modeling concepts) pre-date UML. UML is simply a modeling language that attempted to unify how we model things.

    I disagree that testers need to understand OOP concepts in order to understand state transition models. A person needs to understand OOP concepts to better understand UML class and object diagrams. But state transition diagrams (and other behavioral diagrams such a control flow, data flow, transaction flow, etc.) are based graphs, and these models pre-date both UML and OOP I don’t see any definative need for a tester to know OOP concepts as a pre-requisite to learn this testing technique.

    However, I do agree with you in principle that the more a tester understands the fundamental architecture of the system they are testing (regardles of the programming paradigm) the more it might influence their test design decisions. As my friend and collegue states, “You can’t model what you don’t understand, and you can’t test [well] what you can’t model.”

  5. “I will soon be a Principal Test Lead in the Windows Phone group on the Communications team.”

    “I have already started making the transition (more mentally than physically) and I am recalling the feelings I had when I first started at Microsoft. It’s incredible!”

    Congratulations – sounds like a great opportunity. It’s wonderful that Microsoft affords you the chance to find a new direction and get so recharged!

    [Bj's Reply]Thanks Joe. Yes, one of the biggest benefits of working at MS is the variety of different technological areas and other job opportunities. I was really lucky to land this position leading a team of great folks working in 2 areas that will have big impact; smart phone technologies and social networks. I think we are in the infancy of realizing the full potential of both.

  6. Pingback: Tweets that mention I.M. Testy › State Transition Testing: Thinking in Models -- Topsy.com

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

skala.cristopher@mailxu.com blomker.susana@mailxu.com bedoka.amber@mailxu.com