diff --git a/doc/examples/dummy/param_func.xml b/doc/examples/dummy/param_func.xml
deleted file mode 100644
index 22344c1..0000000
--- a/doc/examples/dummy/param_func.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/doc/examples/dummy/param_func.yaml b/doc/examples/dummy/param_func.yaml
new file mode 100644
index 0000000..f211f97
--- /dev/null
+++ b/doc/examples/dummy/param_func.yaml
@@ -0,0 +1 @@
+func_param: param
diff --git a/doc/examples/example_items.tum b/doc/examples/example_items.tum
index 817286b..22742c7 100644
--- a/doc/examples/example_items.tum
+++ b/doc/examples/example_items.tum
@@ -2,10 +2,8 @@
#
config_file:
- - param.xml
- param.yaml
- - param.json
- - $(test_directory)/dummy/param_func.xml
+ - $(test_directory)/dummy/param_func.yaml
main:
name: Test Sample number one
diff --git a/doc/examples/param.json b/doc/examples/param.json
deleted file mode 100644
index 43c6642..0000000
--- a/doc/examples/param.json
+++ /dev/null
@@ -1,4 +0,0 @@
-
-{
- "global_loop_param_list": [["one", "two", "three"],[1, 2, 3]]
-}
diff --git a/doc/examples/param.xml b/doc/examples/param.xml
deleted file mode 100644
index 67ab619..0000000
--- a/doc/examples/param.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
diff --git a/doc/examples/param.yaml b/doc/examples/param.yaml
index 73a2c04..e5b29aa 100644
--- a/doc/examples/param.yaml
+++ b/doc/examples/param.yaml
@@ -2,7 +2,12 @@
#****************************************************************************
# Test configuration
#**************************************************************************** -->
+windows_prompt: >
+linux_prompt: $
+sequence: tm.tum
+
# loops parameters
+global_loop_param_list: [["one", "two", "three"], [1, 2, 3]]
global_loop_param_txt: ['one', 'two', 'three']
global_loop_param_num: [1, 2, 3]
diff --git a/doc/manual/sphinx/source/modes.rst b/doc/manual/sphinx/source/modes.rst
index f140a30..cf720b7 100644
--- a/doc/manual/sphinx/source/modes.rst
+++ b/doc/manual/sphinx/source/modes.rst
@@ -34,7 +34,7 @@ sequences of tests can be called interactively.
:caption: call a test in terminal mode
$ testium -m
- Configuration file loaded: /my/execution/path/param.xml
+ Configuration file loaded: /my/execution/path/param.yaml
[...]
================================================================================
====== Test configuration
diff --git a/doc/manual/sphinx/source/test_items/items_common_attributes.rst b/doc/manual/sphinx/source/test_items/items_common_attributes.rst
index 22c2f24..902329e 100644
--- a/doc/manual/sphinx/source/test_items/items_common_attributes.rst
+++ b/doc/manual/sphinx/source/test_items/items_common_attributes.rst
@@ -195,8 +195,8 @@ Export attribute
key:
- GID-1510554_step_1
report:
- reported_list: @| random.sample(range(0,20), k=10) |
- reported_float: @| math.sqrt(float(1)) |
+ reported_list: $| random.sample(range(0,20), k=10) |
+ reported_float: $| math.sqrt(float(1)) |
reported_str: This is my reported sentence
diff --git a/doc/manual/sphinx/source/test_items/lua_func_test_item.rst b/doc/manual/sphinx/source/test_items/lua_func_test_item.rst
index 7b95d85..9662d3f 100644
--- a/doc/manual/sphinx/source/test_items/lua_func_test_item.rst
+++ b/doc/manual/sphinx/source/test_items/lua_func_test_item.rst
@@ -70,7 +70,7 @@ Some global variables have an impact on the ``lua_func`` test item behavior:
* ``lua_path``: This optional global variable can be used to define
the lua executable path. If not defined, the lua interpreter is
- searched in at the default place in the system.
+ searched in at the default place in the system.
* ``lua_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.
diff --git a/doc/manual/sphinx/source/tum_syntax.rst b/doc/manual/sphinx/source/tum_syntax.rst
index b9029b5..e039a9b 100644
--- a/doc/manual/sphinx/source/tum_syntax.rst
+++ b/doc/manual/sphinx/source/tum_syntax.rst
@@ -39,7 +39,7 @@ Configuration files
A configuration file can be specified in the `.tum` file or by the command line.
This configuration file is optional and must be a YAML file.
-The type of file is recognized by the file name extension `.yaml`.
+The configuration files must have the `.yaml` or `.yml` file name extension.
During the test script loading process, the values defined in these configuration files
are added to the global variables and are then accessible from the test items and scripts
@@ -63,7 +63,7 @@ The parameter file can be specified in the `.tum` file root:
parameter1: value1
parameter2: 1234
- parameter3: @| 12.34 * 2 |
+ parameter3: $| 12.34 * 2 |
parameter4:
- $(parameter1)
- $(parameter3)
@@ -106,8 +106,11 @@ Another possible usage of the global variables is to share persistent data betwe
A library allowing python functions to access global variables is available from the
python scripts. See details in section :ref:`helper library`.
-Apart from the value obtained from the param.xml file, the global varibles entries
-contains also built-in specific value, and test item specific values.
+Apart from the value obtained from the default `param.yaml` or defined configuration files,
+the global variables entries contains also
+
+* built-in specific value (see :ref:`below`),
+* values returned by test items.
.. _sec_global_variables_builtin:
@@ -202,7 +205,7 @@ The variable substitution is recursive and checks all the occurrences of the
``$(x)`` pattern in a string.
It is also possible to perform evaluation of python substrings during parameters passing.
-It is done by using the ``@| expr |`` pattern in a string.
+It is done by using the ``$| expr |`` pattern in a string.
`expr` may then be a correct python expression.
Below are illustrated simple and more complicated cases of expansion and evaluation depending on
@@ -215,10 +218,10 @@ their pattern.
name: Dynamic variables expansion
key: $(test)_PASS
values:
- - expanse_select: @|"$(expanse_select)".replace("o", "a")|
+ - expanse_select: $|"$(expanse_select)".replace("o", "a")|
- expanse_index: $(expanse_index_$(expanse_select))
- expanse_table: $(expanse_table_$(expanse_select))
- - expanse_eval: @|$(expanse_index) == 1|
+ - expanse_eval: $|$(expanse_index) == 1|
Test Items
--------------------
diff --git a/doc/manual/testium_manual.pdf b/doc/manual/testium_manual.pdf
index 06ab50e..120d6a1 100644
Binary files a/doc/manual/testium_manual.pdf and b/doc/manual/testium_manual.pdf differ
diff --git a/src/testium/interpreter/test_items/test_item.py b/src/testium/interpreter/test_items/test_item.py
index 5d2ed79..466b69a 100644
--- a/src/testium/interpreter/test_items/test_item.py
+++ b/src/testium/interpreter/test_items/test_item.py
@@ -143,7 +143,7 @@ class TestItem:
f"'{self.cmd()}' test item named '{self.name()}':\nskipped expresion can only be a static expression as it is evaluated during loading of TUM : {s}",
self.seqFilename(),
)
- # This allow disabling test item directly by using its name inside param.xml file
+ # This allow disabling test item directly by using its name inside param.yaml file
elif self._name in tm.gd("skipped_test_item", []):
self.skipped = True
else:
diff --git a/src/testium/interpreter/test_items/test_item_json_rpc/__init__.py b/src/testium/interpreter/test_items/test_item_json_rpc/__init__.py
index 1610cb9..b73eae2 100644
--- a/src/testium/interpreter/test_items/test_item_json_rpc/__init__.py
+++ b/src/testium/interpreter/test_items/test_item_json_rpc/__init__.py
@@ -1,6 +1,5 @@
import sys
import traceback
-from functools import wraps
from random import randint
from interpreter.utils.tum_except import ETUMSyntaxError
diff --git a/src/testium/interpreter/utils/params.py b/src/testium/interpreter/utils/params.py
index f34c0eb..cb17132 100644
--- a/src/testium/interpreter/utils/params.py
+++ b/src/testium/interpreter/utils/params.py
@@ -313,12 +313,12 @@ def _preprocess_string(value, parent=None):
def _eval_param(value):
"""This function parses a string value to check if patterns corresponding
- to @|xxx| exists.
+ to $|xxx| exists.
When this kind of pattern is found, an attempt to evaluate its
content is done.
If it is not evaluable, not replaced.
"""
- return _parse_and_process("@|", "|", value, evaluate)
+ return _parse_and_process("$|", "|", value, evaluate)
def _process_recursively(func, param_value, *fparams):
diff --git a/src/testium/interpreter/utils/test_init.py b/src/testium/interpreter/utils/test_init.py
index b7cead1..aebf58e 100644
--- a/src/testium/interpreter/utils/test_init.py
+++ b/src/testium/interpreter/utils/test_init.py
@@ -5,7 +5,6 @@ from socket import gethostname
import ast
import json
import yaml
-import xml.etree.ElementTree as ET
import copy
import yaml
@@ -78,7 +77,7 @@ def _locate_config_files(test_dir, config_files, silent=False):
ret = []
pf = []
if len(config_files) == 0:
- for p in ['param.xml', 'param.yaml', 'param.json']:
+ for p in ['param.yaml', 'param.yml']:
param_filename = os.path.join(test_dir, p)
if os.path.exists(param_filename):
pf.append(param_filename)
@@ -210,55 +209,6 @@ def load_test(test_file, test_dir, cmdline_pfs, cmdline_defs):
return test_dict, new_pfs
-def xmltodict(xml_param_file, silent=True):
- """ return a dictionnarie of parameter from xml file.
- """
- tag = 'parameter'
- returned_dict = {}
- returned_str_dict = {}
- xml_tree = ET.parse(xml_param_file)
- xml_root = xml_tree.getroot()
- xml_params = xml_root.findall(tag)
-
- for param in xml_params:
- name = param.get('name', '')
- if name != '':
- v = param.get('value', None)
- if v is None:
- v = param.get('str', '')
- v = v.replace("\\n", "\n")
- v = v.replace("\\r", "\r")
- v = v.replace("\\t", "\t")
- returned_str_dict[name] = v
- else:
- v = v.replace("\\n", "\n")
- v = v.replace("\\r", "\r")
- v = v.replace("\\t", "\t")
- returned_dict[name] = v
-
- # reinitializes the global dict values with the xml file content
- globdict.global_dict.update(returned_str_dict)
- globdict.global_dict.update(returned_dict)
-
- for i in range(10):
- for key, val in returned_dict.items():
- val = expanse(val)
- returned_dict.update({key: val})
-
- globdict.global_dict.update(returned_dict)
-
- if not silent:
- if not tm.debug_enabled():
- tm.print_info(f"\"{xml_param_file}\" loaded.")
- else:
- tm.print_debug(f"\"{xml_param_file}\" loading:")
- for k, v in returned_str_dict.items():
- tm.print_debug(f" {k}: {v}")
- for k, v in returned_dict.items():
- tm.print_debug(f" {k}: {v}")
- tm.print_debug(f"done.")
-
-
def yamltodict(param_file, silent=True):
# load of the file
with open(param_file, 'r') as fd:
@@ -290,33 +240,6 @@ def yamltodict(param_file, silent=True):
globdict.global_dict.update(dp)
-def jsontodict(param_file, silent=True):
- with open(param_file, 'r') as fd:
- s = fd.read()
- dp = json.loads(s)
-
- # update the global dict with raw data
- globdict.global_dict.update(dp)
-
- # Apply variables expansion
- for i in range(10):
- for key, val in dp.items():
- val = expanse(val)
- dp.update({key: val})
-
- if not silent:
- if not tm.debug_enabled():
- tm.print_info(f"\"{param_file}\" loaded.")
- else:
- tm.print_debug(f"\"{param_file}\" loading:")
- for k, v in dp.items():
- tm.print_debug(f" {k}: {v}")
- tm.print_debug(f"done.")
-
- # Finalize the global dict update
- globdict.global_dict.update(dp)
-
-
def _feed_gd_with_params(param_file, silent=True):
test_dir = tm.gd('test_directory')
# param files pre-processing
@@ -340,15 +263,11 @@ def _feed_gd_with_params(param_file, silent=True):
raise ETUMSyntaxError(f'Parameter file "{pf}" not found')
ext = os.path.splitext(pf)[1]
- if ext == '.xml':
- xmltodict(pf, silent)
- elif ext == '.json':
- jsontodict(pf, silent)
- elif ext == '.yaml':
+ if (ext == '.yaml') or (ext == '.yml'):
yamltodict(pf, silent)
else:
raise ETUMSyntaxError(
- 'config files must be "*.xml", "*.yaml" or "*.json"')
+ 'config files must be "*.yaml" or "*.yml"')
def set_standard_gd_keys(test_name, test_dir, test_file, config_files):
diff --git a/test/validation/items/common/results/test.tum b/test/validation/items/common/results/test.tum
index 3d333a9..007ee12 100644
--- a/test/validation/items/common/results/test.tum
+++ b/test/validation/items/common/results/test.tum
@@ -138,7 +138,7 @@
- py_func:
name: Return True expect False but no_fail expansed
- no_fail: @| bool(0) == False |
+ no_fail: $| bool(0) == False |
key: $(test)_PASS
file: $(test_path)$(psep)results$(psep)results.py
func_name: echo
@@ -147,7 +147,7 @@
- py_func:
name: Return True expect False but no_fail expansed (must fail)
- no_fail: @| bool(1) == False |
+ no_fail: $| bool(1) == False |
key: $(test)_FAIL
file: $(test_path)$(psep)results$(psep)results.py
func_name: echo
diff --git a/test/validation/items/expanse/param.yaml b/test/validation/items/expanse/param.yaml
index c96c18d..f3a3d8f 100644
--- a/test/validation/items/expanse/param.yaml
+++ b/test/validation/items/expanse/param.yaml
@@ -9,4 +9,4 @@ expanse_index_blo: 1
expanse_index: $(expanse_index_$(expanse_select))
expanse_table: $(expanse_table_$(expanse_select))
-expanse_eval: @|$(expanse_index) == 1|
+expanse_eval: $|$(expanse_index) == 1|
diff --git a/test/validation/items/expanse/test.tum b/test/validation/items/expanse/test.tum
index 4ad40a2..1180b5a 100644
--- a/test/validation/items/expanse/test.tum
+++ b/test/validation/items/expanse/test.tum
@@ -10,10 +10,10 @@
name: Dynamic variables expansion
key: $(test)_PASS
values:
- - expanse_select: @|"$(expanse_select)".replace("o", "a")|
+ - expanse_select: $|"$(expanse_select)".replace("o", "a")|
- expanse_index: $(expanse_index_$(expanse_select))
- expanse_table: $(expanse_table_$(expanse_select))
- - expanse_eval: @|$(expanse_index) == 1|
+ - expanse_eval: $|$(expanse_index) == 1|
- check:
name: Check variables expansion is correct (PASS)
@@ -33,7 +33,7 @@
- var4: blo
- expanse_var_bla: 3
- expanse_blo_var: 5
- - expanse_complex: @|@|$(expanse_$(var2)_$(var3))*6| + @|4*$($(var1)_$(var4)_$(var2))||
+ - expanse_complex: $|$|$(expanse_$(var2)_$(var3))*6| + $|4*$($(var1)_$(var4)_$(var2))||
- check:
name: Check complex variables expansion is correct (PASS)
@@ -50,10 +50,10 @@
- expanse_var_2: 6
- expanse_object:
[
- { a: $(expanse_var_2), $(expanse_key): @|2**3| },
+ { a: $(expanse_var_2), $(expanse_key): $|2**3| },
{
- '@|"bla".replace("a", "o")|':
- [@|$(expanse_var)*$(expanse_var_2)|, 25],
+ '$|"bla".replace("a", "o")|':
+ [$|$(expanse_var)*$(expanse_var_2)|, 25],
},
]
diff --git a/test/validation/param.yaml b/test/validation/param.yaml
index 1dea0f5..534c4ac 100644
--- a/test/validation/param.yaml
+++ b/test/validation/param.yaml
@@ -1,5 +1,5 @@
# All sub directory in items are evaluated as a list
-items: @| [os.path.basename(f.path) for f in os.scandir(os.path.join(r"$(test_directory)", "items")) if f.is_dir()] |
+items: $| [os.path.basename(f.path) for f in os.scandir(os.path.join(r"$(test_directory)", "items")) if f.is_dir()] |
# - common
# - check
# - console