Pierre Greborio.NET

Talking about .NET world

Testing web service with Visual Studio Team System

When I used for the first time VSTS (beta 1) one of the miss I found was the "Web Service Test Project" (note: in RTM is still missing). I thought to possible workarounds and found the most intuitive way: unit testing.

Then I created many unit testing for each proxy class that I generated (note: remember that for test cases code generation the proxy class must be into another class library). After some successful tests I started to see how my web service works under load creating a load test. Increasing the number of concurrent users I got immediately some limitations on the client side (agent). I then checked the unit test limitations for web services and found and interesting point:

1.36   Visual Studio 2005 Team Edition for Testers: Set the Proxy Property of a SoapHttpClientProtocol Implementations to Null
If you are running a load test containing unit tests that call Web services, the unit test code should explicitly set the proxy property of the Web service proxy class that implements System.Web.Services.Protocols.SoapHttpClientProtocol. This prevents a performance bottleneck that can occur when the proxy must be automatically detected.


Even setting the proxy class I didn’t found any real improvement. My dual Xon 3GHZ with 2 GB RAM can’t run the test agent with more than 200 concurrent users. So, I had to find a smart way to test web service.

I completely changed my strategy. I created an empty web test project and added a web service request. In the body property I set the XML (SOAP) payload that I registered with WebServiceStudio (note: you can also trace the request messages with some trace tool from unit testing sessions). I added all my custom parameters (context parameters and data sources) just adding the correct syntax into the body, ie.

<soap:Body>
    <getSecurityPricesRequest xmlns="
http://services.peway.com/security/v3/messages">
      <codes>{{SID}}</codes>
      <HistoryPricePeriod DateFrom="2000-04-03T00:00:00" DateTo="2005-11-30T00:00:00" />
    </getSecurityPricesRequest>
  </soap:Body>

Run and wow, it works fine. Under load test I was able to run 1000 concurrent users. That is a definitive improvement. Now, I would have some wizard that helps me in building such request without copy&paste :-)

Posted: Nov 30 2005, 06:03 PM by PierreG | with 1 comment(s)
Filed under:

Comments

stobies said:

Setting the Proxy property to 'null' does not do the job. Reflector shows that a null Proxy value will not be propagated to the WebRequest that is generated. Instead, set it to a fresh instance of WebProxy. This will do the job of disabeling the proxy lookup.
# December 7, 2005 2:00 AM