The test model in Tao 2.5 is defined by the interface taoTests_models_classes_TestModel


The test model must implement the following functions:


A public constructor in order to ensure that taoTests can instantiate it.

onChangeTestLabel( core_kernel_classes_Resource


Called when the label of a test changes

prepareContent( core_kernel_classes_Resource

$items = array())

Creates a test content specific to the test model. If possible this content should be based on

This function is called whenever a test model is assigned to an test.

deleteContent( core_kernel_classes_Resource


This should delete the content of the test, however not the compiled content.

Usually called on deletion of test or change of test model.

getItems( core_kernel_classes_Resource


Should return the items of the test if possible. Should the test model change these items will be used as basis for the new test model.

getAuthoring( core_kernel_classes_Resource


Should return the html of the authoring widget for this test model

cloneContent( core_kernel_classes_Resource

$source, core_kernel_classes_Resource

Should clone the content of the test
$source and assign the cloned content as the content of the test

getCompiler( core_kernel_classes_Resource


Returns an instance of the abstract class tao_models_classes_Compiler, which has been initalised for

Test compiler

The test compiler needs to implement the abstract method:



This function will prepare a datastructure for the test that is exploitable by the test runner. The provided
$destinationDirectory can be used for storage. Typically this will involve compiling the items of the test as well, which will be compiled using a similar compiler:

$itemCompiler = taoItems_models_classes_ItemsService::singleton()->getCompiler($item);
$serviceCall = $compiler->compile($itemCompiler);

This method should return an instance of tao_models_classes_service_ServiceCall that points to the testrunner and provides the nescessary parameters to run this test.