当前位置:网站首页>After 3 years of testing experience, do you know the state transition method for use case design?
After 3 years of testing experience, do you know the state transition method for use case design?
2022-06-29 16:18:00 【TEST_ Two black】
1、 Concept
The state transition method mainly focuses on testing the correctness of state transition . For a finite state machine , Test to verify whether it can produce the required state change under the given conditions , Are there unreachable states and illegal States , Whether it is possible to produce illegal state transfer, etc . By constructing events that can lead to state migration , To test the transition between States .
2、 Range of application
The idea of state transition method is to provide the idea of testing multiple state transitions . This method is suitable for the case that there are many functional states , It is necessary to test the transition of various states , And these state transition tests are easy to be missed in practical work . Like the player 、 Remote control buttons, etc .
3、 Steps of state transition method
Analyze requirements , Sort through all the statuses ;
Draw a state transition diagram ;
List status - Event table ;
Get the state transition tree ( Test path );
Get the test cases according to the state transition tree
4、 Case study :
demand : Through a ticketing system , Customers can buy train tickets in advance , Go somewhere .
- The user logs in to the ticketing system , Choose the place of departure 、 Destination 、 Departure date , Select a train number and click ” booking “, And fill in the information of the Booker , Click submit order ; The current order status is ” Did not pay “;
- User manually cancels the order , The ticket status is updated to “ Cancelled ”;
- 45 Not paid within minutes , The order is cancelled automatically , Ticket status is “ Cancelled ”;
- The user pays the ticket , The ticket status changes to “ Paid ”;
- When the user arrives at the station, he can pick up the ticket through the automatic ticket machine or the ticket window , Ticket status is “ Tickets have been issued ”;
- Half an hour before driving , The signature can be changed , The change was successful , Ticket status is “ The change was successful ”;
- Tickets have been issued / After boarding the train with the ticket changed , The ticket status changes to “ Already used ”;
- Half an hour before driving , Refundable , Refund successful , Ticket status is “ Refund successful ”.
a、 Sort out all the status of the ticket order :
Did not pay 、 Cancelled 、 Paid 、 Tickets have been issued 、 Refund successful 、 The change was successful 、 Already used
b、 Draw a state transition diagram :

c、 List status - Event table :
This item is not required , This step can be skipped according to the actual situation , Get the state transition tree directly ;

d、 Get the state transition tree ( Test path ):

Get the test path through the above :
- Did not pay –> Cancelled
- Did not pay –> Paid –> Tickets have been issued –> The change was successful –> Refund successful
- Did not pay –> Paid –> Tickets have been issued –> The change was successful –> Already used
- Did not pay –> Paid –> Tickets have been issued –> Refund successful
- Did not pay –> Paid –> Tickets have been issued –> Already used
- Did not pay –> Paid –> The change was successful –> Refund successful
- Did not pay –> Paid –> The change was successful –> Already used
- Did not pay –> Paid –> Refund successful
- Did not pay –> Paid –> Already used
e、 Get the test cases according to the state transition tree
Each of the above test paths is 1 Test cases , Perform coverage test on each path . There are multiple event triggers for state transitions , Operations that cover multiple events , such as “ Did not pay –> Cancelled ” This test path , Need to test 2 In this case :1) The user cancels the ticket order manually 2) exceed 45 Minutes user unpaid , Automatically cancel the ticket order
5、 summary
In practice , For products with complex business processes , When the scenario coverage method cannot be used to design use cases well , The idea of state transition method can be applied , Starting from the various states of the business , And the test coverage is carried out by connecting the switching conditions between these states in series , To ensure high coverage of use cases .
Last : Send learning resources to

These materials , There are also many recorded video tutorials , For friends who do software testing, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful ……
Come on! , Tested by ! If you need to improve planning , Then act , Better on the road than at the starting point .
边栏推荐
- [day 28] given a string s, please judge whether it is a palindrome string | palindrome judgment
- 如何在 WordPress 中嵌入 iFrame
- [proteus simulation] progressive increase / decrease of nixie tube with flashing blanking display
- DAP大屏主题开发说明
- 基础 | 在物理引擎中画圆弧
- 如何在 WordPress 中创建登录页面
- MATLAB输出格式控制 %d,%f,%c,%s的用法
- Tianlong Babu TLBB series - how to make pets learn twelve full skills
- BS-GX-017基于SSM实现的在线考试管理系统
- DTCC2022 中国数据库技术大会最新议程出炉
猜你喜欢

To solve the stubborn problem of Lake + warehouse hybrid architecture, Star Ring Technology launched an independent controllable cloud native Lake warehouse integrated platform

数学知识复习:第一型曲线积分

Privacy computing helps secure data circulation and sharing

哪个版本的JVM最快?

事件相关电位ERP的皮层溯源分析

【大家的项目】 Rbatis ORM官网上线

MySQL基础——多表查询

都3年测试经验了,用例设计还不知道状态迁移法?

穩定幣風險狀况:USDT 和 USDC 安全嗎?

DTCC2022 中国数据库技术大会最新议程出炉
随机推荐
MySQL进阶——存储引擎
资讯 | 扎克伯格被评为全球IT业最不谨慎的CEO;中国移动研发系留式无人机应急通信高空基站
Telnet+ftp to control and upgrade the equipment
水球图-利用动态波纹展示百分比
穩定幣風險狀况:USDT 和 USDC 安全嗎?
指南针开户炒股是否安全?个人怎样开户炒股
按键精灵打怪学习-多窗口多线程后台判断人物、宠物血量和宠物快乐度
Metadata management Apache Atlas Compilation integration deployment and testing
关于组织开展2022年南京市创新产品(第一批)申报工作的通知
Cortical traceability analysis of ERP
技术分享| 融合调度中的广播功能设计
MySQL常用语句和命令汇总
How can I repair a slow WordPress website?
事件相关电位ERP的皮层溯源分析
MATLAB给数据加噪声/扰动
locust性能压测工具
Blue Bridge Cup 2015 CA provincial competition (filling the pit)
Tool chain empowers hundreds of companies, horizon opens the "Matthew effect" of mass production of intelligent driving
把这份关于软件测试一系列笔记研究完,进大厂是个“加分项”...
Alipay "security lock" was selected as an excellent case in the "child care program" of the ICT Institute: more than 330000 users have opened game protection