Icon

02.Testing_​Component_​Calculate_​Scores - Exercise

Testing Component Calculate_Scores

In this exercise you'll practice the creation of unit tests and how to structure them to facilitate the creation of automated test reports. Here, we test if a (shared) component that calculates sentiment scores does the job correctly.

Session 1 - Preparing to Deploy a WorkflowExercise 02.Testing_Component_Calculate_ScoresIn this exercise you'll practice the creation of unit tests and how to structure them to facilitate the creation of automated test reports. Here, we test if a (shared)component that calculates sentiment scores does the job correctly. Step 1. Check the differences between the golden data and the output of the component1. Drag node Table Difference Checker to this part of the workflow. Connect the output of component Calculate Scores to its upper input port, and the output of the Table Reader node tharreads the golden table to its lower port. 2. In the configuration menu for node Table Difference Checker, leave 'Checker' option set as 'Equality' for all columns. 3. Right-click node Table Difference Checker and select option Show Flow Variable Ports. Connect the output flow variable port of this node (the rightmost one) to the upper input port of theCatch Errors (Var Ports) node. 4. Reset and execute the whole workflow. The test should pass.5. Save this workflow and move it to folder "Session 1 - Exercises/Unit_Tests" Alternative input in casethe test failsCapture informationrelated to testexecutionExport statusand metadataWorkflow execution statusand metadataRead real-worldinput for componentRead golden datafor what is expected as the output of the component Calculate Scores Try (VariablePorts) Variable Creator Variable toTable Row Catch Errors(Var Ports) WorkflowService Output Workflow Metadata Table Reader Table Reader Session 1 - Preparing to Deploy a WorkflowExercise 02.Testing_Component_Calculate_ScoresIn this exercise you'll practice the creation of unit tests and how to structure them to facilitate the creation of automated test reports. Here, we test if a (shared)component that calculates sentiment scores does the job correctly. Step 1. Check the differences between the golden data and the output of the component1. Drag node Table Difference Checker to this part of the workflow. Connect the output of component Calculate Scores to its upper input port, and the output of the Table Reader node tharreads the golden table to its lower port. 2. In the configuration menu for node Table Difference Checker, leave 'Checker' option set as 'Equality' for all columns. 3. Right-click node Table Difference Checker and select option Show Flow Variable Ports. Connect the output flow variable port of this node (the rightmost one) to the upper input port of theCatch Errors (Var Ports) node. 4. Reset and execute the whole workflow. The test should pass.5. Save this workflow and move it to folder "Session 1 - Exercises/Unit_Tests" Alternative input in casethe test failsCapture informationrelated to testexecutionExport statusand metadataWorkflow execution statusand metadataRead real-worldinput for componentRead golden datafor what is expected as the output of the component Calculate Scores Try (VariablePorts) Variable Creator Variable toTable Row Catch Errors(Var Ports) WorkflowService Output Workflow Metadata Table Reader Table Reader

Nodes

Extensions

Links