Trading Networks 10.7 | Administering and Monitoring B2B Transactions | Service Development Help | Debugging Java Services | About Test Harnesses
 
About Test Harnesses
 
Creating a Test Harness
A test harness is a Java class that you generate for a Java service you want to debug.
To debug a Java service in Designer, you use the Java Development Tools (JDT) debugger, which acts on Java classes in the local workspace. As a result, when debugging a Java service you actually debug the copy of a service’s Java class that Designer maintains in a Service Development Project. However, to do so, you first need to generate a test harness for the Java class. The test harness sets the input parameters for the Java class you are debugging and then launches the Java class in debug mode.
When you generate a test harness, Designer stores the Java class for the test harness in the same Service Development Project and Java package where the Java class for the service being debugged resides. Designer uses the following format to name the test harness Java class:
<serviceName>_TestHarness.java
For example, if you generate a test harness for the service named “checkStatus”, Designer assigns the test harness Java class the name “checkStatus_TestHarness.java”.
When you launch the test harness, by default, it firsts prompts you to supply login credentials for Integration Server. The test harness must have login credentials so that it can connect to Integration Server to obtain the service’s input signature. If the Java service has an input signature, the test harness then prompts you to supply input values. You can type in values or load values from a file. After the test harness has the input values, it executes the Java class you want to debug in debug mode. You can use the debugger to debug your Java class. When execution of the Java class completes, the test harness displays the outputs from the Java class in a popup window.
You can update the logic that Designer generates for a test harness to make the following modifications:
*Change the Integration Server to which the test harness connects.
By default, the test harness attempts to connect to the Integration Server used to create the test harness. You can specify a different Integration Server.
*Update the test harness to connect to Integration Server using SSL.
By default, the test harness does not use SSL when connecting to Integration Server. You can uncomment logic in the generated test harness so that it uses SSL.
*Provide a user name and password for the Integration Server.
Provide Integration Server credentials to prevent the test harness from prompting for the user name and password. This is useful if you plan to launch the test harness several times to debug a Java class. However, if you want to share the test harness with other users, do not supply your user name and password because this presents a security risk.
For instructions for how to generate a test harness, see Creating a Test Harness.