processes management refundation.

Evaluation removed from conditions, let and exit_conditional
This commit is contained in:
2026-01-25 15:03:52 +01:00
parent 929e75215b
commit 60636b4fd2
45 changed files with 863 additions and 752 deletions

View File

@@ -1,6 +1,6 @@
import random
import libs.testium as tm
from libs.testium import FunctionItem
import py_func.tm as tm
from py_func.tm import FunctionItem
def random_value():
return random.random()

View File

@@ -10,12 +10,12 @@ main:
- let:
name: Set test variables for Linux
condition: "'$(os)' == 'Linux'"
condition: $| "$(os)" == "Linux" |
values:
- terminal_prompt: $(linux_prompt)
- let:
name: Set test variables for Windows
condition: "'$(os)' == 'Windows'"
condition: $| "$(os)" == "Windows" |
values:
- terminal_prompt: $(windows_prompt)
@@ -35,17 +35,17 @@ main:
no_fail: True
exit_condition:
value: "'$(last_test_result)' == 'PASS'"
value: $| "$(last_test_result)" == "PASS" |
- let:
name: let
eval:
- conditional_exec: "random.randint(1, 4)"
values:
- conditional_exec: $| random.randint(1, 4) |
- console:
name: Console creation
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
doc: Opening the console
steps:
@@ -55,56 +55,56 @@ main:
- console:
name: Console read_until with timeout
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
steps:
- read_until: {expected: "$(terminal_prompt)", timeout: 10}
- console:
name: Console write
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
steps:
- writeln: echo 0
- sleep:
name: sleep item
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
timeout: 5
- console:
name: Console read_until immediate
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
steps:
- read_until: {expected: "0", timeout: 0}
- console:
name: Console read_until immediate (2)
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
steps:
- read_until: {expected: "$(terminal_prompt)", timeout: 0}
- console:
name: Console closure
condition: "$(conditional_exec) == 1"
condition: $| $(conditional_exec) == 1 |
console_name: consname
steps:
- close: consname
- sleep:
name: sleep item
condition: "$(conditional_exec) == 2"
condition: $| $(conditional_exec) == 2 |
timeout: 5
- dialog_image:
name: dialog image item
condition: "$(conditional_exec) == 3"
condition: $| $(conditional_exec) == 3 |
question: click ok if you see the image
filename: image.jpg
- dialog_value:
name: dialog_value item
condition: "$(conditional_exec) == 4"
condition: $| $(conditional_exec) == 4 |
question: enter something and click ok

View File

@@ -139,7 +139,7 @@ main:
timeout: 0.2
dialog: false
exit_condition:
value: "$(variable) >= 10"
value: $| $(variable) >= 10 |
# This loop must fail du to an exception in exit condition.
- loop:

View File

@@ -16,7 +16,7 @@ main:
- group:
name: Set test variables for Linux
condition: "'$(os)' == 'Linux'"
condition: $| "$(os)" == "Linux" |
steps:
- let:
@@ -26,7 +26,7 @@ main:
- group:
name: Set test variables for Windows
condition: "'$(os)' == 'Windows'"
condition: $| "$(os)" == "Windows" |
steps:
- let:

View File

@@ -22,6 +22,6 @@ main:
- *seq_sleep
exit_condition:
value: "$(variable) >= 3"
value: $| $(variable) >= 3 |
- !include {file: seq2.tum, is_dialog: True, sleep_timeout: 12, func_para: truc}

View File

@@ -23,5 +23,5 @@ main:
- sleep:
name: sleep item
dialog: true
timeout: 3600
timeout: $| 3600 + random.randint(1, 10) |
no_fail: true

View File

@@ -20,10 +20,10 @@ main:
- let:
name: Extract data
eval:
- text_extract: "[l for l in '''$(rand_text)'''.splitlines() if '$(text_searched)' in l][0]"
values:
- text_extract: $| [l for l in '''$(rand_text)'''.splitlines() if '$(text_searched)' in l][0] |
- dialog_message:
condition: len('$(text_extract)') > 0
condition: $| len('$(text_extract)') > 0 |
name: dialog value test item
question: Tataaaaa !

View File

