Creating method-level Web service component tests

Method-level testing exercises the different conditions defined in the method code in isolation from other methods, allowing you to test each individual method independently. The focus is generally to ensure that the method correctly processes all of its possible inputs.

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 HTTP-based Web service:
  1. Select File > New > Other > Component Test > Web Services > Web Service Component Test and click Next.

    This starts the Create Web Service Component Test wizard.

  2. On the first wizard page, take one of the following actions:
    • Select the test project that will contain the test and click Next.
    • Click New to create a new test project.
  3. On the next page, you select the Web service under test:
    1. 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.
    2. Select one or more port types to test.
    3. In the Web service runtime Java proxy generation list, select the runtime environment (IBM® WebSphere® or Apache Axis) that you want to use to generate the Java™ proxy for the test.
      Note: You cannot use multiple runtime environments within a single project. If a Web service component test or stub already exists in the current test project, you can use only the runtime environment that was previously used in this test project. To create a test using a different runtime environment, you must create a new test project.
    4. Click Next.
  4. On the "Select a test pattern" page, select the Method-level testing pattern and click Next.
  5. On the "Select the methods to be tested" page, select the individual methods you want to test and click Finish.
The end result is a test behavior script and a test suite with one test case each selected method.
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.
Related concepts
Test strategies
Web service test patterns
Related tasks
Creating scenario-based Web service component tests
Creating a Web service stub
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.