Consignation d'un événement de verdict

Cet exemple consigne un verdict d'échec si l'entrée du code personnalisé du test appelant est manquante. Si l'entrée attendue est présente, elle est enregistrée dans l'historique d'exécution et un verdict de succès est consigné. Les lignes en gras correspondent à celles ajoutées au modèle.

package custom;

import com.ibm.rational.test.lt.kernel.logging.IKLog;
import org.eclipse.hyades.test.common.event.*

/**
 * @author unknown
 */
public class LogVerdictExample implements
		com.ibm.rational.test.lt.kernel.custom.ICustomCode {

	/**
	 * Instances of this will be created using the no-arg constructor.
	 */
	public LogVerdictExample() {
	}

	/**
	 * @see com.ibm.rational.test.lt.kernel.custom.ICustomCode#exec(IKLog, java.lang.String[])
	 */
	public String exec(IKLog log, String[] args) {

		if (args == null) {
			log.reportVerificationPoint("Failure",VerdictEvent.VERDICT_FAIL,"No input values found.",VerdictEvent.REASON_SEE_DESCRIPTION);
		}
		else {
			String s = "";
			for (int i=0; i < args.length; i++) {
				s = s + args[i];
			}
			log.reportMessage("Input argument to this custom code is: " + s);
			log.reportVerificationPoint("Success",VerdictEvent.VERDICT_PASS,"The response included your country code.");
		}
		return null;
	}

}
Conditions d'utilisation | Commentaires
(C) Copyright IBM Corporation 2005. All Rights Reserved.