org.specrunner.plugins.core.flow
Class PluginWhile
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.PluginWhile
- All Implemented Interfaces:
- IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
public class PluginWhile
- extends AbstractPluginValue
Performs a conditional loop.
Example:
While the number of elements x (initially 10) is bigger than 5
(x>5), calculate:
| x |
square |
cubic |
| ${x} |
${x * x} |
${x * x * x} |
The CSS annotated version:
<div>
While the number of elements <span class="local" name="x" value="10">x (initially 10)</span> is bigger than 5 (x>5), calculate:
<table border=1>
<tr>
<th>x</th>
<th>square</th>
<th>cubic</th>
</tr>
<tbody class="while" test="x>5">
<tr >
<td>${x}</td>
<td>${x * x}</td>
<td>${x * x * x}</td>
</tr>
<local scope="div" name="x" value="x-1"/>
<tbody>
</table>
</div>
Alternative version using "condition". * The CSS annotated
version:
<div>
While the number of elements <span class="local" name="x" value="10">x (initially 10)</span> is bigger than 5 (<span class="condition" name="cond1">x>5</span>), calculate:
<table border=1>
<tr>
<th>x</th>
<th>square</th>
<th>cubic</th>
</tr>
<tbody class="while" name="cond1">
<tr >
<td>${x}</td>
<td>${x * x}</td>
<td>${x * x * x}</td>
</tr>
<local scope="div" name="x" value="x-1"/>
<tbody>
</table>
</div>
- 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 |
PluginWhile
public PluginWhile()
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.
checkCondition
protected boolean checkCondition(String test,
IContext context)
throws PluginException
- Check condition.
- Parameters:
test - The condition.context - The context.
- Returns:
- true, if condition is valid, false, otherwise.
- Throws:
PluginException - On evaluation errors.
Copyright © 2014. All rights reserved.