Testing maps

You can test a map's transformation steps by providing sample data for the source business object and executing a test run of the map. A test run is map execution that does not involve an event sent by a connector or a call sent by an access client; the map executes within Map Designer Express. Map Designer Express provides a separate tab, the Test tab in the Map Designer Express window to test maps and view test results.

Note:
When a map is selected from Testing Environment for further debugging, Testing Environment will launch Map Designer Express, giving Map Designer Express the input business objects to the map under testing.

This section describes how to set up and execute a test run, using these steps:

Note:
An alternative testing strategy, which is not covered in detail, is to set breakpoints in the map and to send a triggering event from the connector, which causes the map to execute.

Preparing to run the test

Before running the test, perform the following steps:

  1. Open the map to debug from the project.
  2. If the map has not been compiled since the last modification, compile it by choosing Compile from the File menu. For more information, see "Compiling a map".
  3. If the Test tab of Map Designer Express is not currently displaying in the tab window, select the Test tab.

Creating test data

Every time you test a map, you must load data into the source business object. To do this, use the Source Testing Data pane in the Test tab (see Figure 36). The Source Testing Data pane allows you to specify the following test information:

Important:
The calling context and generic business object are required only for testing relationships within maps. For more information, see "Testing maps that contain relationships".

Testing the map for the first time

When you test the map for the first time, you must manually enter the values of the attributes in the Source Testing Data pane.

The following sections provide information about how to enter this data:

Test data for the source business object

To create source business object data for the first time, follow these rules:

To save the values you have entered for future test runs, create a business object ( .bo) file by selecting the source business object and performing either of the following actions:



Figure 36. Source Testing Data pane of the Test tab

Test data for a child business object

If the source business object has child business objects and you want to specify test data for the child attributes, you must first create an instance for each child object you need. To do so, perform the following steps:

  1. Right-click the child business object name and select Add Instance from the Context menu. When you expand the object, you see the instance that Map Designer Express has created.

    Guideline: The first instance you add has an index number of zero. You can have as many instances as you want (as long as the child attribute has multiple-cardinality).

  2. Click the plus symbol (+) beside the instance index number to expand the child business object.

    Result: When you expand the object, you see the child attributes for this instance.

  3. To create data for the child business object instance, follow these rules:

Testing the map in subsequent runs

For subsequent test runs, Map Designer Express reuses the previously specified test data. You can take any of the following actions on this data:

Setting breakpoints

When you set a breakpoint, map execution pauses just before the transformation of the destination attribute on which the breakpoint is set. The use of breakpoints lets you step through map execution and check the sequence and the results of individual operations. You can set as many breakpoints as you like.

Guideline: Breakpoints are not part of the map's definition. You set breakpoints on the map after the map is opened in Map Designer Express, and when the map is debugged (either with Debug-->Run Test... or Debug-->Advanced-->Attach...). Breakpoints have no effect on the map when the map is not debugged from Map Designer Express.

Note:
You can only set a breakpoint on a destination attribute that has a transformation defined for it.

To set a breakpoint, you can use any one of the following methods:

Note:
The Toggle Breakpoint option toggles a breakpoint definition on and off. If the breakpoint is not currently set, Toggle Breakpoint sets it. If the breakpoint is currently set, Toggle Breakpoint removes it.

Result: Map Designer Express displays a dark circle next to the destination attribute on which the breakpoint is set, as shown in Figure 37.

Figure 37. Breakpoint set

Once you set the breakpoint, the execution of the map instance pauses at this breakpoint and you can see the current status of the map. Unless you specify at least one breakpoint, the map executes and finishes with the message:

Test run finished
 

Rule: You must always provide values for the source data associated with the destination attributes where you set the breakpoints. Otherwise, the transformation rule will run normally and the breakpoints will execute normally, but the destination value will usually be empty, depending on what transformation rule is defined. For more information, see "Creating test data".

To view all breakpoints for the map, select Breakpoints from the Debug menu.

Result: Map Designer Express displays the Breakpoints dialog (see Figure 38).

Figure 38. Breakpoints dialog of the test tab

From the Breakpoints dialog, you can perform any of the following actions:

Running the test map

Once you have entered the source test data and set any desired breakpoints, you are ready to test the map. To run a map test involves the following steps:

  1. Starting the test run
  2. Processing breakpoints (if any breakpoints have been set)

Starting the test run

To start the test run, perform the following steps:

  1. Do any of the following actions:

    Result: The Connect to IBM WebSphere InterChange Server Express dialog box will display and allow you to connect to the server for testing.

  2. In the dialog, enter the server name, user name, and password.
  3. Specify whether you want to deploy the map and dependent business objects for the test run.

    Guideline: Deploying a minimum set of business objects to the server for testing will minimize debugging initialization time.

Result: Execution of the map starts. Map Designer Express displays the following message in the output window:

Starting test run...
 

Processing breakpoints

Map execution pauses when it reaches a destination attribute where you have set a breakpoint. When the breakpoint is reached, Map Designer Express takes the following actions:

  1. Highlights the destination attribute on which the breakpoint was set and displays a dark circle with a yellow arrow next to it.
  2. Displays the following message in the output window:
    Test Run stopped at attribute AttrName (next transformation--> "Rule").
     

    Tip: With map execution paused, you can examine the values of the destination attributes that have been processed so far by looking in the Value column of the Destination Testing Data pane.

  3. Processes the breakpoint and continues map execution, when you do either of the following actions:

    Result: When the execution of the test run is finished without any run-time errors, Map Designer Express displays the following message in the output window:

    Test run finished.
     

Viewing test run results

Test run results display in the destination business object, which is in the Destination Testing Data pane. Values resulting from the map transformations are visible in the Values column of this table. You can view test run results by either:

Watching the process

During a test run that has test data and breakpoints, you can watch as the destination business object fills with values. Values appear in the Values column in the Destination Testing Data pane as they are processed. When map execution is paused on a breakpoint, all destination attributes before that attribute in the execution order have values displayed.

To view the transformations as they occur:

Viewing results after execution

To view test run results when the map has already executed, examine the destination business object in the Destination Testing Data pane.

To save the test results:

Changing the map and re-executing

As you test the map, you might discover the need to change the map. To edit the map and then continue the test, perform the following steps:

  1. Switch to either the Table or Diagram tab to view the map transformations.
  2. Make the edits to fix the errors.
  3. Recompile the map.
  4. Continue the testing process by switching back to the Test tab.
  5. Begin a new test run.

Important:

  1. Make sure you complete the test run, either with success or failure, before you attempt to recompile the map.

  2. After you modify the map, be sure to deploy the map to the server for the change to be reflected in the server.

Copyright IBM Corp. 1997, 2003