How to test web services – Intro


How do I go about testing web services?

I often get asked the question “How do I go about testing web services?” and the answer I always give may surprise you – the same way you would test any other application!

In general, the best approach to normal functional testing is the same for web services (except for the fact that unlike most other applications, web services don’t have GUI user interfaces). So take comfort in knowing the functional testing techniques that you have always used still apply. Simply think of a web service as a business process without a UI, and write your test case accordingly.

Because web services can be use by many different clients and used in multiple ways, performance testing and negative testing do become more critical. I would suggest you make sure there is good test coverage in those areas. Some good question to ask when automating a web service are:

  • Does the service respond with the correct values?
  • How quickly does the service send a response to the user?
  • Can the service handle expected and unexpected user loads?
  • Can the service handle invalid values and exceptions caused by bad data?


The biggest hurdle for most testers is acclimating to the terminology used when talking about web services. For instance:

  • WSDLs – an XML format that tells you how to access a web service. WSDL are using that is automatically generated for you. Most test tools read in a WSDL and present all the information you need to interact with it.
  • SOAP (Simple Object Access Protocol) – a protocol that uses XML format to exchange info to and from a Web service.
  • SOA (Service-oriented architecture) – a way in which companies can organize software that can be quickly changed to respond to the requirements of the market place.
  • Web Service – units of software that run in a network. Typically written to handle a specific business process. Web services can be strung together in multiple ways and used by different applications to create desired functionality.

I believe that once the above terms are demystified, the job of testing web services is pretty straightforward. I also feel that the best way to demystify something is to break it down into simple, hands-on examples. In this series I hope to present some simple hands-on examples that break down what a web service actually is, and how one works in general. Hopefully, knowledge plus know-how will equal automation awesomeness!

Follow each link below to learn more:

Part 1 – How to Test Web Service – How to Create a Web Service

Part 2 – How to Test a Web Service – Its all about the WSDL

Part 3 – How to Test a Web Service – Response and Requests

Malay - April 7, 2011

Good going Joe,one thought which comes to the mind is about testing the performance of web services.
There are tools available for testing both functionality and performance of web services like SOAP SONAR etc.
My question is-can we not use Service test to test the performance of WS and not go for load runner?If yes,do we see some limitations?
I beleive ST is purely for WS testing which is preferred over QTP for functional testing,shouldn’t the performance be also tested thru ST.

    Joe Colantonio - April 8, 2011

    Malay » Hi Malay you still need to use LoadRunner. When you start Service Test up on a machine that has LR installed you are given an option to create a a “Service Test Enabled for Load Testing”. You can then run the script in the LR controller to create a performance test scenario. But if I’m doing a performance test I personal would rather just use LoadRunner’s built in web service protocol. Thanks Malay

Click here to add a comment

Leave a comment: