Java Test Class Overview

A Java test class template can be generated automatically by choosing New > Java Framework Scripts (.bdf/.java). A dialog box opens, requesting the name of the Java test class that is to be generated.

To enable use of Silk Performer functions, the implementation of the Java test class must contain the following:

Additionally, there can be any number of member methods containing Java test code. An automatically generated Java test class will contain one member method, for example:

public void doFoo()

These elements are detailed below:

Required Package

To access several functions that are provided by the Silk Performer runtime system, you must import the SilkPerformer class. This class is provided in the silk.performer package. The javaUserFramework.zip file, located in the Classfiles subfolder of the Silk Performer home directory, is automatically included in the classpath.

Default classpath entries such as javaUserFramework.zip are defined in perfrun.xml in the Silk Performer home directory.

At the beginning of your Java script, import the SilkPerformer class using the following statement:

import silk.performer.SilkPerformer;

Class Definition

The Java test class is defined immediately following the import statement. If Test is chosen as the name of the Java test class, the class definition in the Java script will appear as follows:

public class Test
{
  ...
}