% ===== Introduction =====
\section{Introduction}

% ===== Main features =====
\subsection{Main features}

\begin{frame}{\tum{testium} main features}
\begin{columns}
  \column{0.45\textwidth}
  \begin{itemize}
    \item Automates the execution of tests
    \item GUI or console mode
    \item Stores logs
    \item Generates test reports
    \item Usable for production and engineering testings
    \item Mainly based on:
    \begin{itemize}
      \item Python3
      \item QT6
      \item Jinja2
    \end{itemize}
  \end{itemize}
  \column{0.55\textwidth}
  \vfill
  \includegraphics[width=\linewidth]{testium_gui.png}
  \vfill
\end{columns}
\end{frame}

\begin{frame}[fragile]{ \tum{testium} input files}
\begin{columns}
  \column{0.5\textwidth}
  \begin{itemize}
    \item Test scripts (.tum)
    \begin{itemize}
      \item Files written in \incode{YAML}
      \item Wide range of test items
      \item Loops, Variables, conditional execution
      \item Modular templating using \incode{Jinja2}
    \end{itemize}
    \item Configuration files (.yaml, .yml)
    \begin{itemize}
      \item \incode{YAML} test configuration / parameters
    \end{itemize}
  \end{itemize}
  \begin{listing}[H]
  \begin{minted}{yaml}
# All sub directory in items are evaluated as a list
items: $| [os.path.basename(f.path) for f in os.scandir(os.path.join("$(test_directory)", "items")) if f.is_dir()] |

# Parameters of the validation execution
validation_report_path: $(test_directory)/../tmp/
validation_report_file: validation

# various parameters
windows_prompt: ">"
linux_prompt: "$ "
[...]
  \end{minted}
  \caption{Example of config file}
  \end{listing}

  \column{0.5\textwidth}
  \begin{listing}[H]
  \begin{minted}{yaml}
config_file:
    - param.yaml
{% for item in items %}
    - "items/{{ item }}/param.yaml"
{% endfor %}
main:
    name: testium validation suite
    action:
        - group:
            name: Test preparation
            action:
                - let:
                    name: Set test variables for Linux
                    condition: "'$(os)' == 'Linux'"
                    values:
                        - terminal_prompt: $(linux_prompt)
                        - psep: "/"
                - let:
                    name: Set test variables for Windows
                    condition: "'$(os)' == 'Widarkbluendows'"
                    values:
[...]
  \end{minted}
  \caption{Example of test file}
  \end{listing}
\end{columns}
\end{frame}

\begin{frame}{command line interface}
  \begin{itemize}
    \item  \tum{testium} can be invoked with the following options:
    \begin{itemize}
      \item \incode{-h}: command line help
      \item \incode{-b}: batc5h mode (execution of the test script without GUI)
      \item \incode{-c}: Use a specific config file
      \item \incode{-i}: Set a specific include path
      \item \incode{-g}: Run in debug mode (for vscode debug only)
      \item \incode{-r}: Run the test and close
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}[fragile]{Test scripts}
\begin{columns}
  \column{0.6\textwidth}
    \begin{itemize}
      \item Hierarchic list of test items
      \begin{itemize}
        \item \incode{main} is the root of the test script
        \item \incode{config\_file} list of config/params files
        \item \incode{report} global report parameters section
      \end{itemize}
      \item \incode{main} contains test items
      \begin{itemize}
        \item executed iteratively from top to bottom
        \item container items can have children
          \begin{itemize}
            \item \incode{loop}
            \item \incode{group}
          \end{itemize}
      \end{itemize}
      \item \incode{!include} directive
      \begin{itemize}
        \item include sub-tests
        \item allow the use of templates
      \end{itemize}
    \end{itemize}
  \column{0.4\textwidth}
    \begin{listing}[H]
    \begin{minted}{yaml}

config_file:
    - param.yaml

main:
    name: Training file demo
    action:
        - item1:
            [...]

        - loop:
            name: Training file demo
            action:
                - item2:
                [...]

        - item3:
            [...]

        [...]

        - !include path/to/my/subtest.tum

        [...]

