items in progress

This commit is contained in:
2026-01-18 19:06:28 +01:00
parent e841f55c18
commit a84a768aa8
2 changed files with 360 additions and 41 deletions

View File

@@ -70,10 +70,10 @@ config_file:
{% endfor %}
main:
name: testium validation suite
action:
steps:
- group:
name: Test preparation
action:
steps:
- let:
name: Set test variables for Linux
condition: "'$(os)' == 'Linux'"
@@ -139,13 +139,13 @@ config_file:
main:
name: Training file demo
action:
steps:
- item1:
[...]
- loop:
name: Training file demo
action:
steps:
- item2:
[...]
@@ -224,7 +224,7 @@ report:
name: Test loop
stop_on_failure: false
iterator: $(stuff_number)
action:
steps:
- json_rpc:
name: Start a important step
@@ -234,7 +234,7 @@ report:
rcv_port: $(ctrl_rcv_port)
timeout: 30
mute: False
action:
steps:
- query:
method: record.start
params:

View File

@@ -4,45 +4,46 @@
\subsection{Tests items summary}
\begin{frame}{Test items - 1/2}
\small
\begin{NiceTabular}{l X}
\hline
\textbf{Item} & \textbf{Description} \\
\hline
\incode{check} & Checks for a value or expression \\
\incode{console} & Console actions (serial, terminal, telnet, tcp, ssh) \\
\incode{dialog\_choices} & Asks for a choice in list \\
\incode{dialog\_image} & Displays an image \\
\incode{dialog\_message} & Displays a message \\
\incode{dialog\_note} & Asks to enter a note \\
\incode{dialog\_question} & Asks a question with a yes/no choice \\
\incode{dialog\_references} & Asks for references \\
\incode{dialog\_value} & Asks for a value, entered manually \\
\incode{py\_func} & Python function call (from a file) \\
\incode{lua\_func} & Lua function call (from a file) \\
\hline
\end{NiceTabular}
\small
\begin{NiceTabular}{l X}
\hline
\textbf{Item} & \textbf{Description} \\
\hline
\incode{check} & Checks for a value or expression \\
\incode{console} & Console steps (serial, terminal, telnet, tcp, ssh) \\
\incode{dialog\_choices} & Asks for a choice in list \\
\incode{dialog\_image} & Displays an image \\
\incode{dialog\_message} & Displays a message \\
\incode{dialog\_note} & Asks to enter a note \\
\incode{dialog\_question} & Asks a question with a yes/no choice \\
\incode{dialog\_references} & Asks for references \\
\incode{dialog\_value} & Asks for a value, entered manually \\
\incode{py\_func} & Python function call (from a file) \\
\incode{lua\_func} & Lua function call (from a file) \\
\hline
\end{NiceTabular}
\end{frame}
\begin{frame}{Test items - 2/2}
\small
\begin{NiceTabular}{l X}
\hline
\textbf{Item} & \textbf{Description} \\
\hline
\incode{group} & container for grouping things \\
\incode{jsonrpc} & JSON-RPC test item \\
\incode{let} & Defining variables \\
\incode{loop} & Container for repeating things \\
\incode{plot} & Runtime plot utility \\
\incode{report} & Extract a report file \\
\incode{run} & Runs a new instance of \tum{testium} \\
\incode{sleep} & Wait (with or without dialog) \\
\incode{unittest\_file} & Python unittest file \\
\hline
\end{NiceTabular}
\small
\begin{NiceTabular}{l X}
\hline
\textbf{Item} & \textbf{Description} \\
\hline
\incode{group} & container for grouping things \\
\incode{jsonrpc} & JSON-RPC test item \\
\incode{let} & Defining variables \\
\incode{loop} & Container for repeating things \\
\incode{plot} & Runtime plot utility \\
\incode{report} & Extract a report file \\
\incode{run} & Runs a new instance of \tum{testium} \\
\incode{sleep} & Wait (with or without dialog) \\
\incode{unittest\_file} & Python unittest file \\
\hline
\end{NiceTabular}
\end{frame}
\subsection{Tests items common attributes}
% ===== Tests items common features =====
\subsection{Tests items common features}
\begin{frame}{Items common attributes}
\begin{itemize}
@@ -63,3 +64,321 @@
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}{Items common variables}
\begin{itemize}
\item for all test items
\begin{itemize}
\item \incode{last\_test\_result} : contains the result of the step
\begin{itemize}
\item if no result returned by the test
\item \incode{PASS}, \incode{FAIL} or \incode{SKIPPED}
\end{itemize}
\item \incode{ts\_start\_<item\_name>} : The timestamp at the beginning of the item name
\item \incode{ts\_end\_<item\_name>} : The timestamp at the beginning of the item name
\end{itemize}
\item console test item specific variables
\begin{itemize}
\item \incode{cn\_<item\_name>} : Containing the last data which has been read in the console
\end{itemize}
\item func test itm specific variables
\begin{itemize}
\item \incode{fn\_<item\_name>} : The returned value of the last func test item execution
\end{itemize}
\item loop test item specific variables
\begin{itemize}
\item \incode{loop\_index} : loop index (starting from 0)
\item \incode{loop\_param} : current value of the loop iterator
\end{itemize}
\end{itemize}
\end{frame}
% ===== Tests items =====
\subsection{Tests items}
\begin{frame}[fragile]{\incode{console} test item}
\begin{columns}
\column{0.6\textwidth}
\begin{itemize}
\item \incode{open} : Open a console using the specified protocol
\begin{itemize}
\item \incode{Telnet}
\item \incode{ssh}
\item \incode{Serial}
\item \incode{rawTcp}
\item \incode{terminal}
\end{itemize}
\item \incode{close} : Close the console
\item \incode{write} : Write the string in the console
\item \incode{writeln} : Write the string in the console with \textbackslash{}n
\item \incode{read\_until} : Read until an expected string
\begin{itemize}
\item \incode{expected} : The expected string to be received
\item \incode{timeout} : The timeout to read the expected until it fails
\item \incode{no\_fail} : Do not fail even if a timeout occurs
\end{itemize}
\end{itemize}
\column{0.4\textwidth}
\begin{listing}[H]
\begin{minted}{yaml}
- console:
name: test name in GUI
console_name: console name in dict
steps:
- open:
protocol: telnet
telnet_host: $(target_ip)
telnet_port: $(target_port)
- writeln: reset
- read_until: {expected: U-Boot, timeout: 50}
- write: $(boot_vxworks_1)
- writeln: $(boot_vxworks_2)
- read_until:
expected: U-Boot
timeout: 15
- read_until:
expected: Something that will never occurs
timeout: 5
no_fail: True
mute: True
- close:
\end{minted}
\caption{\incode{console} usage example}
\end{listing}
\end{columns}
\end{frame}
\begin{frame}[fragile]{\incode{py\_func} test item function call}
\begin{itemize}
\item The python file must import helpers module \incode{py\_func.tm}
\item Calls the function exec from a Python class
\begin{itemize}
\item The Python class must be inherited from \incode{tm.FunctionItem}
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{python}
import py_func.tm as tm
class TestItemPyFunc(tm.FunctionItem)
def exec(param1, param2, param4, param4):
...
self.reportValue('my_reported_value', reported_value)
print(self.reportedValues())
return 10
\end{minted}
\end{itemize}
\item Calls a Python function by its name
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{python}
def dummy_func(param1, param2, param4, param4):
...
return 10
\end{minted}
\begin{itemize}
\item To get a variable from the global dictionnary : \incode{tm.getgd("global\_dict\_key")}
\item To set a variable from the global dictionnary : \incode{tm.setgd("global\_dict\_key", value)}
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{lua\_func} test item function call}
\begin{itemize}
\item Calls the a lua function from a module
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{lua}
tm = require("testium")
\end{minted}
\begin{itemize}
\item To get a variable from the global dictionnary : \incode{tm.getgd("global\_dict\_key")}
\item To set a variable from the global dictionnary : \incode{tm.setgd("global\_dict\_key", value)}
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{group} test item}
\begin{itemize}
\item \incode{steps}: The list of items in the group
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml}
- group:
name: Group Item
condition: "'$(OS)' == 'Linux'"
steps:
- unittest_file:
test_file: test_prod_rio6_8093.py
test_method:
...
- sleep:
timeout: 10
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{loop} test item}
\begin{columns}
\column{0.6\textwidth}
\begin{itemize}
\item iterator
\begin{itemize}
\item The number of iterations of the loop
\item The list of each iteration parameter
\item Not defined: infinite loop
\end{itemize}
\item \incode{steps}: The list of items to loop
\item \incode{exit\_condition}
\begin{itemize}
\item calls a Python function and stop the \incode{loop} if it does not return \incode{False}
\end{itemize}
\item Variables:
\begin{itemize}
\item \incode{loop\_param}: The loop iterator
\item \incode{loop\_index}: The loop index
\end{itemize}
\end{itemize}
\column{0.4\textwidth}
\begin{listing}[H]
\begin{minted}{yaml}
- loop:
name: Cycle Temperature
iterator: 10
steps:
- unittest_file:
test_file: test_prod_rio6_8093.py
- py_func:
name: function test item
file: scriptTestFile.py
func_name: funcToBeExecuted
param:
- $(loop_param)
exit_condition:
file: script_name.py
func_name: methodName
\end{minted}
\caption{\incode{loop} usage example}
\end{listing}
\end{columns}
\end{frame}
\begin{frame}{\incode{dialog\_x} test items}
\begin{itemize}
\item Dialogs pop-up a message box with a question, information or more
\item Dialogs require an action of the operator
\item Available dialogs are:
\begin{itemize}
\item \incode{dialog\_message} : Display a message to the operator
\item \incode{dialog\_question} : Ask a question and FAIL if the answer is no
\item \incode{dialog\_note} : The operator can write a small note
\item \incode{dialog\_value} : The operator enter a value
\item \incode{dialog\_references}: Ask for the reference, revision and serial number
\item \incode{dialog\_image} : A \incode{dialog\_question} with an image
\item \incode{dialog\_choices} : A choice of items to check
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{let} test item}
\begin{itemize}
\item Add or set a variable in the global dictionary
\begin{itemize}
\item \incode{values}: list of key/values which are to be recorded
\end{itemize}
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml}
- let:
name: Let Item
values:
key1: value1
key2: value2
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{check} test item}
\begin{itemize}
\item A simple test item returning fail if one of its \incode{values} is \incode{false}
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml}
- check:
name: check test item example
values:
- True
- $|$(last_test_result) == 3|
- $|"my string" in "$(my_global_variable)"|
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{sleep} test item}
\begin{itemize}
\item sleeps the requested time
\begin{itemize}
\item \incode{timeout}: the time to sleep in seconds
\item \incode{dialog}: if the sleep shows a dialog (\incode{false} by default)
\end{itemize}
\begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml}
- sleep:
name: sleeps 10 secs
timeout: 10
dialog: true
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{\incode{json_rpc} test item}
\begin{columns}
\column{0.6\textwidth}
\begin{itemize}
\item JSON-RPC is a remote procedure call standard
\item
\begin{itemize}
\item bla
\end{itemize}
\end{itemize}
\begin{listing}[H]
\begin{minted}{yaml}
- json_rpc:
name: JSONRPC UDP query waiting for reception
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
name: echo
method: echo
params:
- Hello World
- {a: 1, b: "hello"}
timeout: 1
- close:
\end{minted}
\caption{\incode{loop} usage example}
\end{listing}
\column{0.4\textwidth}
\begin{listing}[H]
\begin{minted}{yaml}
- json_rpc:
name: JSONRPC UDP query not waiting (only send)
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- {b: "olleh", a: -1}
- World Hello
id: 3095372
no_wait: True
[...]
- json_rpc:
name: JSONRPC UDP Reception
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- receive:
id: 3095372
- close:
\end{minted}
\caption{\incode{loop} usage example}
\end{listing}
\end{columns}
\end{frame}