跟踪/记录负载测试参数
我找不到一种简单的方法来结合负载测试结果和跟踪自定义参数。
我有一个包含单个单元测试的负载测试。此单元测试调用带有一些参数的 Web 方法。有很多参数,每个参数都有大量的值。在负载测试期间,我想跟踪每个调用的上下文(参数值)和结果(错误、持续时间……),以便建立一些指标。我怎样才能做到这一点?
我知道我可以在单元测试中做到这一点,但我想让它尽可能简单。在 loadtestplugin
中,我无法关联 TestStarting
和 TestFinished
。
I can't find an easy way to combine load test results and tracing custom parameters.
I have a load test containing a single unit test. this unit test calls a web method with some parameters. There are many parameters and a large amount of values for each. During a load test, I want to trace the context (values of parameters) of each call and the results (error, duration, ...) in order to establish some metrics. How can I do that ?
I know I can do that inside the unit test, but I want to keep it as simple as possible. In a loadtestplugin
, I am unable to correlate TestStarting
and TestFinished
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能想到的唯一方法是使用 TestContext 对象的 BeginTimer 和 EndTimer 方法。对于每个 Web 方法调用,使用参数值作为计时器名称的一部分来启动一个或多个计时器。然后,在负载测试结果中,您将看到每个不同名称的计时器的单独结果。
我对网络测试做了类似的事情。
The only way I can think of to do this is to use the BeginTimer and EndTimer methods of the TestContext object. For each web method call, start up one or more timers using the parameter values as part of the timer name. Then in the load test results you'll see individual results for each differently named timer.
I do a similar thing for webtests.
Visual Studio 负载测试可以从运行测试的代理和控制器收集 Windows 性能计数器。它们也可以从其他计算机收集,通常是测试加载的服务器。
您可以安排将测试中的各种数据写入专门为您的测试创建的新 Windows 性能计数器。然后可以通过负载测试收集这些计数器,然后可以以与通常在负载测试中收集的计数器相同的方式对它们进行绘图和分析等。
有很多关于创建自己的性能计数器的网页,以及更多关于 Visual Studio 负载测试如何收集它们的网页。
Visual Studio load tests can collect Windows performance counters from the agents and controllers running the tests. They can also be collected from other computer, typically the servers being loaded by the test.
You could arrange that various data from your test is written to new Windows performance counters, created specifically for your tests. These counters can then be collected by the load test and they can then be graphed and analysed etc in the same way as the counters normally collected in a load test.
There are lots of web pages about creating your own performance counters plus many more about how a Visual Studio load test can collect them.