Quality Testing

Quality is delighting customers

Can anybody explain how Webservice works and how to test Webservices?

Views: 155

Reply to This

Replies to This Discussion

Testing Web Services:

You can test Web services by calling Web methods from unit tests. Testing Web services is much like testing other code by using unit tests in that you can use Assert statements, and the tests produce the same range of results. However, the Microsoft.VisualStudio.TestTools.UnitTesting.Web namespace of Team Edition for Testers provides attributes and methods specifically for testing Web services; they are described in Testing a Web Service Locally.

The following list describes two ways to test Web services with unit tests:

The Web service runs on an active Web server. There are no special requirements for testing a Web service that runs on a local or a remote Web server, such as IIS. To do this, add a Web reference and then call the Web methods of the Web service from your unit tests just as they would call the methods of a program that is not a Web service. For information about how to add a Web reference, see Add Web Reference Dialog Box. For information about how to create unit tests, see How to: Generate a Unit Test and How to: Author a Unit Test. For information about how to use a Web test to test a Web service, see How to: Create a Web Service Test.

The Web service is not hosted in an active Web server. As described in Testing a Web Service Locally, you can test a Web service that runs on your local computer and not in a Web server, such as IIS. To do this, you use an attribute provided by the Team System testing tools to start ASP.NET Development Server. This creates a temporary server at localhost that hosts the Web service that you are testing. For more information about ASP.NET Development Server, see Web Servers in Visual Web Developer.

Testing a Web Service Locally

This is the process for testing a Web service that runs on your local computer but not in IIS:

Create the Web service on the local file system. For more information, see Walkthrough: Creating an XML Web Service Using Visual Basic or Visual C#.

Generate unit tests against the Web service in the standard way for generating unit tests. For more information, see How to: Generate a Unit Test.

Add the AspNetDevelopmentServerAttribute attribute to the unit test. The arguments for this attribute class point to the site of the Web service and name the server. For more information, see Ensuring Access to ASP.NET Development Server.

Within the unit test, add a call to the TryUrlRedirection method to point the Web service object to the correct server. Verify that it returns true, and use and Assert statement to fail the test if the redirection fails. For more information, see Using the TryUrlRedirection Method.

Call the Web service or exercise it in any other way that you feel is necessary to test it thoroughly. For an example of this, see Example Web Service Test Method.

More details: http://msdn.microsoft.com/en-us/library/ms243399(VS.80).aspx
Thank you verymuch meenakshi..i appreciate your help!!!
You are Welcome Kiran:)
Hi Meenakhsi,

Is web services testing conducted at Unit Level only?


You want to test for Web Services at Structural or Functional Level?

here web services means nothing but whatever protocol that does the application request sending....and receiving...
like http protocol, and other which are used in web services.......
I presume this is good candidate for smoke testing also to check that all your web services are up and running..... :)

The Web services (WS) and service-oriented architecture (SOA) present a set of unique testing challenges. As services are distributed, it is necessary to test them using a distributed architecture. Furthermore, as these services may keep on changing, testing needs to be adaptive.I am doing a bit on research about Webservices Testing and i found also macrotesting www.macrotesting.com to be very good source. Thanks for you article


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service