当前位置:网站首页>TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
2022-07-25 18:01:00 【马丁•路德•王】
在testng注解中使用以下注解达到并发测试的目的,例如秒杀等:
invocationCount----表示执行的次数
threadPoolSize-----表示线程池的内线程的个数
timeOut-------超时时间-毫秒
代码:
import org.testng.annotations.Test;
public class mumu {
private static int i = 0;
@Test(threadPoolSize = 1, invocationCount = 10, timeOut = 1000)
public void ThreadTest() {
++i;
System.out.println("the i is -->" + i);
}
}这里设置的是每个线程池中线程是1,但是线程的个数取决于CPU的数量
更改
threadPoolSize =4
结果:
the i is -->3
the i is -->1
the i is -->1
the i is -->2
the i is -->7
the i is -->4
the i is -->5
the i is -->6
the i is -->8
the i is -->9
边栏推荐
- [MySQL]数据库中的索引为什么是用B+树来实现? 哈希表/红黑树/B树是否可行呢?
- Joseph Ring problem
- BiSeNet v1
- “Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0”问题解决
- 简述冒泡排序与快速排序
- Nineteen year old summary
- Take you to a preliminary understanding of multiparty secure computing (MPC)
- [untitled]
- ROS learning notes (IV) ROS cannot solve rosdep init or update
- Basic knowledge of software testing (mind mapping)
猜你喜欢

Tme2022 campus recruitment background development / operation development / business operation and maintenance / application development written examination (I) a little self analysis of programming q

食品安全 | 八问八答带你重新认识小龙虾!这样吃才对!

Talking about Devops monitoring, how does the team choose monitoring tools?

Cloud VR: the next step of virtual reality specialization
P2P 之 UDP穿透NAT的原理与实现

HCIP第一天实验

Drawing PDF form (II) drawing excel form style in PDF through iText, setting Chinese font, watermark, logo, header and page number

绘制pdf表格 (一) 通过itext实现在pdf中绘制excel表格样式并且实现下载(支持中文字体)

WPF 实现用户头像选择器

什么是 IP SSL 证书,如何申请?
随机推荐
更新|3DCAT实时云渲染 v2.1.2版本全新发布
Oracle使用impdp导入报错:ORA-39001: 参数值无效 ORA-39000: 转储文件说明错误 ORA-39088: 文件名不能包含路径说明
What scenarios have rust, which is becoming more and more mature, applied?
简述Synchronized以及锁升级
食品安全 | 八问八答带你重新认识小龙虾!这样吃才对!
Oracle导入出错:IMP-00038: 无法转换为环境字符集句柄
为什么数字化未来取决于3D实时渲染
Redis source code and design analysis -- 15. RDB persistence mechanism
Talking about Devops monitoring, how does the team choose monitoring tools?
Go channel simple notes
mysql case when
云VR:虚拟现实专业化的下一步
go defer与recover简单笔记
交叉验证(cv)学习笔记
Mock服务moco系列(二)- Json格式、File文件、Header、Cookie、解决中文乱码
OSPF综合实验
Landmark buildings around the world
大话DevOps监控,团队如何选择监控工具?
[MySQL]数据库中的索引为什么是用B+树来实现? 哈希表/红黑树/B树是否可行呢?
关于云XR介绍,以及5G时代云化XR的发展机遇