-
Notifications
You must be signed in to change notification settings - Fork 0
Logics
Logics are elements to use in the condition command to add more complexity into your scenario. This Logics are classes extending Automate\Transformer\Logic\Logic
and implementing answeredBy
method. Logics only use variable scopes to get data and provide helper methods to achieve that. This is a basic example :
<?php
namespace MyNamespace\Logics;
use Automate\Transformer\Logic\Logic;
class MyLogic extends Logic
{
public function answeredBy() : bool
{
$scenario = $this->getScenarioVariable('myScenarioVariable');
$world = $this->getWorldVariable('myWorldVariable');
$spec = $this->getSpecVariable('mySpecVariable');
$or = $this->get(Scope::SCENARIO, 'myScenarioVariable');
return true;
}
}
Also you will need to add the logics configuration lines in your configuration file. This is the configuration part that is not required for AutoMate if you don't use Logics.
logics:
namespaces:
logics: 'MyNamespace\Logics'
others: 'MyOtherNamespace\Another\Logics'
valueAtException: false
Detail all the namespaces to where your logics belong. logics
and others
are the name used in your scenario in the condition command like (based on the example above) :
condition:
logic: logics.MyLogic
correct:
steps:
- go: http://test.fr
incorrect:
steps:
- go: http://mytestfailed.fr
This follow the pattern namespace_name.class but you can also only use the class name as
logic: MyLogic
and AutoMate will test this classname for every namespace you configured.
This is the default value if the answeredBy
from your logic throw an Exception. This can help.
Logics are not blocking the execution. If it throws an exception, the LogicExecutor will just throw an event LOGIC_EXCEPTION and the PrintListener will print the Exception class.
AutoMate Wiki - v0.8.0 - This wiki can change at any moment