| Sign In/My Account | View Cart |
Taking JUnit Out of the Box
Pages: 1, 2, 3, 4, 5
Every agent runs a set of JUnit tests and each test may write information to the default out. Because it is important that the tester or developer gets this information while the test is running, the default out is copied to the main local test suite's console. This process eliminates the need to go and look at each of the agent consoles in the test suite.
Communication between the agents and the main local test is a complex matter, and Pisces must be able to work in a range of different environments and network topologies. In order to accommodate this issue, Pisces has a pluggable communication layer. Each of these implementations solves the problems that occur in their specific network environments.
Two basic communication layers are provided by Pisces by default--a multicast implementation, which is easy to configure but works only in a LAN environment, and a JMS implementation, which requires the installation of Message-Oriented Middleware (MOM) but works in most environments.
Configuring and Running Pisces Agents
As I mentioned before, the Pisces test suite is composed of several JUnit tests running on remote agents. Each agent is a Java application that, according to instructions it receives from the main test runner, runs the JUnit test and reports its result and the default out printouts back to the main test runner.
The easiest way to run an agent application is to configure and run the relevant executable script in the scripts folder provided in the Pisces build. Alternatively, you can also build your own script based on those already provided. The script allows users to configure general parameters for the agent, such as a unique identifier, and for the communication layer, a multicast IP and port.
For example, a script for running an agent with a multicast communication layer on Linux OS might look like this:
#!/bin/sh
# the folder were the agent can find junit.jar
export JUNIT_HOME=/opt/junit3.8.1
# the folders were the agent can find
# the junit tests
export JUNIT_TEST_CLASSPATH=../examples/
# the multicast port that the communication
# layer uses
export PISCES_MCP=6767
# the multicast IP that the communication
# layer uses
export PISCES_MCIP=228.4.19.76
# the unique name of the agent
export AGENT_NAME=remote1
java -classpath
"$JUNIT_HOME/junit.jar:../pisces.jar:$JUNIT_TEST_CLASSPATH" \
org.pisces.RemoteTestRunnerAgent \
-name $AGENT_NAME -com multicast \
-mcp $PISCES_MCP -mcip $PISCES_MCIP
The executable script for a Pisces agent that uses a JMS provider
is similar in most ways; the JMS communication layer takes as a
parameter the name of a loader class that returns a
ConnectionFactory of your JMS provider.Configuring and Running Pisces-Enabled Test Suites
After configuring and running all of the relevant agents, we still need to configure and run our Pisces-enabled test suite.
First, we have to add the communication layer configuration to
the beginning of our TestSuite, as shown below:
// create the multicast communication layer
MulticastRemoteTestCommunicationLayer com =
new MulticastRemoteTestCommunicationLayer(
RemoteTestRunner.name ,"228.4.19.76",6767);
// set the communication layer
RemoteTestRunner.setCom(com);