Junit test for testing a Node's functionality

Hi Team,

I have a node which behaves like ‘CSV Writer’. It accepts an input table and writes out a csv file based on some logic.
Now, I have a method ‘writeCSV(BufferedDataTable inputTable)’. I need to write a junit test with a sample BufferedInputTable and test/validate the written csv file.
How can I create a BufferedDataTable in my junit test?
First of all, is this something that could be best tested with a junit test or test workflow?


Hi @ravikiran,
you should create a testworkflow for situations where you test how your node iteracts with the more complex systems of the platform such as BufferedDataTable. Make use of the nodes in the KNIME testing framework:

If you need to create unit tests you might encounter situations where standard Junit tests will not work due to dependency issues, in those cases you can try running them as Junit plug-in tests.


Hi Gabriel,

Thanks for your answer.

Below is what I have in place:

  1. Created a fragment with extension as ‘org.knime.testing.TestcaseCollector’:

  2. Running the knime with args:
    knime -application org.knime.testing.UnittestRunner -destDir junit_test_results

Now in my test methods, if I need to create a sample BufferedDataTable, how can I do that?
BTW, is this not a junit plugin test?

BufferedDataTable are not designed to be created directly, they depend on an execution context and do not really work in isolation. For testing purposes look at other implementations of the DataTable interface, See the answer bellow Junit test for testing a Node's functionality

Hi Gabriel,

Thanks for the response.
Looks like your last response is truncated. Could you please resend the complete response?


Hi @ravikiran,
In my test cases, I use a DataContainer class to create an instance implementing the DataTable interface.

Hope this helps,


Hi Fabrizio,

Thanks for the pointers. Let me check this and get back to you.


1 Like