metersphere的功能接口用例数统计

文章介绍了Metersphere作为开源性能测试工具在统计功能和接口用例方面的应用。详细提供了SQL查询示例,包括人员维度和项目维度的用例数统计,展示了如何按年份统计有效用例,并按数量进行排序。此外,还探讨了不同类型的COUNT函数在统计中的差异。
摘要由CSDN通过智能技术生成

前言

大家好,我是空空star,本篇给大家分享一下《metersphere的功能接口用例数统计》。

metersphere介绍

Metersphere是一款功能强大的开源性能测试工具,可以帮助用户测试和监控各种类型的应用程序,包括Web应用、移动应用、微服务、API、数据库等。Metersphere提供了丰富的功能和特性,可以满足各种性能测试需求,包括压力测试、负载测试、容量规划和性能分析等。

用例数统计

统计功能用例数

人员维度统计

  1. 统计每个人员2023年的有效功能用例数
    要求:输出字段 创建人、功能用例数,只展示有创建功能用例的人员
select create_user 创建人,count(1) 功能用例数
from test_case tc 
where tc.status !='Trash' 
and tc.delete_time  is null 
and FROM_UNIXTIME(create_time/1000,'%Y')='2023'
group by create_user 
  1. 统计每个人员2023年的有效功能用例数
    要求:输出字段 创建人、功能用例数,展示平台所有用户,并按功能用例数降序
select u1.id 创建人,u2.case_num 功能用例数
from user u1
left join (
	select create_user,count(1) case_num
	from test_case tc 
	where tc.status !='Trash' 
	and tc.delete_time  is null 
	and FROM_UNIXTIME(create_time/1000,'%Y')='2023'
	group by create_user 
) u2
on u1.id=u2.create_user
order by u2.case_num desc 

项目维度统计

  1. 统计每个项目下2023年创建的有效功能用例数
    要求:输出字段 项目id,项目名称,功能用例数;只展示有功能用例的项目
select p.id 项目id,p.name 项目名称,count(1) 功能用例数
from project p 
join test_case tc 
on p.id=tc.project_id 
and  tc.status !='Trash' 
and tc.delete_time  is null 
and FROM_UNIXTIME(tc.create_time/1000,'%Y')='2023'
group by p.id,p.name
  1. 统计每个项目下2023年创建的有效功能用例数
    要求:输出字段 项目id,项目名称,功能用例数;展示平台所有项目,并按功能用例数降序
select p.id 项目id,p.name 项目名称,count(tc.id) 功能用例数
from project p 
left join test_case tc 
on p.id=tc.project_id 
and  tc.status !='Trash' 
and tc.delete_time  is null 
and FROM_UNIXTIME(tc.create_time/1000,'%Y')='2023'
group by p.id,p.name
order by count(tc.id) desc 

统计接口用例数

人员维度统计

  1. 统计每个人员2023年的有效接口用例数
    要求:输出字段 创建人、接口用例数,只展示有创建接口用例的人员

select create_user_id 创建人,count(1) 接口用例数
from api_test_case tc
where tc.status !=‘Trash’
and tc.delete_time is null
and FROM_UNIXTIME(create_time/1000,‘%Y’)=‘2023’
group by create_user_id

  1. 统计每个人员2023年的有效接口用例数
    要求:输出字段 创建人、接口用例数,展示平台所有用户,并按接口用例数降序

select u1.id 创建人,u2.api_case_num 接口用例数
from user u1
left join (
select create_user_id,count(1) api_case_num
from api_test_case tc
where tc.status !=‘Trash’
and tc.delete_time is null
and FROM_UNIXTIME(create_time/1000,‘%Y’)=‘2023’
group by create_user_id
) u2
on u1.id=u2.create_user_id
order by u2.api_case_num desc

或者

select u1.id 创建人,count(u2.id) 接口用例数
from user u1
left join api_test_case u2
on u1.id=u2.create_user_id
and u2.status !=‘Trash’
and u2.delete_time is null
and FROM_UNIXTIME(u2.create_time/1000,‘%Y’)=‘2023’
group by u1.id
order by count(u2.id) desc

项目维度统计

  1. 统计每个项目下2023年创建的有效接口用例数
    要求:输出字段 项目id,项目名称,接口用例数;只展示有接口用例的项目

select p.id 项目id,p.name 项目名称,count(1) 接口用例数
from project p
join api_test_case tc
on p.id=tc.project_id
and tc.status !=‘Trash’
and tc.delete_time is null
and FROM_UNIXTIME(tc.create_time/1000,‘%Y’)=‘2023’
group by p.id,p.name

  1. 统计每个项目下2023年创建的有效接口用例数
    要求:输出字段 项目id,项目名称,接口用例数;展示平台所有项目,并按接口用例数降序

select p.id 项目id,p.name 项目名称,count(tc.id) 接口用例数
from project p
left join api_test_case tc
on p.id=tc.project_id
and tc.status !=‘Trash’
and tc.delete_time is null
and FROM_UNIXTIME(tc.create_time/1000,‘%Y’)=‘2023’
group by p.id,p.name
order by count(tc.id) desc

思考:

count(1)count(*)count(field)count(distinct field) 有什么区别?

总结

评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

空空star

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值