VSTS Web负载测试是否具有全球思考时间? [英] Does VSTS web load testing have Global think time?
问题描述
VSTS是否具有任何内置功能来声明脚本的全局思考时间。因此,如果需要编辑所有请求的思考时间,则不需要遍历每个请求而是需要更改全局变量将
更改脚本中的所有思考时间。
Does VSTS have any in built functionality to declare a global think time for a script, So in case there is a need to edit think time for all requests then every request will not be needed to be traversed instead a point change of the global variable will change all the think times in the script.
推荐答案
在每个请求上设置思考时间。思考配置文件中有一个三值设置(在RunSettings中),无论是ON还是OFF或NormalDistribution,请参阅
https://docs.microsoft.com/en-us/visualstudio/test/edit-think-负载测试场景时间?view = vs-2017
没有内置设施可以全局改变它们。但是,编写一个可以修改Web测试中所有思考时间的插件很容易。基本代码如下,您可以在其中编写"修改"按钮。方法。
There is no built-in facility to globally alter them. However, it is easy to write a plugin that can modify all think times in a web test. The basic code is as below, where you can write the "modify" method.
public class AlterThinkTimes : WebTestPlugin
{
public override void PreRequest(object sender, PreRequestEventArgs e)
{
int thinkTime = e.Request.ThinkTime;
int newThinkTime = modify(thinkTime);
e.Request.ThinkTime = newThinkTime;
}
}
问候
Adrian
Regards
Adrian
这篇关于VSTS Web负载测试是否具有全球思考时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!