Testing capabilities

I plan on introducing n8n in our system. I want to implement some features and am still deciding if n8n is production ready. I want to use n8n as an API, so all of my workflows will be Webhook nodes with Respond to Webhook nodes, accessing external databases and making some external HTTP Requests, and some kafka messaging.

I value testing a lot, but still, I did not find a way to create a reliable test suite. I could do E2E testing in an external project, but I am more interested in mocking HTTP Requests and Setting up a test environment.

If you some knowledge in this direction, please help! n8n is a great tool I just discovered, great job!

Information on your n8n setup

  • n8n version: 1.67.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Ubuntu 24.04

hello @pdany1116

n8n has a pinning mechanism which you can use for mocking whatever you want to mock and test different scenarios and there is another option to how to deal with node errors (e.g. you can continue workflow, or output the error in a different branch to handle the error)

here is an example

plus if you have different environments, then it’s a good idea to set a special variable, like MYENV = DEV/PROD which you can refer to in the corresponding n8n instance with that syntax: {{ $env.MYENV }} and use that logic in the workflows

Hi @pdany1116!

You might as well want to take a look at n8n’s benchmarking suite.

Thank you both for the suggestions!

@barn4k This is a way to mock the input for workflow. How can I make a test for each of my workflows and run all the tests (the whole suite) on a CI/CD platform?

@C7s With benchmarking, I see you can test a workflow with the k6 language in js scripts and some configurations. I was looking more into the http-node example, and I see they mock the responses with an external web mock. How i understand it, is that the benchmarking suite is perfect to testing the performance of the n8n instance, not testing workflows and their logic.

Do you have a concrete real-world example of using it for one of your projects?

Update: I have found this YouTube video from the Prague Meetup presented by @liam.

I started a custom n8n local image with the latest version and cherry-picked the commits from his fork (and fixed conflicts), but unfortunately, I could not make it to work, I can not execute any test scenarios or any other nodes. His idea is promising, but it was not maintained after the presentation.

Anyway, I am still interested if someone can show up their testing suite from a production application.

Actually, I don’t think that n8n is good for CI/CD as it is mostly the GUI tool. Despite a workflow is a simple json file, you can’t do much without the GUI

You can play around with the n8n API to create/run/delete specific workflows and test something, but it doesn’t make much sense. As you have to test a workflow during the designing in any case.

@pdany1116 thanks for trying my tool! Unfortunately, I haven’t been working on it.

It’s not a lack of interest, it is that right now n8n is going through some changes so I am waiting for it to get more stable before spending the time and getting it ready to use in production.

They are changing the entire canvas and that is pretty much where I did all of my additions, so lots will need to be changed. It needed to be refactored anyway (my code). It was very quickly written prototype code.

I will be able to get it working though if you follow it. I plan on having it tightly integrated with a cicd pipeline as i mentioned in the presentation, so as @barn4k is right to a point, it definitely still had a place in a production/critical environment. if nothing else to separate dev and prod.

1 Like

Hi @pdany1116 ! About the n8n benchmarking tool. You are right, that is more about performance testing of an n8n instance, so it’s not the best tool for testing functionality. We are currently working on a bunch of features related to testing and evaluating the output of workflows. However I’m not able to give a timeline when those might come out, besides “soon”.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.