org.specrunner.plugins.core.flow
Class PluginIf
java.lang.Object
org.specrunner.parameters.core.ParameterHolder
org.specrunner.plugins.core.AbstractPlugin
org.specrunner.plugins.core.AbstractPluginNamed
org.specrunner.plugins.core.AbstractPluginScoped
org.specrunner.plugins.core.AbstractPluginValue
org.specrunner.plugins.core.flow.PluginIf
- All Implemented Interfaces:
- IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
public class PluginIf
- extends AbstractPluginValue
Create a condition execution.
Example of condition:
Consider x is positive the message is "Positive"
else something different happens and the message is "Negative".
With CSS annotations could be:
Consider <span class="if" value="${x > 0}">x is positive<span>
the message is "<span class="then">Positive<span>"
else something different happens and the message is "<span class="else">Negative<span>".
With complex descriptions, the order can be different and the group of
'if'/'then'/'else' can be named to avoid interferences of others
if/then/else.
Example1:
Consider <span class="if" value="${x > 0}" name="test1">x is positive<span>
the message is "<span class="then" name="test1">Positive<span>"
else something different happens and the message is "<span class="else" name="test1">Negative<span>".
Example2:
Consider <span class="if" value="${x > 0}" >x is positive<span>
Consider <span class="if" value="${y > 0}" name="testY">y is negative<span>
the message for x is "<span class="then" name="test1">Positive<span>"
the message for y is "<span class="then" name="testY">Positive<span>"
else something different happens and the message for x is "<span class="else">Negative<span>".
else something different happens and the message for y is "<span class="else" name="testY">Negative<span>".
- Author:
- Thiago Santos
| Methods inherited from class org.specrunner.plugins.core.AbstractPlugin |
copy, doEnd, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, initialize, setCondition, setConditionModel, setNormalized, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString |
TEST_NAME
public static final String TEST_NAME
- The conditional default name. To use another name use 'name' attribute.
- See Also:
- Constant Field Values
PluginIf
public PluginIf()
getActionType
public ActionType getActionType()
- Description copied from interface:
IActionType
- Get the plugin type.
- Returns:
- The type.
doStart
public ENext doStart(IContext context,
IResultSet result)
throws PluginException
- Description copied from interface:
IPlugin
- Performs the start action. i.e. create a database schema. Performed after
initialization.
- Specified by:
doStart in interface IPlugin- Overrides:
doStart in class AbstractPlugin
- Parameters:
context - The context.result - The result set.
- Returns:
- SKIP, to skip node, DEEP, to go deep into the node.
- Throws:
PluginException - On execution errors.
getTest
public static Boolean getTest(IContext context,
String name)
throws PluginException
- Gets the previously calculated condition with the given name.
- Parameters:
context - The context.name - The test name.
- Returns:
- true, if test passed, false, otherwise.
- Throws:
PluginException - On lookup errors.
Copyright © 2014. All rights reserved.