Generating a test-model element from a new annotation type

After annotations have been inserted into a recording session, the annotations must be processed by a test generator to translate them into a test-model element. To process annotations with a test generator, define a dedicated test generator or modify an existing test generator that you have developed.

To enable a test generator to process a new annotation type:

  • Add the com.ibm.rational.test.lt.recorder.core.recorderAnnotation packet type to the list of supported packets of the test generator in the plugin.xml file. Set the isRequired attribute to false.
  • In the process() method of the test generator, add code based on this template:
    	if (packet instanceof IRecorderAnnotationPacket) {
    		IRecorderAnnotationPacket p = (IRecorderAnnotationPacket) packet;
    		RecorderAnnotation annotation = getContext().resolveAnnotation(p);
    		if (annotation == null) return true;
    		if (MY_ANNOTATION_TYPE.equals(annotation.getType())) {
    			// Add code to process the annotation
    			return true;
    		}
    	}