Creating a framework test suite

Multiple test classes can be combined to form a single test suite. Each test class in a suite must be based on the same class type. For example, MyServerTestSuite might consist of the test classes MyServerTestOne, MyServerTestTwo, and MyServerTestThree, where each class is based on PCServerTestClassBase.

A test suite is created by defining a suite class. The suite class must define a static method called suite. The suite method creates the test suite by using the SuiteBuilder class.

The SuiteBuilder class defines a constructor and the following methods.

withSuiteName
Accepts a String suite name argument. The generated suite will include all the test classes defined with a @Suites annotation value that matches the suite name argument. To create a suite that includes all the test classes that were defined without a @Suites annotation, do not call the withSuiteName method when building the SuiteBuilder instance.
build
Accepts no arguments. Creates the test suite object.

The following suite class builds a suite that includes each test class that specified a @Suites annotation with the SAMPLE_SUITE_NAME argument. Also, each test class in the suite extends the PCServerTestClassBase class.

package doc.example

uses gw.suites.MySuiteNames
uses gw.api.test.PCUnitTestClassBase
uses gw.api.test.SuiteBuilder
uses junit.framework.Test

class MySuiteClass {

  static function suite() : Test {
    return new SuiteBuilder(PCUnitTestClassBase)
          .withSuiteName(MySuiteNames.SAMPLE_SUITE_NAME)
          .build()
  }
}

The framework calls the suite method during normal framework processing. The method returns a JUnit-based Test object. The Test object is managed by the framework and does not need to be manipulated by test code.