Icon

02.Testing_​Component_​Calculate_​Scores - Solution

Testing Component Calculate Scores - Exercise (Solution)

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 testreports. 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 inputport, and the output of the Table Reader node thar reads 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 the Catch 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 metadataSample of processed real-world dataGolden datafor what is expected as the output of the componentTry (VariablePorts) Variable Creator Variable toTable Row Catch Errors(Var Ports) WorkflowService Output Workflow Metadata Table Reader Table Reader Table DifferenceChecker Calculate Scores 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 testreports. 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 inputport, and the output of the Table Reader node thar reads 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 the Catch 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 metadataSample of processed real-world dataGolden datafor what is expected as the output of the componentTry (VariablePorts) Variable Creator Variable toTable Row Catch Errors(Var Ports) WorkflowService Output Workflow Metadata Table Reader Table Reader Table DifferenceChecker Calculate Scores

Nodes

Extensions

Links