About Testing Web Services

Applies to TestComplete 15.62, last modified on March 14, 2024
Testing web services with TestComplete is obsolete. We recommend that you use ReadyAPI instead. See the note below.

With TestComplete you create functional tests of SOAP web services. These tests consists of calling web service methods and checking the returned result values.

Need to test REST and SOAP web services? Looking for advanced features like data-driven testing and response validation?

Check out ReadyAPI – an all-in-one automated testing tool for REST and SOAP services. It is code-based on SoapUI – the world’s most popular API testing solution – and includes tons of pro features:

  • Support for all major web service technologies: REST, SOAP, Swagger, WSDL, WADL, OAuth 2.0, OpenID Connect, JSON, XML, and more,

  • Functional, security, and load tests,

  • Easy service mocking and virtualization,

  • Data-driven testing and parameterization,

  • Response validation with 25+ built-in assertions,

  • And more.

Download a free trial now to see how ReadyAPI works for you.

If needed, integrate ReadyAPI tests into your TestComplete projects for unified reporting.

In This Topic

Supported Web Services and Protocols

TestComplete can test web services that match the following specifications:

Specifications

  • HTTP or HTTPS protocols     
  • SOAP 1.1. and 1.2
    (SOAP over HTTP)
  • WSDL 1.1
  • WS-I Basic Profile 1.1

Binding Types

  • BasicHttpBinding     
  • WSHttpBinding
  • NetTcpBinding

Security Types

  • Unsecured
  • Basic
  • Windows
  • NTLM
  • Certificate

Notes:

Functional Web Service Testing in TestComplete

To test web services in TestComplete, you use Web Service items that belong to the Web Services collection in your project. Each Web Service item contains the following information:

  • The web service’s URL and SOAP version.

  • The URL of the web service’s WSDL file.

  • Types and methods that the WSDL file defines.

Note: When parsing the WSDL file of the tested web service, TestComplete automatically creates an item0.wsdata file and stores it to the same folder where the appropriate Web Service item file (.tcWS) resides. The file stores the WSDL file and all the linked schemes. TestComplete uses the file for testing. If you move your test project to another computer, remember to copy this file with other project files.

You use Web Service items to call web service methods in your tests and check the method results. You access Web Service items and call methods of appropriate web services by their names:

resultValue = WebServices.WebService1.MyMethod("Some string parameter", 123, true)

Once you get a result value, you can verify it. You can do it by using standard comparison statements (the if statement in scripts, the If Then operation in keyword tests) or by using web service checkpoints (see below).

To change the API that TestComplete uses to call your web service methods, configure the Preferred Web Service API options. Enable the .NET WCF option to use the .NET API to call web service methods. Otherwise, use the native API.

Creating Web Service Functional Tests

Functional web service tests cannot be recorded. You create them manually by calling web service methods and checking their values from test scripts or keyword tests.

For detailed instructions on how to create a test, see –

Creating Web Service Tests

Using Web Service Checkpoints

SOAP web services use the XML format for transferred data.

In TestComplete, you can use XML checkpoints to verify XML documents easily. To use XML checkpoints to verify your web service responses:

  1. Store an expected response in the Stores | XML collection.

  2. Call the needed web service method.

  3. Call the XML checkpoint to verify the method result against the stored data.

To perform all these steps, you can use the Checkpoint wizard. The wizard guides you through the baseline XMLCheckpoint element creation and generates the code or keyword test operations that call the needed web service method and verify the result. See About Web Service Checkpoints.

More Information on Testing Web Services in TestComplete

Refer to the following topics to learn more about creation of web service tests in TestComplete:

To learn about … See topic …
Viewing methods and objects that your tested web service uses Exploring Web Service’s Methods and Objects
Calling web service methods that use ”out“ parameters Calling Web Service Methods That Use Out Parameters
Generating script code that will create test objects and arrays that you will use as method parameters of the web service Creating Objects and Arrays for Web Service Method Calls
Using web service checkpoints for verifying method result data About Web Service Checkpoints
Specifying the user’s authentication information Specifying Web Service Credentials
Creating custom SOAP requests Prepare SOAP Requests in Scripts
Running tests Running Tests
Running multiple test iterations using various test data Data-Driven Testing

Sample

TestComplete includes a sample project that demonstrates how to call web service methods from scripts, prepare complex parameters for the methods to be called and check the returned results by using script statements and checkpoints:

<TestComplete Samples>\Common\Web Service Testing\Functional Testing

Note: If you do not have the sample, download the TestComplete Samples package from the https://support.smartbear.com/testcomplete/downloads/samples/ page of our web site and run it.

These projects work with a sample web service that resides on our web site:

secure.smartbearsoftware.com/samples/testcomplete15/webservices/Service.asmx

See Also

Web and RIA Testing
Applications Testing

Highlight search results