FROM USE CASES TO TEST CASES
FROM USE CASES TO TEST CASES
-Test note of “Essential Software Test Design”
2015-08-31
Content:
12.1 What are Use Cases?
12.2 Use cases
12.2.1 Example: Use Case – Withdraw Money
12.3 The Model – Compiling the Flow Graph
12.4 Creating Base Test Cases
12.4.1 List All Scenarios
TO DESCRIBE THE requirements on a system, a technique is often used which is called use cases.
12.1 What are Use Cases?
Use cases are a step-by-step description of a flow, where an actor interact with a system. An actor may be one of a number of different user types, the system itself, or other external systems.
The commonest flow – normal use – is called the main flow (also called the normal flow or Happy Path) and variations of this are termed alternative flows.
The overarching work procedure is this:
- Compile an activity diagram. If this is already in place, the first step is to review it.
- List all scenarios
- Analyze and prioritize the scenarios according to risk – which are most important, commonest
- Identify the operational variables which can affect the expected result
- Write one or more test cases for each scenario
12.2 Use cases
Let us go back to the example of an ATM machine. A simple use case may look like this:
12.2.1 Example: Use Case – Withdraw Money
Assumptions:
- The customer’s bank is one which is connected to the ATM system.
- The customer has a correct and functioning magnetic strip card.
- The ATM is switched on and is in ready mode.
- The ATM is situated in Sweden so all withdrawals will be in swedish crowns,
- SEK, and bills that can be withdrawn are 100 or 500 only.
Actors
- Customer
- ATM (network)
Main Flow:
H-1. The use case begins when the customer inserts the card.
H-2. The ATM verifies the card and requests the PIN number.
H-3. The customer types in the correct PIN (4 digits).
H-4. The ATM verifies the PIN and asks the customer to type in an amount.
H-5. The customer types in the amount (100-2000 SEK manually or by using the multiple choice keys).
H-6. The ATM verifies that the amount is available in the customer’s account and ejects the card, the money and the receipt, and registers the transaction in the customer’s account.
H-7. The customer takes the card, the money and the receipt.
H-8. The ATM returns to standby mode.
H-9. End of use case.
Results
The customer has carried out a successful withdrawal of money.
The customer’s account is updated with the transaction.
Alternative Flows
Alternative flow – A1 Invalid card
A1-1. At step H-1, the customer inserts an invalid card.
A1-2. The ATM aborts the transaction and the card is ejected.
Alternative flow – A2 Wrong PIN
A2-1. At step H-3, the customer types in the wrong PIN.
A2-2. The ATM registers an incorrect PIN and asks the user to try again.
A2-3. The use case continues with step H-3.
Alternative flow – A3 Wrong PIN, 3 times
A3-1. At step H-3, the customer types in the wrong PIN three times in a row.
A3-2. The ATM swallows the card and the transaction is aborted.
A3-3. End of use case.
Alternative flow – A4 Incorrect input of amount
A4-1. At step H-5, the customer makes an incorrect entry (not divisible by a hundred, funds are not in the account, exceeds permitted maximum withdrawal…)
A4-2. The ATM disallows the entered amount and asks the user to try again.
A4-3. The use case continues with step H-5.
Alternative flow – A5 Customer does not take the money
A5-1. At step H-7, the customer takes the card, but not the money or the receipt within 20 seconds.
A5-2. The ATM leaves the receipt hanging out of the machine and retracts the money, places it in a separate container and writes the amount, account number and cause of defect into a defect log.
A5-3. The use case continues with step H-8.
Alternative flow – A6 The customer’s bank is not on-line (other than Handelsbanken)
A6-1. At step H-6, the ATM cannot verify whether the amount is available in the customer’s account. A message shows that contact with the customer’s bank is being established and the card is ejected.
A6-2. The use case continues with step H-8.
Alternative flow – A7 Customer aborts the withdrawal
A7-1. At all times in the Main flow, apart from steps H-6 and H-7, the customer can choose to abort the transaction
A7-2. The ATM aborts the transaction and ejects the card, and no withdrawal is recorded on the customer’s account.
A7-3. The use case continues with step H-8.
12.3 The Model – Compiling the Flow Graph
If there is not one already, you compile a flow diagram based on the use case.
Figure 12.1: Activity diagram of the flow in the use case «Withdraw Money». We have a starting point but several different end points, with different results.
12.4 Creating Base Test Cases
12.4.1 List All Scenarios
To cover the graph, we generate base test cases for the different flows at hand
- Start with the Main flow, which you use for the Happy Day test.
- Continue with the alternative flows – one at a time.
- There are different combinations of alternative flows. It is not always possible to draw up all the combinations: there may be infinite loops.
FROM USE CASES TO TEST CASES的更多相关文章
- USER STORIES AND USE CASES - DON’T USE BOTH
We’re in Orlando for a working session as part of the Core Team building BABOK V3 and over dinner th ...
- 深入理解openstack网络架构(2)----Basic Use Cases
原文地址: https://blogs.oracle.com/ronen/entry/diving_into_openstack_network_architecture1 译文转自: http:// ...
- Security Test Cases
https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents Username Enumeration Vulner ...
- SSAS CUBE TEST CASES
经过周末两天和今天的努力,基本上完成并修复了一些bug并且集成到我的MSBIHelper项目中去,可以进行数据测试了.效果图如下: 可以帮助开发人员快速生成等值的Tsql和mdx查询,辅助测试人员快速 ...
- 算法最坏,平均和最佳情况(Worst, Average and Best Cases)-------geeksforgeeks 翻译
最坏,平均和最佳运行时间(Worst, Average and Best Cases) 在上一篇文章中,我们讨论到了渐进分析可以解决分析算法的问题,那么在这一篇中,我们用线性搜索来举例说明一下如何用渐 ...
- As of ADT 14, resource fields cannot be used as switch cases
在导入Android Sample的ApiDemos的时候,发现R.id.xx的文件不能够在 switch cases 中使用 在google查询了下,找到以下答案: As of ADT 14 ...
- Unsupervised Learning: Use Cases
Unsupervised Learning: Use Cases Contents Visualization K-Means Clustering Transfer Learning K-Neare ...
- MapReduce 模式、算法和用例(MapReduce Patterns, Algorithms, and Use Cases)
在新文章“MapReduce模式.算法和用例”中,Ilya Katsov提供了一个系统化的综述,阐述了能够应用MapReduce框架解决的问题. 文章开始描述了一个非常简单的.作为通用的并行计算框架的 ...
- Cannot declare class app\home\controller\Cases because the name is already in use
Cannot declare class app\home\controller\Cases because the name is already in use 命名空间冲突了 use 模型类的时候 ...
随机推荐
- Laravel 5 插入数据后返回主键ID
方法一: $info = DB::table('表名')->insertGetId(['imgName' => $fileName]);//图片名入库后返回添加数据行的主键ID 方法二:( ...
- 聊聊Java 8 Lambda 表达式
早在2014年oracle发布了jdk 8,在里面增加了lambda模块.于是java程序员们又多了一种新的编程方式:函数式编程,也就是lambda表达式.我自己用lambda表达式也差不多快4年 ...
- UVA 624 CD[【01背包】(输出路径)
<题目链接> 题目大意: 你要录制时间为N的带子,给你一张CD的不同时长的轨道,求总和不大于N的录制顺序 解题分析: 01背包问题,需要注意的是如何将路径输出. 由于dp时是会不断的将前面 ...
- ettercap+arpspoof进行HTTP信息嗅探
准备:kali.xp kali ip:192.168.14.157 目标ip:192.168.14.158 目标网关:192.168.14.2 使用工具:ettercap.arpspoof 一.工具介 ...
- Redis分布式锁实现方式(附有正解及错误示例)
一.前言 本文内容主要来自博客:https://wudashan.com/2017/10/23/Redis-Distributed-Lock-Implement/,本文用于归纳总结及笔记用途,如有需要 ...
- 进程间通信(IPC)
1.什么是进程间通信 通俗来讲,进程间通信就是:多个进程之间的数据交互 进程都有自己独立的虚拟地址空间,导致进程之间的数据交互变得十分困难,通信复杂了,但是安全性提高了: 进程间通信的本质:多个进程之 ...
- Xamarin.Android部署失败
Xamarin.Android部署失败 项目编译.生成没有错误信息,并且可以找到生成的APK包,但部署失败.提示信息如下: "apksigner.BAT"已退出,代码为1. ...
- [BZOJ4541][HNOI2016]矿区(平面图转对偶图)
https://www.cnblogs.com/ljh2000-jump/p/6423399.html #include<cmath> #include<vector> #in ...
- 2845 ACM 豆子 beans
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2845 题意:吃豆子游戏 , 当你吃了一个格子的豆子 , 该格子左右两个和上下两行就不能吃了 , 输入每个格 ...
- 潭州课堂25班:Ph201805201 WEB 之 JS 第四课 (课堂笔记)
JS 引入方式 在 HTML 中写入 写在 的标签里 <script> </script>推荐 放在 </body> 结束之前 <!DOCTYPE html& ...