Boundary Value Analysis 边界值分析
前言一、边界值分析是什么?二、例题例题一例题二例题三例题四总结前言
一、边界值分析是什么?
边界值分析方法是对等价类划分方法的补充。输入输出的等价类边界就是应当着重测试的边界情况。+使用输入变量的最小值(min),略高于最小值(min+),名义值(nom),略低于最大值(max-),以及最大值(max)边界值分析是基于单缺陷假设single fault的。边值分析的简单推广,即考虑健壮性设计,超出有效范围的值略大于最大值(max+)和略小于最小值(min-)的值
二、例题
例题一
假设GradeRecord函数能够根据输入的单科成绩,把低于60分的成绩登记为‘不及格’,大于等于60分按照实际成绩登记。试用边界值分析法为其设计测试用例。
答案:
例题二
答案
例题三
答案
例题四
Consider a method fp, brief for findPrice, that takes two inputs code and qty. The item code is represented by the integer code and the quantity purchased by another integer variable qty. fp accesses a database to find and display the unit price, the description, and the total price of the item corresponding to code. fp is required to display an error message, and return, if either of the two inputs is incorrect. Assuming that an item code must be in the range 99…999 and quantity in the range 1…100.
Please give your test cases using boundary-value analysis.
答案