I was wondering about running a new version of n8n, but it broke my workflow. After looking at the code of that specific node it was clear: it got refactored and something was broken. But a cool project, needs cool CI (bad joke, I guess) - but it really needs it. So I found this. It already runs on every commit, but there aren’t any tests.
Yes you are totally right we need definitely more tests! It is on our to-do list for a while now and I hope we can get to it soon. In this case we can sadly not do much and have to trust the community as we simply do not have a self-hosted Jira-Version running. At some point we would have to mock all APIs and then run the tests against them. Sadly do we however have currently not the resources to do that.
Normally do we try to avoid any breaking changes in general. Sometimes it is however needed and then they get added here:
So before upgrading this file should always be checked first, to see if anything has to be done.
thanks for answering! I read the changelog before upgrading. The issue linked above doesn’t seem to be related to renaming, instead it changed code in how to retrieve credentials and thus, broke. Anyway, I’ll fix that later.
What I’m asking for is a guideline on how n8n’s plan look like for integrating tests? This project is wonderful, but looses trust on every update if anything broke, that could be easily avoided! I know adding tests afterwards is a hard challenge. But I think it could be easily done by:
adding a test-suite, writing tests “as example” (dear dev, look here for an example on how to test your node).
encouraging developers to write tests for bugfixes (“do you please mind, to add some tests?”).
requiring tests for new nodes - prohibiting merge requests for new nodes without a single test.
That said, do you have an example on how to test a node? As soon as I can spend some time I’ll add tests for jira (on-premise version). I’m eager to learn new things, so please guide me (and other developers) in the correct direction. Please share your plans so this can happen
Ah yes. The breaking-changes only contain breaking-changes we are aware of, do knowingly and on purpose. The issue you are experiencing was not supposed to be there so is more a bug.
About testing. That “plan” or “framework” did sadly not get created yet. Once we have it we will also create some examples, documentation and helper-functions to make it easy for other people to do the same and to create tests.
Thanks a lot for your suggestions, they are very helpful and appreciated! Also very great that you offer to help, so also thanks for that! Great to have people like you being part of the community!
Just wanted to bump up this conversation to see how we’re doing on automated testing of nodes. Looking at the code itself, I still don’t see a lot of tests done on the nodes themselves, only on some of the core functionality.
I’ve been playing around with Jest a little bit using mocks on our custom nodes, but without any success yet. If I had just an example of how a single node could be tested it would be great so I was wondering if you have anything like that Jan?
How is it going in May 2022? Are there any recommendations on how to test nodes? Since then, a huge number of nodes have been developed. And if the community does not write tests, then nodes can break silently. Just paying attention to the important issue of nodes testing.