Freigeben über


How To: Web Service Load Testing Using VSTS 2010

Syed Aslam Basha here. I am a tester on the Information Security Tools team.

Apart from performance testing for web sites, I have done load testing on web services for many of our projects. I will show how to create a web test for web service using Visual studio team system 2010 (VSTS) which can be used in load testing.

Steps to create web test for web service:

  • Click on start, select VS, right click and select run as administrator

WebService1

  • Click on File –> New –> Project
  • Select Test project and give appropriate name

WebService2 

  • Select the project, right click and select Add New Test

WebService3 

  • Select Web Test and give appropriate name for web test, click on ok

WebService4 

 

  • It will start IE in recording mode. Click on Stop

image 

  • Right click on the web test and select add web service request

WebService6

WebService5

  • Url should be the asmx file of web service and you could also set response goal time say 5 seconds (response time of the web service should be 5 seconds)
  • Right click on the Url and select add header
  • Select headers first node

image 

  • Select Name as SoapAction and enter value as shown, SoapAction indicates, its a SOAP request and the value of the header is URI

image

  • Enter value in string body, which is a soap envelop. Select content type as text/xml

image

  • Ex: String body value

        1: <?xml version="1.0" encoding="utf-8"?>
        2: <soap:Envelope xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/">
        3:   <soap:Body>
        4:     <GetGeneratedResponse xmlns="https://tempuri.org/">
        5:       <challenge>{{HSM1.HSM.ChallengeCode}}</challenge>
        6:       <cardGUID>{{HSM1.HSM.CardGUID}}</cardGUID>
        7:     </GetGeneratedResponse>
        8:   </soap:Body>
        9: </soap:Envelope>
    
  • You can get the soap envelop and soap action values by visiting asmx page of web service under test
  • The web service under test requires two values challenge and cardguid, it processes and returns response. In the above code am passing challenge code and card guid, these can be hard coded. But I have data bind them, where HSM1 is database, HSM is table name and challengecode is column name. The parameters values should be in {{ parameter name }} or simply a value without parenthesis.
  • Data binding is simple, click on the add data source button and select a database

image

  • Run the web test and make sure there aren’t any issues before using it for load testing
  • Your web test for web service is ready and your good to go ahead and use in a load test scenario ( For more information on performance testing, you can refer to my blog post on website performance testing simplified)

-Syed