Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

State transition Test method of Black Box Test

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The composition of the state transition diagram:

1. Status: expressed in circles, the beginning and end are special states

2. Transition: due to the drive of events, the system moves from one state to another

3. Event: triggered by the relevant interface of the system and associated with a specific transformation

4. Activity: indicated by "/", activity is triggered by state transition

5. Condition: expressed as "[]", indicating that the state transition can only be carried out after this condition is met.

State transition testing: a way to design test cases based on state transitions. The switch between two allowable states of a system or component.

The testing method based on state transition is an effective way to detect the abnormal dynamic behavior of Web programs. the state transition of web programs is determined by the navigation scenario composed of link sequences and submitted data. In this paper, the active page navigation diagram (APND) is used to describe the link transition behavior between pages, and the combined object state diagram (COSD) of state variables is used to describe the change of system state variables caused by submitting data, and then the two are unified into a more comprehensive dynamic behavior model Web program state transition diagram (WSTD). Finally, the clue k-cross tree is adopted and improved to generate test cases automatically.

State transition diagram-> state transition tree

1. Use the start state as the root of the state transition tree

2. Check the nodes at the current level from left to right, and take all the next possible states corresponding to that node as its child nodes

3. Repeat the action of the second part until the node of the previous level is encountered, then the node is the final node, and finally to the end node.

Cycle switching machine-- > n-switch

N-Switch was proposed by TSUN S. CHOW in 1978. He defined N-Switch as a sequence of continuous edges or arcs of length nx1 in a program graph (usually representing a loop in a state diagram). So a single edge (or transformation) is a 0-Switch, and the sequence of two consecutive edges is 1-Switch.

The following illustrates the concepts and differences between 0-Switch and 1-Switch with the state machine shown in figure 1. The example of a state machine shown in figure 1, where a circle represents a state, an edge with an arrow represents a transition, and an alphabet identification is defined for each transition.

Fig. 1 example diagram of state machine

1) 0-Switch

For 0-Switch, the basic rules or steps for converting a state transition diagram to a state transition tree are as follows:

● step 1: take the initial state or start state as the root of the state transition tree, and the root has a hierarchy of 1 in the entire state transition tree.

● step 2: assuming that the hierarchy of the current generated state transition tree is K, then check all nodes on K from left to right; take all the next possible states corresponding to that node as its child nodes, and the transition between states as the edge of the two states.

● step 3: repeat step 2 until a node on hierarchy K appears on hierarchy J and J is less than or equal to K, then the node becomes the final leaf node without continuing to generate its child nodes, or the state of the node is ended and there is no need to continue the state transition for that node.

According to the definition of 0-Switch, all the 0-Switch corresponding to the state machine are: a, b, c, d, e, f. At the same time, according to the above 0-Switch state transition tree generation rules, the generated state diagram is shown in figure 2.

Figure 2 example of 0-Switch state transition diagram

2) N-Switch

Let's take another look at 1-Switch. According to the definition of 1-Switch, all the 1-Switch corresponding to the state machine are: ab, ac, bb, bc, cd, ce, dd, de, ea, ef, fd, fe. The generation rule of the 1-Switch state transition tree is to add another level to the 0-Switch state transition tree, that is, for all the leaf nodes of the 0-Switch state transition tree, the possible next state of each leaf node is taken as the child node of that node. It is important to note that only one layer needs to be added. The state transition diagram of the generated 1-Switch is shown in figure 3.

Figure 3 example of 1-Switch state transition diagram

If 1-Switch still does not meet the strength of the test, then, according to the above ideas, continue to increase one level to reach 2-Switch. However, it should be noted that the increase in test intensity is at the cost of increasing test cases exponentially. The balance between the two must be considered when testers use what kind of test intensity.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report