Test Design techniques-state BASED Testing

Source: Internet
Author: User

Test Design techniques-state BASED Testing

-test note of "Essential software Test Design"

2015-08-19

Content:

13.1 The Model
13.1.1 the ATM Machine
13.2 Creating Base Test Cases
13.2.1 Ways of covering the Graph
13.2.2 Coverage According to Chow
13.2.3 Creating Test Cases
13.2.4 Transition Pairs
13.2.4.1 expanding the Table by one Column
13.2.4.2 Creating a Dual Graph
13.2.5 Transition Triples and more

A state of GRAPH, or state transition testing, was a model-based technique for compiling test cases. It works with Event-driven systems, often in real time, and are common in areas like digital technology and electronics in Hardware.

13.1 The Model

Top

2 Type:

    • Mealy Graphs, where the state was represented by nodes and the links between the nodes represent transitions.
    • Moore Graphs, where the events is represented by nodes.

Mealy Graphs is simpler to work with since they:

    1. More closely resemble what happens on their actual implementation
    2. Have fewer states, and since;
    3. The states is stable
    4. You can repeat events more easily without the graph becoming more complex
    5. It is easier to represent the graph in a table

We call the states nodes, and call connections between the nodes links.

Figure 13.1:state Graphs consist of nodes and links. An arc is also called a transition. Links which start and end at the same node denote this an event does not leads to a transition, but it still undergoes some form of process.

Steps compile a graph:

    1. Compile the different states an object can find itself in
    2. Compile the transitions between the different states
    3. Identify the events which cause a transition to occur
    4. Define happens during each transition
    5. The different states is as follows:
13.1.1 the ATM Machine

1. The different states is as follows:

A) Standby–nobody has inserted a card to the machine yet

b) Card inserted, request for PIN

c) PIN accepted–waiting for transaction

2. Draw arrows for the transitions according to the function descriptions

3. Events causing transition are:

A) Insert card

b) Enter correct PIN

c) Enter Incorrect PIN

d) Enter correct transaction

e) Enter Incorrect transaction

f) Choose to abort

4. What's carried out during transition is:

A) Request new PIN

b) Request new card

c) Request Transaction

d) Eject money, card and receipt (Execute transaction)

You are now created the picture below and the difficult are complete.

Figure 13.2:very Simple state graph for an ATM. In reality, there is more states and events is interesting to test and should is present in a complete graph.

13.2 Creating Base Test Cases

Top

13.2.1 Ways of covering the Graph

There is a number of variants of how to fill in the graph you had drawn up, besides the one described above. Some of them are:

    1. typical routes. The most credible combinations
    2. The travelling salesman ' s Route. All different states on one test case.
    3. The Chinese Postman ' s route. All transitions in the same test case, if there are that possibility.
    4. risk-based. Routes where you think that a particular combination of transitions can cause problems.
    5. All routes a certain length. From shortest to longest until you has covered all combinations. This was suited to automation, since it repeats many combinations and takes a long time to carry out.
    6. All ways of leaving astate. For example, via a menu, function key, hot key, button and so on.
    7. All events which should not produce a transition. Verifies the system ' s robustness.
13.2.2 Coverage According to Chow

One method is-cover, firstly, all transitions, then all transitions pairs, triples etc. This is originally presented by Chow.

When you generate the test cases, there is different levels in the degree of coverage. Covering every individual transition is often called Chow ' s 0-switch coverage. This can is visualized in a simple table.

Figure 13.3:table of the different transitions in the state graph for the ATM. The simplest form of test coverage is to test all the rows in the table.

13.2.3 Creating Test Cases

The next step is to generate the test cases and, in parallel with this, mark off the transitions you are covering.

Test Case 1 (transitions B, C, E, F and G is covered)

    1. Insert Card (V1)
    2. Enter wrong Code (V2)
    3. Enter correct code (V2)
    4. Enter Transaction (V3)
    5. Take card and money (V1)

Test Case 2 (transition A is covered)

    1. Insert wrong Card (V1)
    2. Take ejected card (V2)

Test Case 3 (transition D-is covered)

    1. Insert Card (V1)
    2. Enter wrong Code (V2)
    3. Enter wrong Code (V2)
    4. Enter wrong Code (V2)
    5. Card is swallowed and you were back on the starting point (V1)
13.2.4 Transition Pairs

In the order to achieve better coverages, you can use the what we call transition pairs, involving, and transitions in a row. The idea is, the result of an event in the system, depends on, and the happened in the preceding event. Sometimes, you'll see the term 1-switch coverage.

13.2.4.1 expanding the Table by one Column

There is different ways of solving this, the first being to start with the first table and adding one additional Colu Mn.

Analysis of our ATM produces the following links:

Figure 13.5:table showing development of transition pairs for the state graph ATM. We obtain all pairs to combining all routes to a node with all routes out of it. Even self-transactions, where we stay on the same node after transition, is counted.

The consolidated table is below, but columns showing event/answer has been taken out in order to simplify the table

Figure 13.6:consolidated Table of transition pairs to ATM State graph. A more accurate form of coverages are to-test all combinations of the transitions. Obviously, this requires more test cases.

13.2.4.2 Creating a Dual Graph

You can also generate a dual graph, where the transitions represented earlier by links is substituted by nodes:in other Words, a Moore graph. This, testing all paired transitions is called the de Bruijn algorithm. To generate a dual graph, your do the following:

    1. Generate a graph where the links in the original has been changed to nodes.
    2. Everywhere in the original graph where arc 1 comes to a node, and Arc 2 goes out of it, draw an arc between Node 1 and n Ode 2. Every arc would now represent a transition pair.
    3. Cover all links now with test cases.

Figure 13.7:original and dual graph for the ATM. An alternative to developing the table of transition pairs are to create a Moore graph, where each transition represents a Transition pair in the Mealy graph.

13.2.5 Transition Triples and more

You can proceed to more stringent requirements by setting up transition triples and quadruples, by adding another column I n the table of transition pairs. The problem is and the number of test cases grows very quickly, so it's often difficult to test all of the pairs without Automating the tests. It is common-to-use at least transition pairs and, if you find many defects Ain areas.

Test Design techniques-state BASED Testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.