如何使用 Visual Studio 2010 创建 Web 服务负载测试? [英] How to create a web service load test using Visual Studio 2010?

查看:29
本文介绍了如何使用 Visual Studio 2010 创建 Web 服务负载测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法像测试网站一样使用 VS2010 测试 Web 服务?

Is there a way to test a Web Service using VS2010 like it's used to test a web site?

对于一个网站,我可以创建一组 WebTestRequest 对象来模拟从测试中加载和解析网页,然后实现 GetRequestEnumerator 我可以为负载测试产生结果,以便执行时间和有效负载任何单个页面的内容都可以由测试运行器评估并发布在我的测试运行报告中.

For a web site I can create a set of WebTestRequest objects that emulate the loading and the parsing of a web page from the test and then, implementing the GetRequestEnumerator I can yield results to the load test so that the execution time and payload of any single page could be evaluated by the test runner and published in my test run reports.

我想对使用 Web 服务调用的测试执行相同的操作,以便每次调用 Web 服务时(调用它时都有一些逻辑,例如登录、获取安全令牌并传递正确格式的 XML 文档到 Web 服务方法)我可以将结果提供给我的测试运行程序并对其进行评估.

I would like to do the same for a test using web service call so that each time I call the web service (there is some logic in calling it, like logging in, getting a security token and pass a proper formatted XML document to the web service method) I can yield the result to my test runner and evaluate it.

有没有办法做到这一点,或者我是否需要实现从 WebTestItem 抽象类继承的特定类?

Is there a way to do it or do I need to implement a specific class inheriting from the WebTestItem abstract class?

问候马西莫

推荐答案

是的,可以在 Visual Studio 2010 Ultimate 中使用 Web 性能测试来测试 Web 服务.

Yes, it is possible to test Web Services using Web Performance Tests in Visual Studio 2010 Ultimate.

这里有几个有用的链接:

Here's a couple of useful links:

  • How to: Create a Web Service test (MSDN)
  • How to: Web Service Load Testing Using VSTS 2010 (Blog)

作为起点,您可以使用诸如 Fiddler 之类的网络代理工具来拦截 HTTP 请求制作到 Web 服务,复制 Web 性能测试中 SOAP 信封的内容,然后根据您要模拟的测试场景对它们进行相应调整.

As a starting point, you can use a web proxy tool like Fiddler to intercept the HTTP requests made to the Web Services, copy the contents of the SOAP envelopes in the Web Performance Tests and then tweak them accordingly based on the test scenario you want to simulate.

这篇关于如何使用 Visual Studio 2010 创建 Web 服务负载测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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