Icon

02.Generating Unit Test Report - Solution

<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>
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.

  1. 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.

  2. 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.

  3. 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.


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.

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.

Step 1. Get a list of unit tests to generate a report from.

  1. Drag List Files/Folders to this part of the workflow.

  2. When configuring the node, set 'Read' options as 'Relative to' and 'Current workflow', 'Mode' as 'Files in folder', and 'Folder' as '../Unit Tests/'.

  3. Connect the output port of this node to the input port of the Table Row to Variable Loop Start node.


Create report
Report
List Files/Folders
Report Template Creator
Concatenate results
Loop End
Make sure reportcolumns are alwaysin the same order
Column Resorter
Variable Expression
Call Workflow Service
Write report to PDF
Report PDF Writer
Path to String (Variable)
Create path
Create File/Folder Variables
Iterate overtestflow names
Table Row to Variable Loop Start
Execution date
Date&Time Configuration

Nodes

Extensions

Links