白盒测试
Posted 平原上的维克多
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了白盒测试相关的知识,希望对你有一定的参考价值。
分支的粒度: 判断 > 条件
判定覆盖:每个判断整体真假两种情况被覆盖
条件覆盖:每个判断中每个条件真假两种情况被覆盖
判定-条件覆盖:每个判断整体真假两种情况被覆盖且每个判断中每个条件真假两种情况被覆盖
条件组合覆盖:每个判断的所有可能的条件取值组合至少执行一次。
路径覆盖:每条分支路径被覆盖
mtotal=0,total=0,weekday=0;
day_of_month=[31,28,31,30,31,30,31,31,30,31,30]
year, month, day = eval(input("请分别输入年,月,日(如:1998,6,18):"))
for i in range(month):
mtotal+=day_of_month[i]
total=(year-1)*365+(year-1)/400+(year-1)/4-(year-1)/100+mtotal+day;
weekday=total%7
if weekday == 1:
print(",, is Monday\\n".format(year, month, day))
elif weekday == 2:
print(",, is Tuesday\\n".format(year, month, day))
elif weekday == 3:
print(",, is Wednesday\\n".format(year, month, day))
elif weekday == 4:
print(",, is Thursday\\n".format(year, month, day))
elif weekday == 5:
print(",, is Friday\\n".format(year, month, day))
elif weekday == 6:
print(",, is Saturday\\n".format(year, month, day))
elif weekday == 7:
print(",, is Sunday\\n".format(year, month, day))
以上是关于白盒测试的主要内容,如果未能解决你的问题,请参考以下文章