You can create a companion that extends the predefined SimpleCompanion.
Follow these steps:
This class provides the information that is required to create, edit, and execute your companion logic.
public class AllowedExecDaysCompanion extends SimpleCompanion implements Serializable { }
Implement Serializable when your companion is used in remotely staged tests.
This method provides the name that identifies the companion in the model editor.
public String getTypeName() { return "Execute Only on Certain Days"; }
This method provides any parameters needed for your companion to execute. Also call the superclass implementation of this method. The model editor allows you to edit the parameters that are shown here. These parameters are given to you at the time of execution. Implement this method only if your companion requires parameters.
public ParameterList getParameters() { ParameterList pl = super.getParameters(); pl.addParameter( new Parameter( "Allowed Days (1=Sunday): ", DAYS, "2,3,4,5,6", String.class ) ); return pl; }
DevTest calls this method with the parameters you request. If an error occurs or you otherwise want to prevent the test from executing normally, throw a TestRunException.
protected void testStarting( ParameterList pl, TestExec testExec ) throws TestRunException
DevTest calls this method with the parameters you request. You have an opportunity to perform any post-execution logic for the test.
protected void testEnded( ParameterList pl, TestExec testExec ) throws TestRunException
You can provide a detailed message for the companion.
public void setLongMsg( boolean isStarting, String msg )
Copyright © 2014 CA Technologies.
All rights reserved.
|
|