阅读下列说明,回答下列问题。
[说明]
某商店为购买不同数量商品的顾客报出不同的价格,其报价规则如表1所示。
如买11件需要支付10×30+1×27=327元,买35件需要支付10×30+10×27+10×25+5×22=930元。
现为该商家开发一个软件,输入为商品数C(1<=C<=100),输出为应付的价钱P。
1、请采用等价类划分法为该软件设计测试用例(不考虑C为非整数的情况)。
正确答案及解析
正确答案
解析
本题考查黑盒测试法及应用。
第一小题考查黑盒测试用例设计方法之等价类划分法。
等价类划分法是把程序的输入域按规则划分为若干子集,然后从每个子集中选取一个具有代表性的数据作为测试用例。本题中规定了C的取值范围(1<=C<=100),按规则可以划分为一个有效等价类{C|1<=C<=100}和两个无效等价类{C|C<1}、{C|C>100}。表1中对C取不同值有不同的处理,因此上述有效等价类还可以进一步细分为4个等价类{c11<=c<=10}、{C|11<=C<=20}、{C|21<=C<=30}、{C|31<=C<=100}。这样一共得到6个等价类,包括4个有效等价类{C|1<=C<=10}、{C|11<=C<=20}、{C|21<=C<=30}、{C|31<=C<=100}和两个无效等价类{C|C<1}、{C|C>100}。设计用例时从这6个等价类中任选一个代表数据即可。
你可能感兴趣的试题
Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.
-
- A.Artificial Intelligence
- B.Cloud Computing
- C.Internet of Things
- D.Big Data
- 查看答案
In project human resource management , ( )is not a source of power for the project manager.
-
- A.referent power
- B.expert power
- C.reward power
- D.audit power
- 查看答案
At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.
-
- A.detail feasibility analysis
- B.opportunity analysis
- C.economic feasibility analysis
- D.risk analysis
- 查看答案
( )is a grid that shows the project resources assigned to each work package.
-
- A.Stakeholder engagement assessment matrix
- B.Requirements traceability matrix
- C.Probability and impact matrix
- D.Responsibility assignment matrix
- 查看答案
Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.
-
- A.digital
- B.networking
- C.intelligentize
- D.informatization
- 查看答案