TestPoint Diagnostic Web Server
The TestPoint server is a very small implementation of the
http/0.9 protocol
designed to support asynchronous debugging and maintenance of java applications.
You may have come to this page from a TestPoint page like this one.
The bulleted
links on a TestPoint page call methods inside the program being tested.
Click a word to run the corresponding method. Methods are expected to run without substantial
side effect unless they begin with an action verb such as set, start or stop.
Your page will have different words. Return to it to see what they do or continue
reading to learn how to add this software to other programs.
The TestPoint server gets its name from the binding posts that were at one time designed
into electrical circuits for the benefit of a service technician probing with an oscilloscope.
The browser is today's oscilloscope.
(See Signature Survey for another example.)
Downloading
The server is a single java class file. Download the file from here.
The file includes a main program so that you can test the server by running it as an application.
Type this command while in the same directory as the file.
java TestPoint
The server will respond by saying "TestPoint" and reporting its url. Type the url into
your web browser or try this link instead.
http://localhost:8080
You may have trouble here if you already have a server on port 8080 or if you don't
have version 1.2 or greater java properly installed.
Programming
Customize the server by writing a subclass with void methods of no arguments such as the one below.
The function must write html to the inherited variable 'out', a PrintWriter.
For example, this method extends the server to report the current date and time.
void date() {
out.println(new java.util.Date());
} |
Do not declare the methods to be public, private or protected unless you don't want them to
be called directly by the server.
Your subclass will be Runnable. Launch it on its own Thread as you would any Runnable
or with the convenient method void start(). The server scans your subclass for
methods using reflection. If your subclass defines the above date method, it would be accessed
with a url that looks like this.
http://localhost:8080/date
The server responds to any unrecognized requests with an index of valid requests like that
shown at the top of this page.
Example
TestPoint server was first used testing a simulation/animation application.
(Read about that application.)
This is the TestPoint subclass used to peek into the simulator while it ran.
import java.text.DecimalFormat;
class SimTestPoint extends TestPoint {
void clock() {
DecimalFormat decimal = new DecimalFormat();
out.println(decimal.format(Simulator.clock));
}
void trace() {
Simulator.trace("TestPoint", new java.util.Date());
Simulator.printTrace(out);
}
void queuing () {
out.println("<font size=-1><pre>");
Simulator.queuing.report(out);
}
} |
The application's main program starts the extended TestPoint server with this line:
(new SimTestPoint()).start();
This creates a new instance of the server and starts it on its own thread.
The inherited start() method returns immediately. Here are saved samples of the
clock,
trace and
queuing pages from midway through a recent run.
License
The TestPoint server is open source under the perl
Artistic license.
Download the source here.
There are no mandatory fees for using the TestPoint server. However, the author does
solicit contributions from people who have found it or its copies useful. Recommended
donations are as follows.
normal use: $10
saved from bad bug: $100
commercial user 10x these rates
Checks or money orders are welcome at
Ward Cunningham
Cunningham & Cunningham, Inc.
7830 SW 40th Ave, Suite 4
Portland, Oregon, 97219, USA
Reports
Test Point in Practice, Ward Cunningham, Presented at the Fourth Annual Austin Workshop on Test Automation January 25-26, 2003 http://c2.com/doc/TestPoint/TestPointInPractice.pdf.
|