Introduction
Web Services are more commonly developed and used to expose the APIs for other systems to consume. A number of external systems consume the web services on a very frequent basis.
Load testing is a good way to test how the web service behaves under the heavy load before going live. The load test results help in many ways to improve the performance of the web service.
Sample Web Service
I came across a nice and simple calculator web service designed to perform basic mathematical operations – Add, Divide, Multiply, Subtract.
Calculator web service: http://www.dneonline.com/calculator.asmx

We will use this web service to carry out the load testing.
Prerequisites
You will need,
- Visual Studio Enterprise - https://www.visualstudio.com/vs/enterprise/
- Visual Studio Team Services account - https://www.visualstudio.com/team-services/
Load Test Project in Visual Studio
- Open Visual Studio.
- File -> New Project -> Test -> Web Performance and Load Test Project.

- By default, the project template will have WebTest1.webtest created for you. The web test is used to test the single page.
- Right click the WebTest1 node and select Add Request.

- Now, right click the http://localhost/ node and select Properties.

- In the Properties window, enter the URL of the web service to test.

- Click “Run Test”.

- The Run test should pass as below.

Configure web test to test specific web method
- Open the web service (for e.g. http://www.dneonline.com/calculator.asmx) in a browser.
- Select the web method you want to test (e.g. Add).
- See the SOAP message. It contains SOAPAction.

- In the web test, right click and select “Add Header”.

- In Name property, type SOAPAction.
- In the Value property, type the value of SOAPAction (for e.g. http://tempuri.org/Add).

- Choose String Body node and in Content Type property enter a value of text/XML.
- In the String Body property, paste the contents of XML portion of the SOAP request from the Web service description page.
E.g
- <?xml version="1.0" encoding="utf-8"?>
- <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
- <soap:Body>
- <Add xmlns="http://tempuri.org/">
- <intA>int</intA>
- <intB>int</intB>
- </Add>
- </soap:Body>
- </soap:Envelope>
















Join the conversation! Your thoughts help the community grow.