Example BDL Script for JUnit

Script Example

The following sample script is generated by importing a sample JUnit test case.

var
  hTestClass : number;

dcltrans
  transaction TInit
  begin
      // Load and start the JVM.
      JavaCreateJavaVM();

      // instantiate the java class
      hTestClass := JUnitLoadClass("com/microfocus/Test");
  end TInit;

  transaction THello
  begin
    JUnitExecuteTest(hTestClass, "doHello", "doHello_timer");
    JUnitExecuteTest(hTestClass, "", "Test_timer");
  end THello;

  transaction TEnd
  begin
    JavaFreeObject(hTestClass);
  end TEnd;
  • JUnitLoadClass in the TInit transaction instantiates the Java object and returns a handle of the runtime class. The handle is assigned to hTestClass.
  • JavaFreeObject in the TEnd transaction releases the Java runtime class.
  • JUnitExecuteTest in the THello transaction starts the JUnit test execution.