\documentclass[a4paper]{scrreprt}
\usepackage[left=4cm,bottom=3cm,top=3cm,right=4cm,nohead,nofoot]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{enumitem}
\usepackage{subcaption}

\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}

\usepackage{xparse}
\usepackage{multirow}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\textfloatsep}{16pt}

\renewcommand{\labelenumi}{\alph{enumi})}
\renewcommand{\labelenumii}{\arabic{enumii}) }

\newcommand{\baseinfo}[5]{
  \begin{center}
    \begin{tabular}{p{15cm}r}
      \vspace{-4.5pt}{ \Large \bfseries #1} & \multirow{2}{*}{} \\[0.4cm]
      #2 & \\[0.5cm]
    \end{tabular}
  \end{center}
  \vspace{-18pt}\hrule\vspace{6pt}
  \begin{tabular}{ll}
    \textbf{Name:}  & #4\\
    \textbf{Group:} & #5\\
  \end{tabular}
  \vspace{4pt}\hrule\vspace{2pt}
  \footnotesize \textbf{Software Testing} \hfil - \hfil Summer 2022 \hfil - \hfil #3 \hfil - \hfil Sibylle Schupp / Sascha Lehmann \hfil \\
}

\newcounter{question}
\NewDocumentEnvironment{question}{m o}{%
  \addtocounter{question}{1}%
  \paragraph{\textcolor{red}{Task~\arabic{question}} - #1\hfill\IfNoValueTF{#2}{}{[#2 P]}}
  \leavevmode\\%
}{%
  \vskip 1em%
}

\NewDocumentEnvironment{answer}{}{%
  \vspace{6pt}
  \leavevmode\\
  \textit{Answer:}\\[-0.25cm]
  {\color{red}\rule{\textwidth}{0.4mm}}
}{%
  \leavevmode\\
  {\color{red}\rule{\textwidth}{0.4mm}}
}

\newcommand{\projectinfo}[5]{
  \baseinfo{Project Phase #1 - Submission Sheet}{#2}{#3}{#4}{#5}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\name{[Add name here]}
\def\group{[Add group here]}

\begin{document}
\projectinfo{1}{Software Testing - Random Testing\small}{\today}{\name}{\group}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 1 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Select your open source project}[3]
\begin{enumerate}[topsep=0pt, leftmargin=*]
  \item Motivate your selection of the project in 3-5 sentences:
  \begin{answer}
    [TODO: Add answer here]
  \end{answer}

  \item Document the \textbf{build}, \textbf{install}, and \textbf{run} steps for your project:
  \begin{answer}
    [TODO: Add answer here]
  \end{answer}
\end{enumerate}
\end{question}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 2 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Answer basic questions on Random Testing / Randoop}[4]
\begin{enumerate}[topsep=0pt, leftmargin=*]
  \item Answer the following questions (each in 2-3 brief sentences):
  \begin{enumerate}
      \item How do you define "Random Testing" in your own words?
      \begin{answer}
        [TODO: Add answer here]
      \end{answer}

      \item In which testing situations is it used / probably preferred?
      \begin{answer}
        [TODO: Add answer here]
      \end{answer}

      \item What are its most significant downsides?
      \begin{answer}
        [TODO: Add answer here]
      \end{answer}

      \item How does \textit{Randoop} approach the concept of random testing?
      \begin{answer}
        [TODO: Add answer here]
      \end{answer}
  \end{enumerate}
\end{enumerate}
\end{question}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 3 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Get started with Randoop}[3]
\begin{enumerate}[topsep=0pt, leftmargin=*]
  \item Briefly explain the concepts of \textit{error-revealing tests} and \textit{regression tests}:
  \begin{answer}
    [TODO: Add answer here]
  \end{answer}
\end{enumerate}
\end{question}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 4 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Use Randoop for your selected project}[6]
\begin{enumerate}[topsep=0pt, leftmargin=*]
  \item Provide a screenshot of your terminal that indicates your execution of the necessary step(s):
  \begin{answer}
    [TODO: Add answer here]
    % \includegraphics[width=1.0\textwidth]{terminal.jpg}
  \end{answer}

  \item For each of both classes, pick a test from one of the generated files, and briefly describe its sequence of constructor / method calls (1-2 sentences per test):
  \begin{answer}
    [TODO: Add answer here]

    \begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip]
/* Add code here */
    \end{lstlisting}
  \end{answer}

  \item Do the tests represent meaningful scenarios?
  \begin{answer}
    [TODO: Add answer here]
  \end{answer}
\end{enumerate}
\end{question}

\end{document}