report:
    [...]
    \end{minted}
    \caption{A main test file}
    \end{listing}
\end{columns}
\end{frame}

\subsection{Advanced features}

\begin{frame}{Variable expansion \& global dictionary}
\begin{columns}
  \column{0.5\textwidth}
    \begin{itemize}
      \item Persistence between steps
      \item Variable expansion: \incode{\$(my\_variable)}
      \begin{itemize}
        \item The \incode{my\_variable} value is taken in the global dictionary if the key exists
      \end{itemize}
      \item Accessed from python functions:
      \begin{itemize}
        \item \incode{tm.getgd}
        \item \incode{tm.setgd}
        \item \incode{tm.delgd}
      \end{itemize}
    \end{itemize}
  \column{0.5\textwidth}
    \begin{itemize}
      \item Built-in variables:
      \begin{itemize}
        \item \incode{test\_directory}: the folder of the main tum file
        \item \incode{test\_main\_file}: the main tum file
        \item \incode{os}: The OS used by the system (Linux or Windows)
        \item \incode{host\_name}: The hostname of the machine
        \item \incode{home}: The home directory of the user
        \item \incode{test\_outputs}: The list of the paths of the test log and test report
        \item \incode{testrun\_date}: The date when the test started YYYY-MM-DD
        \item \incode{testrun\_time}: The time when the test started HH:MM:SS
      \end{itemize}
    \end{itemize}
\end{columns}
\end{frame}

\begin{frame}[fragile]{Inline evaluation of python statements}
\begin{columns}
  \column{0.6\textwidth}
    \begin{itemize}
      \item \incode{\$|<statement>|}
      \begin{itemize}
        \item Python evaluation of \incode{statement}
        \item Evaluated in:
          \begin{itemize}
            \item YAML config files
            \item tum files
            \item compatible with variables expansion
          \end{itemize}
      \end{itemize}
    \end{itemize}
  \column{0.4\textwidth}
    \begin{listing}[H]
    \begin{minted}{yaml}
[...]
- loop:
    name: Test loop
    stop_on_failure: false
    iterator: $(stuff_number)
    action:

      - json_rpc:
          name: Start a important step
          udp:
            server: $(dut_eth0_ip)
            snd_port: $(ctrl_snd_port)
            rcv_port: $(ctrl_rcv_port)
          timeout: 30
          mute: False
          action:
            - query:
                method: record.start
                params:
                  - slot: $|$(loop_index) + 1|
                    input: $|($(test_data))[$(loop_index)]|
                    quality: medium
[...]
    \end{minted}
    \caption{variables expansion and evaluation examples}
    \end{listing}
\end{columns}
\end{frame}

\begin{frame}{Inline evaluation of python statements - Examples}
  \begin{itemize}
    \item simple
    \begin{itemize}
      \item \incode{\$|\$(loop\_index)+1|}
    \end{itemize}
    \item table indexing
    \begin{itemize}
      \item \incode{\$|(\$(my\_table))[\$(loop\_index)]|}
    \end{itemize}
    \item string
    \begin{itemize}
      \item \incode{\$|"\$(video\_path)"+(\$(vstream\_formats))[0]+".mkv"|}
    \end{itemize}
    \item Random list of integers
    \begin{itemize}
      \item \incode{\$|[random.sample(range(0,8), k=4)]|}
    \end{itemize}
  \end{itemize}
\end{frame}

% ===== Links for documentation / code =====evaluation and
\subsection{Documentation and example code}

\begin{frame}{Links for documentation and example code}
\begin{itemize}
  \item Git repository
  \begin{itemize}
    \item \url{https://git.beafrancois.fr/v_and_v/testium}
    \item Also possibility to do suggestions or raise tickets
  \end{itemize}
  \item \href{https://git.beafrancois.fr/v-and-v/testium/src/branch/main/doc/manual/testium_manual.pdf}{Reference documentation}
  \item \href{https://git.beafrancois.fr/v-and-v/testium/src/branch/main/test/validation}{ \tum{testium} validation suite}
\end{itemize}
\end{frame}
