com.canoo.webtest.steps.control
Class IfStep

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.canoo.webtest.steps.Step
              extended by com.canoo.webtest.steps.AbstractStepContainer
                  extended by com.canoo.webtest.steps.control.IfStep
All Implemented Interfaces:
IStepSequence, Serializable, Cloneable, TaskContainer

public class IfStep
extends AbstractStepContainer

Author:
Carsten Seibert, Aatish Arora, Jeanie Graham, Paul King, Gerald Klopp
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.canoo.webtest.steps.Step
DEFAULT_DESCRIPTION, ELEMENT_ATTRIBUTE_ID, ELEMENT_ATTRIBUTE_NAME, PROPERTY_TYPE_ANT, PROPERTY_TYPE_ANT_STRICT, PROPERTY_TYPE_DEFAULT, PROPERTY_TYPE_DYNAMIC
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
IfStep()
           
 
Method Summary
 void addCondition(GroupStep condition)
          Handles the nested 'condition' tag.
 void addElse(GroupStep elseStep)
          Handles the nested 'else' tag.
 void addOtherwise(GroupStep otherwiseStep)
          Handles the nested 'otherwise' tag.
 void addThen(GroupStep then)
          Handles the nested 'then' tag.
 void doExecute()
          Execute all of the nested steps according to some condition.
 GroupStep getCondition()
           
 GroupStep getElse()
           
 GroupStep getOtherwise()
           
 String getTest()
           
 GroupStep getThen()
           
 String getUnless()
           
protected  boolean runNestedTests()
           
 void setTest(String test)
           
 void setUnless(String unless)
           
protected  void verifyParameters()
          Called to let the step's implementation validate its parameters.
 
Methods inherited from class com.canoo.webtest.steps.AbstractStepContainer
addStep, addTask, executeContainedStep, executeContainedSteps, getSteps
 
Methods inherited from class com.canoo.webtest.steps.Step
addComputedParameters, clone, emptyParamCheck, execute, getComputedParameters, getContext, getDefaultPropertyType, getDescription, getDuration, getParameterDictionary, getStepLabel, getVerifier, getWebtestProperties, getWebtestProperties, getWebtestProperty, getWebtestProperty, handleException, hasDescription, integerParamCheck, isCompleted, isPerformingAction, isStarted, isSuccessful, notifyCompleted, notifyStarted, notifyStepResultsListeners, notifySuccess, nullParamCheck, nullResponseCheck, optionalIntegerParamCheck, paramCheck, positiveOrZeroParamCheck, setStepid, setWebtestProperty, setWebtestProperty, toString
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IfStep

public IfStep()
Method Detail

setTest

public void setTest(String test)
Parameters:
test -

getTest

public String getTest()

setUnless

public void setUnless(String unless)
Parameters:
unless -

getUnless

public String getUnless()

addCondition

public void addCondition(GroupStep condition)
Handles the nested 'condition' tag.

If all the steps contained in the 'condition' tag succeed, the 'ifStep' tag inner steps are executed

Parameters:
condition - The group of steps to execute to evaluate the test condition

getCondition

public GroupStep getCondition()

addThen

public void addThen(GroupStep then)
Handles the nested 'then' tag.

If the 'ifStep' condition passes, execute all the steps in the 'then' inner group.

Parameters:
then - The group of steps to execute if the condition passes

getThen

public GroupStep getThen()

addElse

public void addElse(GroupStep elseStep)
Handles the nested 'else' tag.

If the 'ifStep' condition fails, execute all the steps in the 'else' inner group.

Parameters:
elseStep - The group of steps to execute if the condition fails

getElse

public GroupStep getElse()

addOtherwise

public void addOtherwise(GroupStep otherwiseStep)
Handles the nested 'otherwise' tag.

If the 'ifStep' condition fails, execute all the steps in the 'otherwise' inner group. An alias for 'else'; sometimes more convenient name when used from scripting languages, e.g. Groovy, where else is a keyword and must otherwise have single quotes around it.

Parameters:
otherwiseStep - The group of steps to execute if the condition fails

getOtherwise

public GroupStep getOtherwise()

doExecute

public void doExecute()
               throws CloneNotSupportedException
Execute all of the nested steps according to some condition.

The nested steps will be executed only if one of these conditions is true:
The 'test' property evaluates to true
All the steps contained in the nested 'test' tag succeed
The 'unless' property evaluates to false
One of the steps contained in the nested 'unless' tag fails
specifically:

'test' property'unless' propertynested 'condition' tagexecute?
true missing missing yes
false missing missing no
missing missing all tests succeed yes
missing missing one test fails no
missing true missing no
missing false missing yes
In other cases, an error occurs

Specified by:
doExecute in class Step
Throws:
StepFailedException - Raises this exception if one of the wrapped steps fails
CloneNotSupportedException

verifyParameters

protected void verifyParameters()
Description copied from class: Step
Called to let the step's implementation validate its parameters. The method is called after parameter extensions but before Step.doExecute(). This implementation does nothing, overwrite as needed.

Overrides:
verifyParameters in class Step

runNestedTests

protected boolean runNestedTests()

Copyright © 2001-2007 Canoo Engineering AG, Basel. All rights reserved.