当前位置:网站首页>怎样写测试用例?
怎样写测试用例?
2022-08-02 03:34:00 【IICOOM】
测试用例是什么?
一个测试用例就是为了验证软件功能,而设计的一系列操作。一个测试用例应该包括测试的步骤,测试数据,前置条件,后置条件,特殊的测试场景。可能还需要站在用户的角度来思考软件是否能够满足用户的使用。
怎样写测试用例?
这篇文章将介绍如何写标准的测试用例,按下面的步骤进行:
创建测试场景(Test Scenario)
Let’s create a Test Case for the scenario: Check Login Functionality
为用户登录的场景创建测试用例:
Step 1) A simple test case to explain the scenario would be(一个测试用例描述的测试场景)
| Test Case | Test Case Description |
|---|---|
| 1 | Check response when valid email and password is entered |
Step 2) Test the Data.
In order to execute the test case, you would need Test Data. Adding it below(准备测试数据)
| Test Case | Test Case Description | Test Data |
|---|---|---|
| 1 | Check response when valid email and password is entered | Email: [email protected] Password: lNf9Oti72h |
Step 3) Perform actions.
In order to execute a test case, a tester needs to perform a specific set of actions on the AUT. This is documented as below:(测试步骤)
| Test Case | Test Case Description | Test Steps | Test Data |
|---|---|---|---|
| 1 | Check response when valid email and password is entered | 1) Enter Email Address 2) Enter Password 3) Click Sign in | Email: [email protected] Password: lNf9Oti72h |
Step 4) Check behavior of the AUT.
The goal of test cases in software testing is to check behavior of the AUT for an expected result. This needs to be documented as below(期望结果)
| Test Case | Test Case Description | Test Steps | Test Data | Expected Result |
|---|---|---|---|---|
| 1 | Check response when valid email and password is entered | 1) Enter Email Address 2) Enter Password 3) Click Sign in | Email: [email protected] Password: lNf9Oti72h | Login should be successful |
During test execution time, the tester will check expected results against actual results and assign a pass or fail status
在执行期间,测试人员将要检查期望结果是否与真是结果相同,来决定测试用例是否通过。
| Test Case | Test Case Description | Test Steps | Test Data | Expected Result | Actual Result | Pass/Fail |
|---|---|---|---|---|---|---|
| 1 | Check response when valid email and password is entered | 1) Enter Email Address 2) Enter Password 3) Click Sign in | Email: [email protected] Password: lNf9Oti72h | Login should be successful | Login was successful | Pass |
Step 5) 运行条件
测试用例运行的前置条件(如:需要安装xxx,才能进行测试),后置条件(如:测试用例运行结束需要在多长时间内,xxx数据应该已经被存储到数据库中)
高质量测试用例具备的条件
Best Practice for writing good Test Case Example.
- 简单且透明
- 使用用户思维创建测试用例
- 避免重复
- 不要主观臆想
- 100%的覆盖率
- 测试用例ID唯一
- 善于使用测试技巧: Boundary Value Analysis (BVA)边缘分析、Equivalence Partition (EP) 等类划分、State Transition Technique 状态过渡、Error Guessing Technique 错误预测 这个比较依赖于测试者的经验
- Peer Review 同事评估
工具推荐
测试管理工具可以帮助测试者管理维护测试用例。有下面一些特性:
- 借助工具便捷的创建测试模板
- 方便的执行用例记录测试结果
- 测试不通过的用例自动提交给开发者追踪bug
- 可追踪,更方便的统计测试覆盖率
Popular Test Management tools are: Quality Center and JIRA
流行的测试管理工具有 uality Center and JIRA
参考
How to Write Test Cases: Sample Template with Examples
Sample Test Case Template With Test Case Examples
边栏推荐
- [Database] Four characteristics of transaction
- unity 代码拆分图集
- MPU6050 accelerometer and gyroscope sensor is connected with the Arduino
- 剑指Offer 32.Ⅰ从上到下打印二叉树
- 同时求最大值与最小值(看似简单却值得思考~)
- 云服务器web项目部署详解
- TC358860XBG BGA65 东芝桥接芯片 HDMI转MIPI
- bluez5.50+pulseaudio实现蓝牙音响音频播放
- Beckhoff ET2000 listener use
- 分割回文串 DP+回溯 (LeetCode-131)
猜你喜欢
随机推荐
KMP 字符串匹配
idea中创建jsp项目详细步骤
【详解】优先级队列的底层实现
Lightly 支持 Markdown 文件在线编写(文中提供详细 Markdown 语法)
bluez5.50+pulseaudio实现蓝牙音响音频播放
振芯科技GM8285C:功能TTL转LVDS芯片简介
2020 - AAAI - Image Inpainting论文导读《Learning to Incorporate Structure Knowledge for Image Inpainting》
逆序对数量与归并排序
引擎开发日志:重构骨骼动画系统
【数据库】事务的四大特性<详解>
联阳IT66121FN提供SDI转HDMI方案分享
学习(四):显示FPS,和自定义显示调试
unity学习(一):自动化创建模板脚本
MAC安装Mysql超详细完整教程
STM32F4 CAN 配置注意的细节问题
AD Actual Combat
剑指Offer 31.栈的压入、弹出
如何用 Lightly 进行 Debug 断点调试?
学习(二):单例模板
unity学习(五):Excel表格读取和数据类生成









