Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Langgenius Dify Single Node Testing

From Leeroopedia
Revision as of 17:54, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Langgenius_Dify_Single_Node_Testing.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources Dify
Domains Workflow, DAG, Frontend
Last Updated 2026-02-12 00:00 GMT

Overview

Description

Single Node Testing is the principle that allows workflow developers to execute and debug individual nodes in isolation, without running the entire workflow graph. This capability is essential for iterative development: when building complex DAG workflows with many nodes, the ability to test a single node with specific inputs dramatically reduces the feedback loop and accelerates debugging.

The platform supports three forms of single-node testing:

  1. Standard Node Run: Execute any individual node in the workflow draft by providing test input parameters. The backend processes the node with the given inputs and returns the output, execution metadata, and any errors.
  2. Iteration Node Run: Execute a node that is nested inside an Iteration container, using a specialized URL that routes through the iteration context to properly set up the iteration variable scope.
  3. Loop Node Run: Execute a node that is nested inside a Loop container, using a specialized URL that routes through the loop context to properly set up the loop variable scope.

Each of these runs operates against the current draft version of the workflow, ensuring that the developer is testing their most recent changes even before publishing.

Usage

When testing a single node:

  • Identify the target node by its nodeId within the workflow graph.
  • Prepare the test params object, which typically contains the input variable values that the node expects. These can be manually entered or auto-populated from the node's input configuration.
  • Call the appropriate run function based on the node's container context (standard, iteration, or loop).
  • The backend executes the node and returns the result, which the UI displays in the node's test output panel.
  • Nodes inside Iteration or Loop containers require specialized URL construction that includes the container context path, to ensure the iteration/loop variables are properly scoped.

Theoretical Basis

This principle is grounded in:

  • Unit Testing in Pipeline Architectures: Just as unit tests isolate individual functions for verification, single-node testing isolates individual processing steps in a DAG pipeline. This follows the same principle of test isolation that reduces debugging complexity from O(n) (full pipeline) to O(1) (single step).
  • Draft-Based Execution: All single-node runs execute against the draft workflow, not the published version. This mirrors the "preview" concept in content management systems, where authors can test changes before committing them to production. The URL pattern /workflows/draft/nodes/{nodeId}/run explicitly encodes this draft-first design.
  • Context-Aware Routing: Iteration and Loop containers create nested execution scopes with their own variable environments. The specialized URL patterns (/workflows/draft/iteration/nodes/{nodeId}/run and /workflows/draft/loop/nodes/{nodeId}/run) route the execution through the appropriate container handler, ensuring that the node receives the correct scoped variables.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment