<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Tools and Software Testing : Elements of MBT</title><link>http://blogs.msdn.com/nihitk/archive/tags/Elements+of+MBT/default.aspx</link><description>Tags: Elements of MBT</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Elements of MBT - Part 3 – Actions and Action Parameters  </title><link>http://blogs.msdn.com/nihitk/archive/2007/07/05/elements-of-mbt-part-3-actions-and-action-parameters.aspx</link><pubDate>Fri, 06 Jul 2007 02:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3715851</guid><dc:creator>nihitk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nihitk/comments/3715851.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nihitk/commentrss.aspx?PostID=3715851</wfw:commentRss><description>&lt;P&gt;In the last 2 posts we have looked at what we mean by a &lt;A href="http://blogs.msdn.com/nihitk/archive/2007/03/23/elements-of-mbt-part-1-what-is-a-model.aspx" mce_href="http://blogs.msdn.com/nihitk/archive/2007/03/23/elements-of-mbt-part-1-what-is-a-model.aspx"&gt;model of a system&lt;/A&gt; and defined what &lt;A href="http://blogs.msdn.com/nihitk/archive/2007/06/27/elements-of-mbt-part-2-states-and-state-variables.aspx" mce_href="http://blogs.msdn.com/nihitk/archive/2007/06/27/elements-of-mbt-part-2-states-and-state-variables.aspx"&gt;States and State Variables&lt;/A&gt; are. In this post we'll look into Actions and Action Parameters. &lt;/P&gt;
&lt;P&gt;We can define an &lt;STRONG&gt;Action&lt;/STRONG&gt; as something that modifies or exercises the system. Thus "TurnIgnitionOn" (in the car model being used in this series) can be an action which causes the system to change in some way. When considering Actions you need to think about what exactly is it that changes in the system and which all state variables are impacted by those changes. An action is therefore simply something that causes the system to change states. &lt;/P&gt;
&lt;P&gt;Actions become much more powerful and useful when combined with the concept of &lt;STRONG&gt;Action Parameters&lt;/STRONG&gt; which can be considered to be similar to method parameters. Like a method (in a programming sense) does some work which can be tweaked or controlled by the method parameters, the effect of an Action can be affected by Action Parameters. In the car driving model an example of an Action Parameter would be whether the ignition could be turned on remotely (via the keychain) or locally. In that case we might want to add an Action Parameter to the model such as TurnIgnitionOn(Mode) where the "Mode" action parameter could take values "Remote" or "Local" similar to the way state variables can have different values. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG style="WIDTH: 460px; HEIGHT: 102px" height=102 src="http://blogs.msdn.com/photos/nihitk/images/3715908/original.aspx" width=460 mce_src="http://blogs.msdn.com/photos/nihitk/images/3715908/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;A really interesting point that emerges here is that there is no &lt;STRONG&gt;one&lt;/STRONG&gt; way to model the system. In the example above if for some reason you actually wanted to &lt;STRONG&gt;track&lt;/STRONG&gt; how you had opened the car, maybe for a later stage in the model when you were actually locking the car then you would need to store this information in a state variable. Anytime you find yourself using the word "track" you should think about having that value as a state variable. We could therefore break our TurnIgnitionOn action into 2 different types of actions, &lt;EM&gt;TurnIgnitionOnRemotely&lt;/EM&gt; and &lt;EM&gt;TurnIgnitionOnLocally &lt;/EM&gt;and track how we opened the car as a new state variable, say S3, with values Remote or Local. Our model would therefore look something like this: &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/nihitk/images/3715910/original.aspx" mce_src="http://blogs.msdn.com/photos/nihitk/images/3715910/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;I will end this post with a word of caution. Even though it is quite easy to add a state variable to the model to track some aspect of the system, you should be very careful when adding state variables to your model and strive to minimize this number. The reason for this guidance is to limit the amount of state explosion that takes place as a result of defining these additional state variables. Remember that every time you define another state variable the number of possible states in the model is increasing exponentially. To keep your model manageable you should not add a state variable till it is absolutely critical to the behavior being captured.&lt;/P&gt;
&lt;P&gt;UPDATE: Just noticed that this is actually my 100th post on this blog - WOW! Never thought I'd see the 100th post when I started out...it's been fun! :)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3715851" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nihitk/archive/tags/General+Software+Testing/default.aspx">General Software Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Model+Based+Testing/default.aspx">Model Based Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Elements+of+MBT/default.aspx">Elements of MBT</category></item><item><title>Elements of MBT - Part 2 – States and State Variables  </title><link>http://blogs.msdn.com/nihitk/archive/2007/06/27/elements-of-mbt-part-2-states-and-state-variables.aspx</link><pubDate>Thu, 28 Jun 2007 03:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3573496</guid><dc:creator>nihitk</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/nihitk/comments/3573496.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nihitk/commentrss.aspx?PostID=3573496</wfw:commentRss><description>&lt;P&gt;This is a continuation of the Elements of MBT series of posts which I started last time with &lt;A href="http://blogs.msdn.com/nihitk/archive/2007/03/23/elements-of-mbt-part-1-what-is-a-model.aspx" mce_href="http://blogs.msdn.com/nihitk/archive/2007/03/23/elements-of-mbt-part-1-what-is-a-model.aspx"&gt;Part 1&lt;/A&gt; and covered what is meant by a model of a software system. In this post I shall be covering additional concepts which you will need to know to gain a better understanding of Model Based Testing. &lt;/P&gt;
&lt;P&gt;One of the most fundamental concepts required to define a model of a system is that of &lt;STRONG&gt;State Variables&lt;/STRONG&gt; which in turn are needed to define what a State is. A State Variable is simply some aspect of the system which changes over time. For e.g. in the car driving model, one aspect that changes (and which you care about tracking for the purpose you are building the model for) is whether the car is moving or not. So this can be a state variable, say "CarMotionState", which can have values such as "Moving" and "NotMoving". Couple of important things to keep in mind is that a state variable can have multiple values (not just 2 as in the example above) and that these "values" are really just semantic terms to help us define the model. What the actual values of these do and result in (especially from an automation point of view) is tied in later when you are implementing the code for the model. &lt;/P&gt;
&lt;P&gt;A &lt;STRONG&gt;State&lt;/STRONG&gt; then becomes much easier to define as simply a combination of all the State Variables in the model with particular values assigned to each state variable. Thus if your model contains 3 state variables S1, S2 and S3 with multiple values for each state variable, a state will be defined by a &lt;STRONG&gt;unique&lt;/STRONG&gt; set of values for each of the state variables S1, S2 and S3. You can therefore think of a state as simply a snapshot of all the state variable values at a given point in time. From the Part 1 car driving model we can now see that the 3 states in the model are comprised of the following unique combinations of state variable values. &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #632423"&gt;S1 = { IgnitionState = IgnitionOff; CarMotionState = NotMoving; } &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #632423"&gt;S2 = { IgnitionState = &lt;STRONG&gt;IgnitionOn&lt;/STRONG&gt;; CarMotionState = NotMoving; } &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #632423"&gt;S3 = { IgnitionState = IgnitionOn; CarMotionState = &lt;STRONG&gt;Moving&lt;/STRONG&gt;; } &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;One thing to notice here is that not &lt;STRONG&gt;all&lt;/STRONG&gt; possible states need to be defined for a particular model. Depending on the system and the reason you are creating the model or the abstraction level you want to capture, you might not include certain states in your model. Or certain states simply won't make any sense to model such as the state "IgnitionOff" + "Moving" if you do not want to capture the behavior of the car sliding down hill when the ignition has not been turned on. The great thing though is that it forces you to think of that scenario and to consider if that is something you want to capture and if so then what the expected behavior would be. &lt;/P&gt;
&lt;P&gt;In the next post I shall cover Actions and Action Parameters and update the model to add an Action Parameter to one of the actions.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3573496" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nihitk/archive/tags/General+Software+Testing/default.aspx">General Software Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Model+Based+Testing/default.aspx">Model Based Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Elements+of+MBT/default.aspx">Elements of MBT</category></item><item><title>Elements of MBT - Part 1 - What is a model?</title><link>http://blogs.msdn.com/nihitk/archive/2007/03/23/elements-of-mbt-part-1-what-is-a-model.aspx</link><pubDate>Sat, 24 Mar 2007 03:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1939974</guid><dc:creator>nihitk</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/nihitk/comments/1939974.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nihitk/commentrss.aspx?PostID=1939974</wfw:commentRss><description>&lt;P mce_keep="true"&gt;In this series of "Elements of MBT" posts, I will be covering some basic concepts used when trying to build models of software systems for use in &lt;A class="" href="http://blogs.msdn.com/nihitk/pages/144664.aspx" mce_href="http://blogs.msdn.com/nihitk/pages/144664.aspx"&gt;Model Based Testing&lt;/A&gt;. The aim is to give an explanation of the various elements involved in defining a model of a software system and hopefully this should get us on the same page and allow us to explore the complexities in more detail. &lt;/P&gt;
&lt;P&gt;Let us start by going over what we mean by a "model" of a system. Put simply, a model is a description of the system and is much simpler than the actual system itself. What this means is that the model hides a lot of the details about the system and hiding these details allows us to work at a higher level of abstraction. For e.g. a simple model of driving a car could be: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B3%5D.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B3%5D.png"&gt;&lt;/A&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B6%5D.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B6%5D.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=95 src="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D_thumb%5B2%5D.png" width=433 border=0 mce_src="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D_thumb%5B2%5D.png"&gt;&lt;/A&gt; 
&lt;P&gt;One thing to keep in mind is that there is no perfect&amp;nbsp;model of a system, since the same system can have completely different models depending on what you plan to &lt;STRONG&gt;use&lt;/STRONG&gt; the model for. Are you creating the model of a system simply to capture the behavior and requirements of the system? Are you creating the model to auto-generate the code for the model implementation itself? To describe the data flowing through the system? Or are you generating the model to actually test a particular portion of the system? 
&lt;P&gt;A quote which captures this unusual thing about models really well is as follows: 
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;All models are wrong; some models are useful. &lt;/STRONG&gt;
&lt;P&gt;&lt;EM&gt;- George Box&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is worth hanging onto from this definition is that a model that you create should strive to be "useful" more than anything else. It might be rough round the edges and might not tell you everything about the system (for e.g. you don't know from the above model how the gear is to be changed or what happens when a gear is changed) but if it is &lt;STRONG&gt;useful &lt;/STRONG&gt;for the purpose it was created it is a correct model. 
&lt;P&gt;Another aspect of defining a model is the notion that the model should help &lt;STRONG&gt;predict&lt;/STRONG&gt; what the behavior of the system would be under certain conditions. So if you are in the "Not Moving" state and you "ChangeGearAndAccelerate" then you reach the "Moving" state. Are there certain assumptions in the model? You bet there are! Such as assuming that the ignition is on, that the car has wheels, that the car is not hanging in the air, that there is oxygen in the air, we can go on and on and on. The hiding of these details and assumptions is what helps us look at just this behavior we are capturing. If anything is important for the &lt;STRONG&gt;purpose&lt;/STRONG&gt; (say testing) for which we are creating the model, we should consider adding that detail into the model. So if we thought that it was important to know whether the ignition was on or off we would change the model to capture this as well. 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B12%5D.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D%5B12%5D.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 511px; BORDER-BOTTOM: 0px; HEIGHT: 96px" height=120 src="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D_thumb%5B6%5D.png" width=736 border=0 mce_src="http://blogs.msdn.com/blogfiles/nihitk/WindowsLiveWriter/ElementsofModelBasedTesting_C20B/image%7B0%7D_thumb%5B6%5D.png"&gt;&lt;/A&gt; 
&lt;P&gt;Now we know that if you are in the "Ignition &lt;STRONG&gt;Off&lt;/STRONG&gt;" and "Not Moving" state then if you "TurnIgnitionOn" you reach the "Ignition &lt;STRONG&gt;On&lt;/STRONG&gt;" and "Not Moving" state since simply turning on the ignition does not cause the car to start moving in the model that we have created. To start moving you will need to "ChangeGearAndAccelerate" which should take you to the state of having the "Ignition On" and the car "Moving". 
&lt;P&gt;Hope this gives you an idea of what a model contains and what it can be used to capture. In the following posts we will look into each element of a model in more detail.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1939974" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nihitk/archive/tags/General+Software+Testing/default.aspx">General Software Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Model+Based+Testing/default.aspx">Model Based Testing</category><category domain="http://blogs.msdn.com/nihitk/archive/tags/Elements+of+MBT/default.aspx">Elements of MBT</category></item></channel></rss>