在Visual Studio Webtest中插入120秒等待 [英] Insert 120 second wait in Visual studio Webtest

查看:176
本文介绍了在Visual Studio Webtest中插入120秒等待的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在两个Web请求的执行之间增加120秒的延迟.我尝试使用思考时间,但不会在120秒内暂停执行.

I want to add a delay of 120 second between the execution of two web requests. I have tried using think time but it won't pause the execution for 120 sec.

任何人都可以让我知道如何添加等待时间来暂停执行120秒(例如说2个Web请求执行之后),然后继续执行下一个请求.

Can anyone please let me know how to add wait to pause the execution for 120 second (after say 2 web request execution) and then proceed the execution for next request.

我正在使用Visual Studio 2015.

I am using visual studio 2015.

推荐答案

在收到响应后之后处理思考时间.因此,要在两个请求之间有一个延迟,请在第一个请求上设置思考时间.我已经成功地使用了长时间的睡眠时间.可以在测试中禁用思考时间,因此请确保已将其启用:

Think times are processed after the response is received. So to have a delay between two requests set the think time on the first request. I have successfully used long sleep times. Think times can be disabled in a test so make sure they are enabled:

1在".testsettings"文件的 Web测试部分中.

1 In the ".testsettings" file, in the Web test section.

2在方案的 Think个人资料属性中.如果延迟应该(尽可能接近)精确到120秒,则将配置文件设置为On.

2 In the Think profile property of the scenario. If the delay should be (as near as possible to) exactly 120 seconds then set the profile to On.

3 Visual Studio运行独立的Web测试时的默认设置是不使用思考时间.因此,一切都尽可能快地运行.上面(1)中的设置可用于更改默认设置.可以通过Web测试结果窗口中的编辑测试设置"命令对默认值进行临时更改.此更改仅适用于在同一窗口中由单击此处再次运行"启动的测试运行.

3 The default for when Visual Studio runs a standalone web test is to not use think times. Thus everything runs as fast as possible. The setting in (1) above can be used to change the default. A temporary change to the default can be made from the "Edit test settings" command of the web test results window; this change only applies to test runs started by the "Click here to run again" in the same window.

如果两个请求实际上是不同的Web测试,则该场景的测试迭代之间的思考时间属性可能会有用.

If the two requests are actually different web tests then the Think time between test iterations property of the scenario may be useful.

如果有可能将此测试用作负载测试的一部分,则不要使用任何任务或线程delay(或sleep)方法,因为它们会阻止许多虚拟用户运行.有关完整说明,请参见此答案的第一部分.如果在负载测试中将从不使用网络测试,则可以使用delaysleep调用.

Do not use any of the task or thread delay (or sleep) methods if there is any chance that this test will be used as part of a load test as they will stop many virtual users from running. See the first part of this answer for a fuller explanation. A delay or sleep call might be used if the web test will never be used within a load test.

这篇关于在Visual Studio Webtest中插入120秒等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