Icon

03.Generating_​Unit_​Test_​Report - Solution

Generating Unit Test Report (Solution)

In this exercise you'll learn how to execute testflows that correspond to different unit tests and concatenate their execution information into a report.

Session 1 - Preparing to Deploy a WorkflowExercise 03.Generating_Unit_Test_ReportIn this exercise you'll learn how to execute testflows that correspond to different unit tests and concatenate their execution information into a report. 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 addsome 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 areport from.1 - Drag List Files/Folders to this part of theworkflow.2 - When configuring the node, set 'Read' optionsas '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 inputport of the Table Row to Variable Loop Startnode. Step 2. Execute the testflows and import their status and metadata. Here, we'll loop over the list of unit tests executingthem one by one and capturing their execution information.1 - Drag Call Workflow Service node to this part of the workflow and drop it between nodes Path to String (Variable) andColumn Resorter.2 - Connect the output port of the Path to String (Variable) to the upper left part of the Call Workflow Service node, suchthat you can see that it connected to one of its flow variables.3 - Configure the Call Workflow Service node to read the first workflow in the ../Unit_Test folder and click 'Adjust node ports'.Then go to the Flow Variables tab and set flow variable 'workflow' as 'Path_'. This node will then execute the unit testassociated to the filename in variable 'Path_', which changes as the loop iterates over the list of unit tests.4 - Connect the output port of the Call Workflow Service node to the input port of the Column Resorter node. Execute thewhole workflow and check the created PDF report in the location designated in the Table to PDF node at the end of theworkflow. Create thetestflow reportExecution dateCreate pathFilename + execution dateReplace plainexecution statuswith the colorRead status dictionarywith imagesBeautify forthe reportIterate overtestflow namesConcatenate resultsConvert path to stringMake sure reportcolumns are alwaysin the same order Table to PDF Date&TimeConfiguration Create File/FolderVariables String Manipulation(Variable) Cell Replacer Table Reader Table Manipulator Table Row ToVariable Loop Start Call WorkflowService Loop End List Files/Folders Path to String(Variable) Column Resorter Session 1 - Preparing to Deploy a WorkflowExercise 03.Generating_Unit_Test_ReportIn this exercise you'll learn how to execute testflows that correspond to different unit tests and concatenate their execution information into a report. 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 addsome 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 areport from.1 - Drag List Files/Folders to this part of theworkflow.2 - When configuring the node, set 'Read' optionsas '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 inputport of the Table Row to Variable Loop Startnode. Step 2. Execute the testflows and import their status and metadata. Here, we'll loop over the list of unit tests executingthem one by one and capturing their execution information.1 - Drag Call Workflow Service node to this part of the workflow and drop it between nodes Path to String (Variable) andColumn Resorter.2 - Connect the output port of the Path to String (Variable) to the upper left part of the Call Workflow Service node, suchthat you can see that it connected to one of its flow variables.3 - Configure the Call Workflow Service node to read the first workflow in the ../Unit_Test folder and click 'Adjust node ports'.Then go to the Flow Variables tab and set flow variable 'workflow' as 'Path_'. This node will then execute the unit testassociated to the filename in variable 'Path_', which changes as the loop iterates over the list of unit tests.4 - Connect the output port of the Call Workflow Service node to the input port of the Column Resorter node. Execute thewhole workflow and check the created PDF report in the location designated in the Table to PDF node at the end of theworkflow. Create thetestflow reportExecution dateCreate pathFilename + execution dateReplace plainexecution statuswith the colorRead status dictionarywith imagesBeautify forthe reportIterate overtestflow namesConcatenate resultsConvert path to stringMake sure reportcolumns are alwaysin the same order Table to PDF Date&TimeConfiguration Create File/FolderVariables String Manipulation(Variable) Cell Replacer Table Reader Table Manipulator Table Row ToVariable Loop Start Call WorkflowService Loop End List Files/Folders Path to String(Variable) Column Resorter

Nodes

Extensions

Links