❓ Discussion: How do you test your flows?

Actually, you reminded me that there is an assert node. In fact 2:

https://flows.nodered.org/search?term=assert

2 Likes

I use inject nodes with different test messages an debug node to check output. I know it's not a real test.
I did not know about assert node. I'll have a look.
Anyway, it would very nice to get some indications on best practises to do testing on NodeRed.

1 Like

Hi Nick,
a bit late to the party. Unfortunately I don't have a test suite outside my flow (like e.g. in noflo) but I do have some tests inside my flow.

  • With my node-red-contrib-msg-speed node I test whether the messages arrive at the expected speed (within limits). E.g. for image streams from IP camera's...
  • With my node-red-contrib-interval-length node I test whether the time interval between successive messages isn't too big. When no message arrives within a specified time interval, a timeout message will be generated... E.g. to make sure that I have periodically measurements from my sensors.
  • With switch nodes I test whether the values in the messages have expected values.

Of course these are end-to-end tests. E.g. when my IP camera fails, the test will fail although my flow might be correct. So I'm not mocking the camera by an oscillator node, for checking the flow only...

And a disadvantage is that these 'test" nodes pollute my real flow a bit ...
Bart

Having a test suite for your flows is a great idea. It helps you catch any issues early and ensures everything works smoothly. I have yet to create tests outside of Node-RED, but I've used the built-in testing functionality. I'd love to hear more about how people are testing their flows and what tools they're using. Have you heard of ZapTest https://www.zaptest.com/api-testing-automation? It's a free API testing automation tool worth checking out. Thanks for starting this discussion. I'm looking forward to learning more!