Challenge 23: Testing Your Work
Description: You and your team are working on a lexicon-based sentiment snalysis application, and created a component that encapsulates the calculation of sentiment scores. This component will be re-used in many workflows, so it is important to make sure that it is behaving correctly. A principled way of accomplishing this is through automated unit testing. Given a sample of the data this component receives as input (input golden data), and a small table with the corresponding expected outputs (output golden data), your goal is to create a workflow that automatically tests this component (testflow). Note: Read more about how to perform testing in KNIME here. Note 2: Read more about lexicon-based sentiment analysis here.
Author: Aline Bessa
Dataset: Sentiment scores component, input golden data and output golden data in the KNIME Hub
- Testing is crucial yet often overlooked. There is a section in my book dedicated to discussing the importance of testing.
- In forums, some friends have added try-catch statements for error handling in their workflows. However, this approach poses a problem. The purpose of testing is to expose errors, and by adding error handling, it may make the workflow appear clearer for this particular case. However, when it comes to larger-scale testing, it becomes more difficult to identify errors.
- This requires a basic understanding of Test-Driven Development (TDD) in software development. Combining the design and testing of a workflow in the same workflow is not considered best practice. Similarly, testing multiple cases within the same workflow is also not considered best practice.
- This article about describing tests is very important and worth reading -- Testflows in KNIME Analytics Platform | by SJ Porter
- I discovered some issues with component testing many years ago, which are very easy to get wrong. I will discuss this further when I have the opportunity.
- I made an interesting discovery about the "auto layout" feature. Each time I click, it provides different layouts for the workflow. Just choose a clear and refine one :D