Pages

Thursday, December 6, 2007

Web Service Testing

Here's some notes about testing a web service:

Web Service Request has a URL that points to .asmx; the Web Service Request has a Query String Parameter, String Body, and Header

1) open a webtest

2) right click the web test name and slect Add Web service Request; an empty request is added to localhost with an empty String Body

3) open a seperate browser window and browse to the asmx to get the details of the SOAP request for each operation (http://server/example/test.asmx)

4) View properties of request and change the URL from http://localhost/ to point to the asmx

5) Expand the request to select the String Body; enter text/xml under Content Type; in the other browser select the operation to be tested; copy the xml request from "?xml version="1.0" encoding="utf-8"? through "soap:Envelope"; go back to the String Body and click the elipsis beside String Body and paste the xml request under the HTTP body string. Then change placeholder values to actual data and click OK to save. Use arrows to navigate since this dialog does not contain a scrollbar. Enter dates in this format: 2006-03-10T07:42:00Z

6) Go back to the browser to get a copy of the URL (without quotes) http://example.com/app/UpdatePerson (located above the start of the XML request). Go back to the Web Service Request; right click and select Add Header. Enter SOAPAction under Name then paste the URL under the Value http://example.com/app/UpdatePerson.

7) Go back to the browser to get the name of the operation UpdatePerson. Go back to the Web Service Request; right click and select Add URL Query String Parameter. Change the name of the Query String Parameter from Parameter1 to some other value like op and enter the name of the operation under Value (UpdatePerson).

8) Add Validation Rules to check for text in the HTTP Response

This MSDN article explains creating a web service test in more detail

No comments: