重要的软件测试度量和度量指标(2)——附带例子和图表

本文介绍了软件测试中的关键指标及其计算方法,包括测试用例执行百分比、通过及失败用例百分比等,并探讨了缺陷密度、缺陷改进率等质量评估指标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

计算指标的定义和公式:

1.测试用例执行的百分比:这个指标是用来获取测试用例的执行状态的百分比。


用例执行百分比=(执行的用力个数/总的用例个数) *100

所以从上面的数据可得,


用例执行百分比=( 65/100) *100=65%

2.没执行用例的百分比:这个指标是用来获取待测试用例的执行状态的百分比。


未执行的测试用例的百分比=(未执行用例/总的用例个数) *100

所以从上面的数据可得,


中断用例的百分比=( 35/100) *100=35%


这里写图片描述
这里写图片描述

3.通过用例百分比:这个指标是用来获得已测试用例中通过的用例的百分比


通过用例百分比=(用例通过个数/总的已测试用例数) *100

所以从上面的数据可得,


用例通过百分比=( 30/65) *100=46%

4.用例失败百分比:这个指标是用来获取已测试用例中失败用例的百分比。


用例失败百分比=(失败用例个数/总的已测试用例个数) *100

所以从上面的数据可得,


用例失败百分比=(26/65)*100=40%

5.中断用例百分比:这个指标是用来获得已测试用例中中断用例的百分比。 可用一个更为详尽的报告说明测试用例中断的具体原因。


中断用例百分比=(中断用例个数/总的已测试用例个数)*100

所以从上面的数据可得,


中断用例百分比=( 9/65) *100=14%


这里写图片描述
这里写图片描述

6.缺陷密度=确定的缺陷数/大小
这里的“大小”被认定为需求。因此这里的缺陷密度指的是每个需求中被确认的缺陷数。同样的,缺陷密度还可以被计算为每 100 行代码含有多少缺陷或者每个模块含有的缺陷数。
所以从上面的数据可得,


缺陷密度=(30/5)=6

7.缺陷的改进率=( QA 测试发现的缺陷数/( QA 测试发现的缺陷数+用户使用发现的缺陷数)) *100
缺陷的改进率用于判定系统的测试效果。
假如,在开发和 QA 测试阶段,我们可以发现 100 个缺陷,在 QA 测试之后,在α和β测试,用户/客户使用发现的缺陷为 40 个,这些缺陷可以在 QA 测试阶段被发现,那么,缺陷改进率就可以被定义为:


缺陷改进率=[100/(100+40)]*100=71%

8.漏测率:漏测指标用于定义 QA 的测试效率,在 QA 测试中有多少缺陷被漏测。
漏测率=(非 QA 测试发现的缺陷数/QA 测试发现的缺陷数)*100
假如,在开发和测试期间,我们可以发现 100 个缺陷,在 QA 测试之后,在α和β测试,用户/客户使用发现的缺陷为 40 个,这些缺陷可以在 QA 测试阶段被发现,那么,缺陷改进率就可以被定义为:


漏测率=( 40/100) *100=40%

9.缺陷的优先级:这个指标被用于定义缺陷基于严重程度/优先级分类的个数,以决定软件的质量。
严重缺陷的百分比:严重缺陷个数/总的缺陷数*100
从上面的表中的数据可得:


严重缺陷百分比=6/30*100=20%

优先级别较高的缺陷的百分比:优先级别较高的缺陷个数/总的缺陷数*100
从上面的表中的数据可得:


优先级别较高的缺陷百分比=10/30*100=33.33%

一般缺陷的百分比:一般的缺陷个数/总的缺陷数*100
从上面的表中的数据可得:


一般缺陷百分比=6/30*100=20%

轻微缺陷的百分比:轻微缺陷个数/总的缺陷数*100
从上面的表中的数据可得:


轻微缺陷百分比=8/30*100=27%


这里写图片描述

结论:

  本文中提供的指标主要用于生成每日/每周状态报告和准确的数据在开发/测试用例执行阶段并且这也是跟踪项目状态和软件的质量有效性方法。

  关于作者:这篇文章由 Anuradha k 编写.她有 7 年以上的软件测试工作经验,目前在一家跨国公司担任顾问。她也有很好的手机自动化测试的知识。

  在你的项目你用的是什么测试度量方法?像往常一样,请留下评论让我们知道你的想法。

