UML中一种功能测试用例设计模式

本文详细介绍了在UML中设计功能测试用例的一种模式,旨在确保测试用例与需求Use Case对应,提高路径覆盖,同时强调测试脚本与测试数据的分离,以降低耦合性和提高维护性。内容涵盖了测试用例设计的基本规则,如测试用例的组成、脚本与数据的分离、需求覆盖性设计,并提出了测试用例度量参数,包括脚本的易用性、易维护性、完整性等。
摘要由CSDN通过智能技术生成

UML中一种功能测试用例设计模式


作者:廖光明 (
liaogm2002@hotmail.com


 1   概要

1.1  目的

统一项目系统测试阶段测试用例设计方法,达到测试用例与需求Use Case对应,路径覆盖较好、维护方便,测试脚本与数据分离、偶合性低,场景清晰的目的。

1.2  术语说明

按照UML规则和RUP过程,引入如下术语:

Test case

The specification (usually formal) of a set of test inputs, execution conditions, and expected results, identified for the purpose of making an evaluation of some particular aspect of a target test item.

测试用例是为特定测试目标开发的测试输入、执行条件和预期结果的集合。这些特定目标可以是:验证一个特定的程序路径或核实是否符合特定需求。

Use-Case model

A model that describes a system's functional requirements in terms of use cases.

Use Case

A description of system behavior, in terms of sequences of actions.

Action

The specification of an executable statement that forms an abstraction of a computational procedure. An action typically results in a change in the state of the system, and can be realized by sending a message to an object or modifying a link or a value of an attribute.

Use Case instance

 Use Case instance is the performance of a sequence of actions being specified in a Use Case. A use-case instance is a specific "end-to-end" concrete path through a Use Case—actors are replaced by specific persons (actor instances), specific values and responses are given and only a single path is taken through one or more possible flows of the Use Case. See also: scenario

Scenario

A specific sequence of actions that illustrates behaviors. A scenario may be used to illustrate an interaction or the execution of one or more use-case instances.

Test script

A collection of step-by-step instructions that realize a test, enabling its execution. Test scripts may take the form of either documented textual instructions that are executed manually or computer readable instructions that enable automated test execution.

Test suite

A  package-like artifact used to group collections of test scripts, both to sequence the execution of the tests and to provide a useful and related set of Test Log information from which Test Results can be determined..Synonyms: test driver.

 

2   适用范围

适用于项目功能测试Test Case的设计。

由于测试用例的复杂性,需要特殊设计的Case,可不受本规范限制。

 

3   测试用例设计基本规则

3.1  测试用例组成

按照测试用例的定义,测试用例包括输入、执行步骤和期望结果三个基本组成部分。

3.2  测试脚本与测试数据分离

 按照测试脚本(Test Script)的定义,测试脚本包括两种类型:

l  用于指导手工测试执行的操作步骤文字描述

l  用于自动测试能被计算机识别的操作步骤代码。

测试程序就是测试操作过程,一个测试程序可输入不同特性的数据,如:典型数据值、边界值、异常值等。因此,为提高脚本使用效率,测试程序与测试数据分离管理。

 

3.3  测试用例需求覆盖性设计

3.3.1  把 Use-Case model 分解为 Use Case

按照UML的定义:Use-Case model 通过Use Case来描述系统的功能需求。为使Use-Case model可测试,可把Use-Case model分解为Use Case,形成具有明确输入,输出和action组合的功能单元。 

 

 

 

3.3.2 从场景生成测试用例

用于功能性测试的测试用例来源于测试目标的Use CaseUse Case中不同的路径确定一个Use Case instance既一个场景,每个场景必需编制测试用例。通过测试用例与Use Case instance的对应来尽可能覆盖测试目标的需求。对应关系如下所示:

 

 

 

3.3.2 场景由分枝构成

根据定义,场景包括一个或以上的分枝;每个场景包括起点、终点和Use Case中某些特定分枝的组合(路径)。生成每个场景的测试用例是通过确定某个特定条件来完成的,这个特定条件将导致特定用例场景的执行。

Use Case的与分枝关系图如下:

 

 

 

因此,根据Use Case中不同分枝(即不同备选流

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值