added store_result functionality

This commit is contained in:
2026-04-20 22:36:42 +02:00
parent 9942f33458
commit e993a9595a
3 changed files with 46 additions and 0 deletions

View File

@@ -52,6 +52,51 @@
\end{columns} \end{columns}
\end{frame} \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{frame}[fragile]{Includes}
\begin{itemize} \begin{itemize}
\item a \incode{.tum} file can be included from another \incode{.tum} file \item a \incode{.tum} file can be included from another \incode{.tum} file

View File

@@ -61,6 +61,7 @@
\item \incode{condition} : If \incode{true}, will execute the test step. Otherwise, the test step is skipped \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{process\_result} : Processes the result
\item \incode{expected\_result} : Expected result of the item \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} \item \incode{no\_fail} : If \incode{true}, forces the step result to be \pass{PASS}
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}

Binary file not shown.