在 Visual Studio 负载测试中指定测试结束条件
我正在使用 Visual Studio 负载测试测试大型 BizTalk 系统。负载测试将消息推送到 MQ,这些消息由 BizTalk 拾取然后进行处理。
我希望当且仅当满足某些条件时测试才结束(在我的情况下 if (SELECT COUNT (*) 来自 BizTalkMsgBoxDb.dbo.Spool) == 4
)。
我可以看到很多在测试完成后运行内容的方法,但没有明显的方法来扩展测试并继续监视,除非满足某些用户定义的退出条件。
这是否可能,或者如果不可能,是否有人有一个好的解决方法/黑客的想法来实现这一目标?
I'm testing a large BizTalk system using Visual Studio Load Test. Load Test to pushes messages into MQ, these are picked up by BizTalk and then processed.
Rather than having the test finish (and all performance counters ending) as soon as Visual Studio has finished injecting messages to MQ, I want the test to end if and only if some condition is met (in my case if (SELECT COUNT(*) FROM BizTalkMsgBoxDb.dbo.Spool) == 4
).
I can see a bunch of ways to run stuff after the test is complete, but no obvious way to extend the test and continue monitoring unless some user-defined exit condition is met.
Is this possible, or if not, does anyone have an idea for a good work-around/hack to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要编写一个自定义负载测试插件。详细信息从此 URL 开始: http://msdn.microsoft.com/en-us /library/ms243153.aspx
该插件可以操纵场景,延长测试的持续时间,直到满足您的条件。
You'll want to write a custom load test plugin. Details begin at this URL: http://msdn.microsoft.com/en-us/library/ms243153.aspx
The plugin can manipulate the scenario, extending the duration of the test until your condition is met.
我想您希望在对一堆请求进行排队后保持负载测试运行,以便在处理请求时继续监视性能。虽然我们无法控制负载测试的持续时间,但有一种方法可以实现这一点。
$LoadTestUserContext
形式访问,并且仅在负载测试中可用,而在负载测试中不可用)独立运行网络测试)。TestFinished
事件的用户上下文中查找标志值。找到该值后,插件将调用LoadTest.Abort()
。此方法有一个小缺点:测试状态在结果数据库中被标记为
Aborted
。I imagine you want to keep the load test running after queueing up a bunch of requests in order to continue to monitor the performance while the requests are processed. Although we can't control the load test duration, there is a way to achieve this.
$LoadTestUserContext
, and is only available in a load test, not when running a webtest standalone).TestFinished
event. When the value is found, the plugin callsLoadTest.Abort()
.There is one minor disadvantage to this method: the test state is marked as
Aborted
in the results database.在撰写本文时,(仍然)无法使用自定义负载测试插件来延长测试的持续时间,也无法通过拒绝退出的虚拟用户类型来延长测试的持续时间,也无法通过锁定测试的关闭期并阻止它从那种方式退出。
我们设法做这样的事情的唯一方法是直接操作 LoadTest 数据库并随后从日志文件注入性能计数器数据,但这既不明智也不推荐。
那好吧..
At time of writing there is (still) no way to extend the duration of the test using a custom load test plugin, nor by having a virtual user type that refused to exit, nor by locking the close-down period of the test and preventing it from exiting that way.
The only way we managed to do something like this was to directly manipulate the LoadTest database and inject performance counter data in afterwards from log files, but this is neither smart nor recommended.
Oh well..