To test a Web service component, the best approach is to submit
a series of requests to the server and to ensure compliance of the return
messages with the corresponding expected values.
Before you can create a Web service component test, you must have
access to the Web service definition file (WSDL).
To create a component test for a Web service:
- Select and
click Next.
This starts the Create
Web Service Component Test wizard.
- From the first wizard page, select the test project that will contain
the test, or click New to create a new test project,
and click Next.
- On the next page, you select the Web service under test:
- Locate the WSDL definition file for the Web service under test. You can use Browse for a WSDL from your workspace,
or use Import to import the file from the filesystem.
- Select one or several port types to test.
- In the Web service runtime Java™ proxy generation list, select the
runtime (IBM® WebSphere® or
Apache Axis) that you want to use to generate the Java proxy for the test.
Note: You
cannot use multiple runtimes within a single project. If a Web service component
test or stub already exists in the current test project, you can only use
the runtime that was previously used in this test project. To create a test
using a different runtime, you must create a new test project.
- Click Next.
- On the Define a test scenario page, create the test scenario by
selecting the port locators and operations that you want to test.
- Add one or several instances of the port by selecting a port
locator from the list and clicking Add. (You can also
double-click a port locator to add it to the scenario.)
- To assign a meaningful name to the port, select the instance
from the test scenario, click Rename, type the
new name, and click OK.
- Double-click each operation to be included in the scenario.
- When you are finished building the scenario, click Finish.
The result is a new test suite along with a test behavior script
and one test case for each selected port locator.
You can now edit the test behavior script generated from the WSDL
file. Use the test data table to specify input values (server requests) and
expected return values. You can also add, remove, and edit initialization
points and validation actions for the test. Before running the test, make
sure that the Web service under test is running on an application server.