Personally, I love JUnit. I automate the tests with Ant.
I have created a simple class that extends the Junit TestCase class that sets up and tears down the IS Java client connection to IS, so each test I write just has to do context.invoke on the services I want to test. I’ve been meaning to write this up with full examples, but here main bit:
package com.xxx.junit.framework;
import junit.framework.*;
import com.wm.app.b2b.client.Context;
public class ISTestCase extends TestCase
{
static protected String DEFAULT_SERVER = “localhost”;
static protected String DEFAULT_PORT = “5555”;
static protected String DEFAULT_UID = “Administrator”;
static protected String DEFAULT_PWD = “manage”;
static protected String DEFAULT_TESTPACKAGE = “TestPackage”;
private String server;
private String port;
protected Context context;
protected String uid;
protected String pwd;
private String packageName;
public ISTestCase(String name) {
super(name);
server = System.getProperty("junit.server", DEFAULT_SERVER);
port = System.getProperty("junit.port",DEFAULT_PORT);
uid = System.getProperty("junit.uid",DEFAULT_UID);
pwd = System.getProperty("junit.pwd",DEFAULT_PWD);
packageName = System.getProperty("junit.packageName", DEFAULT_TESTPACKAGE);
}
/**
* Setup the client connection to IS
*/
public void setUp() {
context = new Context();
try {
context.connect(server+":"+port,uid,pwd);
}
catch (Exception e) {
e.printStackTrace();
fail(" Error: Unable to connect to server '" + server
+ ":" + getPort()
+ "' uid:'" + getUID()
+ "' pass:'" + getPWD()
+ "' aborting testing:" + e);
}
}
/**
* Disconnect from Server.
*/
public void tearDown()
{
if (context.isConnected())
context.disconnect();
return;
}
public String getServer()
{
return server;
}
public String getPort()
{
return port;
}
public String getUID()
{
return uid;
}
public String getPWD()
{
return pwd;
}
public String getPackageName()
{
return packageName;
}
}
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services