原文如下:

Definitions and Formulas for Calculating Metrics:

#1) %ge Test cases Executed: This metric is used to obtain the execution status of the test cases in terms of %ge.
%ge Test cases Executed = (No. of Test cases executed / Total no. of Test cases written) * 100.
So, from the above data,
%ge Test cases Executed = (65 / 100) * 100 = 65%

#2) %ge Test cases not executed: This metric is used to obtain the pending execution status of the test cases in terms of %ge.
%ge Test cases not executed = (No. of Test cases not executed / Total no. of Test cases written) * 100.
So, from the above data,
%ge Test cases Blocked = (35 / 100) * 100 = 35%


这里写图片描述
这里写图片描述

#3) %ge Test cases Passed: This metric is used to obtain the Pass %ge of the executed test cases.
%ge Test cases Passed = (No. of Test cases Passed / Total no. of Test cases Executed) * 100.
So, from the above data,
%ge Test cases Passed = (30 / 65) * 100 = 46%

#4) %ge Test cases Failed: This metric is used to obtain the Fail %ge of the executed test cases.
%ge Test cases Failed = (No. of Test cases Failed / Total no. of Test cases Executed) * 100.
So, from the above data,
%ge Test cases Passed = (26 / 65) * 100 = 40%

#5) %ge Test cases Blocked: This metric is used to obtain the blocked %ge of the executed test cases. A detailed report can be submitted by specifying the actual reason of blocking the test cases.
%ge Test cases Blocked = (No. of Test cases Blocked / Total no. of Test cases Executed) * 100.
So, from the above data,
%ge Test cases Blocked = (9 / 65) * 100 = 14%


这里写图片描述
这里写图片描述

#6) Defect Density = No. of Defects identified / size
(Here “Size” is considered as requirement. Hence here the Defect Density is calculated as number of defects identified per requirement. Similarly, Defect Density can be calculated as number of Defects identified per 100 lines of code [OR] No. of defects identified per module etc.)
So, from the above data,
Defect Density = (30 / 5) = 6

#7) Defect Removal Efficiency (DRE) = (No. of Defects found during QA testing / (No. of Defects found during QA testing +No. of Defects found by End user)) * 100
DRE is used to identify the test effectiveness of the system.
Suppose, During Development & QA testing, we have identified 100 defects.
After the QA testing, during Alpha & Beta testing, end user / client identified 40 defects, which could have been identified during QA testing phase.
Now, The DRE will be calculated as,
DRE = [100 / (100 + 40)] * 100 = [100 /140] * 100 = 71%

#8) Defect Leakage: Defect Leakage is the Metric which is used to identify the efficiency of the QA testing i.e., how many defects are missed / slipped during the QA testing.
Defect Leakage = (No. of Defects found in UAT / No. of Defects found in QA testing.) * 100
Suppose, During Development & QA testing, we have identified 100 defects.
After the QA testing, during Alpha & Beta testing, end user / client identified 40 defects, which could have been identified during QA testing phase.
Defect Leakage = (40 /100) * 100 = 40%

#9) Defects by Priority: This metric is used to identify the no. of defects identified based on the Severity / Priority of the defect which is used to decide the quality of the software.
%ge Critical Defects = No. of Critical Defects identified / Total no. of Defects identified * 100
From the data available in the above table,
%ge Critical Defects = 6/ 30 * 100 = 20%
%ge High Defects = No. of High Defects identified / Total no. of Defects identified * 100
From the data available in the above table,
%ge High Defects = 10/ 30 * 100 = 33.33%
%ge Medium Defects = No. of Medium Defects identified / Total no. of Defects identified * 100
From the data available in the above table,
%ge Medium Defects = 6/ 30 * 100 = 20%
%ge Low Defects = No. of Low Defects identified / Total no. of Defects identified * 100
From the data available in the above table,
%ge Low Defects = 8/ 30 * 100 = 27%


这里写图片描述

Conclusion:

