Icon

02.Generating Unit Test Report - Exercise

<p>This workflow gets a list of unit tests, executes them gathering their statuses and metadata, and generates a PDF execution report with the compiled information.</p>
Annotations and comments
  • Part 4 - Testing Exercise 02 Generating Unit Test Report
  • Learning objective: In this exercise you'll learn how to execute testflows that correspond to different unit tests and concatenate their execution information into a report. Workflow description: This workflow gets a list of unit tests, executes them gathering their statuses and metadata, and generates a PDF execution report with the compiled information. You'll find the instructions to the exercises in the yellow annotations.
  • Step 1. Get a list of unit tests to generate a report from. Drag List Files/Folders to this part of the workflow. When configuring the node, set 'Read' options as 'Relative to' and 'Current workflow', 'Mode' as 'Files in folder', and 'Folder' as '../Unit Tests/'. Connect the output port of this node to the input port of the Table Row to Variable Loop Start node.
  • Step 2. Execute the testflows and import their status and metadata. Here, we'll loop over the list of unit tests executing them one by one and capturing their execution information. Drag a Call Workflow Service node to this part of the workflow and drop it between nodes Table Row to Variable Loop Start and Column Resorter. Configure the Call Workflow Service node to read the first workflow in the '../Unit Tests/' folder and click 'Adjust node ports'. Then go to the Flow Variables tab and set flow variable 'calleeWorkflow > path' as 'Path'. This node will then execute the unit test associated to the filename in variable 'Path', which changes as the loop iterates over the list of unit tests. Connect the output port of the Call Workflow Service node to the input port of the Column Resorter node. Execute the whole workflow and check the created PDF report in the location designated in the Table to PDF node at the end of the workflow.
  • Prepare the PDF report. The status of the testflow is 0 in the case of success and 1 in the case of failure. Let's add some colors to the report and replace these plain numbers with a red and a green square images respectively.
  • Make sure report columns are always in the same order
  • Create path
  • Execution date
  • Concatenate results
  • Testflows Report
  • Write report to PDF
  • Iterate over testflow names

Nodes

Extensions

Links