@@ -8,10 +8,10 @@ This element is of the following form:
- group:
name: Group Item
condition: "'$(OS)' == 'Linux'"
condition: $| "$(OS)" == "Linux" |
steps:
- unittest_file:
test_file: test_prod_rio6_8093.py
test_file: test_prod_alpha_13.py
test_method:
...
- sleep:
@@ -23,4 +23,4 @@ Attributes
--------------------
* The ``steps`` list describes the sequence executed in the group.
It is a list of any of the testium test items,
It is a list of any of the `testium` test items,

View File

@@ -72,9 +72,9 @@ if not provided is given in the table as well.
|``report`` | / | This attribute defines values (a dictionary) which |
| | | will be added in the ``data`` field of the report. |
+-----------------------+-------------------+-------------------------------------------------------+
| ``condition`` | / | The test item is not executed if its |
| | | ``condition`` attribute content is |
| | | evaluated as ``False``. |
| ``condition`` | / | The test item is executed if its |
| | | ``condition`` attribute content is a boolean |
| | | ``True``. |
| | | see :ref:`Conditional |
| | | execution<sec_conditional_execution>`. |
+-----------------------+-------------------+-------------------------------------------------------+
@@ -133,7 +133,8 @@ or in configuration file (see :ref:`config files<sec_configuration_files>`) as a
Conditional execution
-----------------------------------------------
The ``condition`` attribute content is evaluated as a python string.
The ``condition`` attribute content must be a boolean value (if not ``True``, the condition is considered
not met).
.. _sec_process_result:

View File

@@ -11,15 +11,12 @@ This element is of the following form:
values:
key1: value1
key2: value2
eval:
key3: $(variable)[$(loop_index)]
key3: $| $(variable)[$(loop_index)] |
The ``let`` element is used to set values in the global directory.
Attributes
----------------
* The values list gives the {<key>, <value>} couples to set in the
global directory,
* The eval list gives the strings to evaluate prior to its storage into
the <key> of global directory.
* The ``values`` list gives the {<key>, <value>} couples to set in the
global directory,

View File

@@ -39,12 +39,12 @@ Below are described loop test item specific attributes.
* ``Iterator``: giving the number of loop iteration (see dedicated chapter below).
* ``steps``: describes the sequence executed at each cycle; it is
a list of any of the testium test items.
* ``exit_condition``: allows to exit the loop. If False is returned, loop continues
else, it breaks. exit_condition attributes are:
* ``exit_condition``: allows to exit the loop. If True is returned loop continues
otherwise it breaks. exit_condition attributes are:
* ``time``: the loop stops after the time (in minutes) is elapsed (optional)
* ``value``: the loop stops when the content of the value attribute is
evaluated as True (optional)
True (optional)
* ``file``: the loop the script file name that contains a function to be
executed on each loop. Only python script format is supported (optional
if another exit_condition attribute is defined)

View File

@@ -110,13 +110,13 @@ value of the funcToBeExecuted python function.
**Python Interpreter environment setup**
Some global variables have an impact on the ``py_func`` test item behavior:
* ``python_path``: This optional global variable can be used to define
* ``python_bin``: This optional global variable can be used to define
the python executable path. If not defined, the python interpreter is
searched in at the default places in the system.
* ``python_env``: This global variable can be used to define
environment variables for the lua script execution environment.
Only `PATH`, `LUA_PATH`, and `LUA_CPATH` are supported.
Only `PATH` and `PYTHONPATH` are supported.
.. code-block:: yaml
:caption: example of configuration file: param.yaml

View File

@@ -9,7 +9,7 @@ This test item executes a new instance of testium.
- run:
name: Execute TUM
tum_fime: example_cycle.tum
python_path: python3
python_bin: python3
testium_path: /home/francois/projets/testium-new-report/testium.pyw
log_file: $(home)/reports/test.log
report_file: $(home)/reports/test.rep
@@ -21,7 +21,7 @@ run test item has the following specific attributes:
* ``tum_fime``: mandatory the path of the file to execute, it can be relative to current execution folder,
* ``param_file`` (optional) the path of the parameter file to use, otherwise default parameter file is used.
* ``python_path`` (optional) the path of a specific python to run your scripts,
* ``python_bin`` (optional) the path of a specific python to run your scripts,
* ``testium_path`` (optional) the path of a specific testium to run your scripts,
* ``log_file`` (optional) the path of log file to register, if not provided a file is created with timestamp at the location of TUM file.
* ``report_file`` (optional), the path of report file to create