diff --git a/src/sections/functionalities.tex b/src/sections/functionalities.tex index 9bfb80f..5a64e28 100644 --- a/src/sections/functionalities.tex +++ b/src/sections/functionalities.tex @@ -52,6 +52,51 @@ \end{columns} \end{frame} +\begin{frame}[fragile]{\incode{store\_result} attribute} +\begin{columns} + \column{0.5\textwidth} + \begin{itemize} + \item Stores the item result into a named global variable + \begin{itemize} + \item accessible via \incode{\$(variable\_name)} in subsequent items + \end{itemize} + \item If the item returns a value (e.g.\ \incode{py\_func}), that value is stored + \item If \incode{process\_result} is also set, the post-processed value is stored + \item If the item returns no value, stores the status string \incode{"PASS"} or \incode{"FAIL"} + \begin{itemize} + \item evaluated \emph{after} \incode{expected\_result} but \emph{before} \incode{no\_fail} + \item captures the real outcome even when \incode{no\_fail: True} + \end{itemize} + \end{itemize} + \column{0.5\textwidth} + \begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml} +- py_func: + name: Read sensor + func_name: read_temperature + store_result: temperature + +- py_func: + name: Check temperature in range + func_name: check_range + param: [$(temperature), 20, 30] + \end{minted} + \begin{minted}[fontsize=\fontsize{6}{7}\selectfont]{yaml} +- console: + name: Send command + console_name: device + steps: + - writeln: reboot + - read_until: {expected: "ready", timeout: 10} + store_result: reboot_status + +- py_func: + name: Use reboot status + func_name: log_status + param: [$(reboot_status)] + \end{minted} +\end{columns} +\end{frame} + \begin{frame}[fragile]{Includes} \begin{itemize} \item a \incode{.tum} file can be included from another \incode{.tum} file diff --git a/src/sections/items.tex b/src/sections/items.tex index 091e274..264d4fb 100644 --- a/src/sections/items.tex +++ b/src/sections/items.tex @@ -61,6 +61,7 @@ \item \incode{condition} : If \incode{true}, will execute the test step. Otherwise, the test step is skipped \item \incode{process\_result} : Processes the result \item \incode{expected\_result} : Expected result of the item + \item \incode{store\_result} : Stores the result in a global variable \item \incode{no\_fail} : If \incode{true}, forces the step result to be \pass{PASS} \end{itemize} \end{itemize} diff --git a/testium_training.pdf b/testium_training.pdf index 186ed60..36dd204 100644 Binary files a/testium_training.pdf and b/testium_training.pdf differ