JETPack

JETPack comes with a test control method defined in the TET.TestCase interface. An implementation of this interface is the SimpleTestCase class. It permits the development of tests with an arbitrary number of test purposes per invocable component, and an arbitrary number of invocable components per test case. This class should be adequate for most uses. For more advanced uses of TET, the user can create their own implementation of the TestCase interface that implements their own rules.

The SimpleTestCase class provides a foundation upon which user test cases may be based. One begins a new test case by making it a subclass of SimpleTestCase:

  public class NewTestCase extends TET.SimpleTestCase {
    //...
  }
In addition, the new test case class must provide a static main() procedure which creates an instance of the test case class and passes control back to JET's test case manager:
    public static void main (String args[]) {
      main("NewTestCaseName", args, new NewTestCase());
    }
The first argument is the name of the test case, i.e. what calling tet_pname() should return.

Test purposes are defined by creating public instance methods whose names are of the form: i#t# where each pound sign ("#") represents a sequence of one or more digits. The first sequence of digits (the "i"-string) denotes the number of the invocable component to which the test purpose belongs; the second sequence (the "t"-string) is used to determine the execution order of the test purposes. The "i"-string must evaluate to an integer greater than zero (which is taken to be the invocable component number). There are no restrictions on the digits in the "t"-string.

The test purpose methods should return "void" and take a single argument of class TET.TestSession. Some JET routines throw exceptions, and test purposes which make use of them should either catch the exception or declare it in a throws clause. Uncaught TetExceptions thrown from within test purposes will result in recording of the exception to the results file and termination of the current test purpose.

Some examples of test purpose declarations are:

    public void i1t1(TET.TestSession ts) { }
    public void i2t1(TET.TestSession ts) throws TET.TetException { }
    public void t2(TET.TestSession ts) { }
    // ...
As a short cut, test purpose methods may be abbreviated to "t#" in which case they are assumed to belong to invocable component number 1.

Within an invocable component test purposes are executed based on the lexigraphical ordering of their "t"-strings. Thus "t0" will be executed before "t00". The test purpose id assigned to a test purpose will be its rank in this lexigraphical ordering (starting at 1). In the event that two test purposes have the same "t"-strings, the order in which they are executed is indeterminate. (This can only happen if abbreviated test purpose names are used.)

Using a TestSession within a test purpose

When a test purpose is invoked it is passed an object which conforms to the interface TET.TestSession. In general this will be an instance of TET.JetTestSession.

Currently JetTestSession supplies the following TET functionality:

Basic (TET_LITE) interfaces:

  public void tet_infoline(String line);
  public void tet_minfoline(String lines[]) throws TetException;
  public String tet_pname();
  public int tet_thistest();
  public String tet_getvar(String name);
  public void tet_setcontext();
  public void tet_setblock();
  public int tet_getblock();
  public void tet_delete(int tp, String reason);
  public String tet_reason(int tp);
  public void tet_result(int result);
TETware/TET3 interfaces (available when built in inet mode):
  public void tet_exit(int status) throws TetException;
  public void tet_logoff();
  public native int tet_remgetsys() throws TetException;
  public int[] tet_remgetlist() throws TetException;
  public SystemEntry tet_getsysbyid(int sysid) throws TetException;
  public java.util.Date tet_remtime(int sysid) throws TetException;
  public void tet_remsync(long syncptno, int sysnames[], int waittime, int vote,
 SyncMessage msg) throws TetException;
All of these methods behave just like their C-API counterparts. See the TET3/TETware C binding documentation for their semantic definitions.

The exception TetException is thrown if the version of TETware installed on the platform is not built to support remote/distributed testing.

The result constants for tet_result() (such as TET_PASS, TET_FAIL, etc.) may be accessed from the TestSession object itself (ts.TET_PASS, ts.TET_FAIL, etc. where ts is the TestSession object.)