The metrics provided in this article are majorly used for generating the daily/weekly status report with accurate data during test case development/execution phase & this is also useful for tracking the project status & Quality of the software.

About the author: This is a guest post by Anuradha K. She is having 7+ years of software testing experience and currently working as a consultant for a MNC. She is also having good knowledge of mobile automation testing.

Which other test metrics do you use in your project? As usual, let us know your thoughts/queries in comments below.

### ChEMBL 数据库简介及其应用 ChEMBL 是一个开放访问的数据库,包含了大量关于生物活性的小分子化合物的信息。它广泛应用于药物研发领域中的靶点验证、先导化合物发现优化等方面[^1]。 以下是利用 R 语言处理 ChEMBL 中化合物、靶点基因相关数据的具体方法: --- #### 安装必要的包并加载依赖项 要使用 R 处理 ChEMBL 的数据,需安装 `rchemcpp` 其他辅助包(如 `dplyr`, `ggplot2`)。以下为代码示例: ```R install.packages("rchemcpp") library(rchemcpp) library(dplyr) library(ggplot2) ``` --- #### 获取化合物与靶点信息 通过调用 ChEMBL API 或者预下载的数据集获取目标化合物及其对应的靶点基因信息。下面展示了一个简单的例子,说明如何检索特定靶点上的化合物列表。 ```R # 设置 ChEMBL 查询参数 target_id <- "CHEMBLXXXX" # 替换为目标靶点ID compounds <- fetchCompoundsByTarget(target_id) # 查看前几条记录 head(compounds) ``` 上述命令会返回一系列针对指定靶点具有已知活性的化合物,并附带其 IC50/pIC50 值等实验指标[^4]。 --- #### 数据清洗与整理 由于原始数据可能存在缺失值或者冗余字段,在实际建模之前通常需要对其进行初步清理工作。这里给出一种通用做法: ```R cleaned_data <- compounds %>% filter(!is.na(IC50)) %>% # 移除缺少重要属性(比如IC50)的样本 mutate(log_IC50 = log10(IC50)) # 添加新的特征列 (取对数转换增强线性关系表现力) summary(cleaned_data$log_IC50) # 统计描述新变量分布情况 ``` --- #### 构建预模型 假设我们想要建立一个回归模型用来估计未知化合物对于某类疾病的抑制效果,则可以根据已有训练集中包含的标准度量标准(pIC50),采用随机森林(Random Forests)算法实现如下操作流程: ```R set.seed(123) # 设定种子保证结果可重复再现 train_index <- sample(nrow(cleaned_data), size=floor(.8*nrow(cleaned_data))) training_set <- cleaned_data[train_index, ] testing_set <- cleaned_data[-train_index, ] model_rf <- randomForest(log_IC50 ~ . , data=training_set ) print(model_rf$importance) # 输出各输入维度的重要性评分 predictions_test <- predict(object=model_rf,newdata=testing_set[,names(training_set)[-which(names(training_set)=='log_IC50')]]) cor(predictions_test,testing_set$log_IC50)^2 # 计算决定系数(R&sup2;)评估拟合优劣程度 ``` 以上脚本片段展示了完整的端到端解决方案框架——从准备阶段直至最终性能评环节均有所涉及。 --- #### 可视化分析成果 最后一步便是借助图形工具直观呈现所得结论。例如绘制散点图比较真实观值同预值得差异状况: ```R comparison_df <- cbind(testing_set$log_IC50,predictions_test) colnames(comparison_df)<-c('True','Predicted') ggplot(data=comparison_df,aes(x=True,y=Predicted))+geom_point()+theme_minimal()+ labs(title="Comparison Between True and Predicted Values",x="Actual Log IC50",y="Estimated Log IC50") + geom_abline(intercept = 0,slope = 1,color='red',linetype='dashed') ``` 此图表有助于快速判断我们的机器学习方案是否合理有效。 --- ### 结论 综上所述,结合 ChEMBL 提供的强大资源基础再加上灵活运用统计编程环境下的高级技术手段,能够极大地促进现代医药科学探索进程的发展步伐。无论是早期筛选还是后期验证阶段都可以发挥重要作用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值