Logic
Model logic is a set of constraints that define allowed combinations of input parameters and a set of assignments to define values of output parameters. Logic may be used with a function or with a structure.
- Logic of a structure defines dependencies between its parameters.
- Logic of a function defines rules for all parameters of the function.
To access logic of a function, click on the FUNCTION LOGIC tab, which is located at the bottom of the screen. Additionally, the list of logic elements is available on the left panel.
To access logic for a structure, first create a structure and the logic panel should automatically appear. Note, that assignments can be used with functions only (they define values of output parameters which are not allowed in structures).
Logic elements take the form of a standard node, similar to (already explained) parameters and choices. You can add comments, rearrange them, delete them, etc. If something goes wrong don’t worry, you can always undo your actions.
To manually create a constraint, first select the function, click on the FUNCTION LOGIC panel and select ‘Constraints’. A button names ADD CONSTRAINT should appear. Click on it and select a meaningful name. Afterwards, click on the expressions field and write logic (or click the ‘tab’ button). If you want to create an alias element or an assignment element, the procedure is exactly the same.
We know that writing the logic expression manually might not be a trivial task, and therefore, you can use the AI assistant to do it for you. In this scenario create a name (which can be AI generated as well), switch to the ‘expression’ input and wait a few seconds.
This constraint means that giants can only yield axes and maces. Generated test cases prove that the constraint works as expected.
Now, it’s time to explain expressions in more detail.
Constraint
A constraint defines an expression that must be fulfilled by all tests generated from the model. The value of expression in the constraint may be defined as Invariant or Implication.
Invariant
Invariant is an expression type in form of a single statement that must always hold in the generated tests. For example, the following invariant constraint:
means that in the resulting test suite, the choice “dagger” cannot be a part of the “foe weapon” parameter.
Implication
An implication is an expression in a form «IF CONDITION THEN RESULT» (or alternative notation «CONDITION => RESULT»), where CONDITION and RESULT are statements with the same syntax as in the invariant version of the constraint. Implications define constraints that require that for each tests where the CONDITION part is fulfilled, the RESULT part must also be true. For example, the following implication constraint:
means that “Susan” and “Lucy” can only use “dagger”.
Assignments
Assignments are defining values of output parameters in the tests. The syntax is «IF CONDITION THEN ASSIGNMENTS_LIST» (or alternatively «CONDITION => ASSIGNMENT_LIST»), where CONDITION is a statement and ASSIGNMENT_LIST is a comma separated list of assignments of values to chosen output parameters. For example, the following assignment:
means that whenever Peter is in a battle, the outcome is awesome. Note, that for this example we had to create an output parameter:
Output parameters are discussed in more detail in a different tutorial.
Aliases
Aliases are macros that allow defining short names for long statements used in constraints and assignments. Aliases may be then used by their names in other statements of all logic elements (aliases, constraints or assignments). For example, with the following alias:
we can simplify the previously created constraint:
Statements
The detailed explanation of statements is not a part of this short introduction. To find more information please refer to the official documentation, i.e. https://pypi.org/project/testomaton/.

