Module test_utils

Module test_utils 

Source
Expand description

Testing Utilities - Helper functions for creating test workflows and mock data

This module provides convenient functions to create test workflows, nodes, and analytics data for testing purposes. This is especially useful when writing tests for applications that use oxify-model.

§Example

use oxify_model::test_utils::{create_test_workflow, create_test_analytics};

// Create a simple test workflow
let workflow = create_test_workflow("test", 5);
assert_eq!(workflow.nodes.len(), 5);

// Create mock analytics data
let analytics = create_test_analytics("test", 100, 0.85);
assert_eq!(analytics.execution_stats.total_executions, 100);
assert_eq!(analytics.execution_stats.success_rate, 0.85);

Functions§

create_branching_workflow
Create a branching test workflow with a switch node
create_loop_workflow
Create a workflow with a loop for testing iteration
create_test_analytics
Create mock analytics data for testing
create_test_edge
Create a test edge connecting two nodes
create_test_execution_context
Create a test execution context with the given workflow ID
create_test_llm_node
Create a simple LLM node for testing
create_test_metadata
Create a test workflow metadata with the given name
create_test_node_result
Create a test node execution result with success status
create_test_workflow
Create a simple test workflow with the specified number of nodes
create_test_workflow_batch
Create a batch of test workflows with different configurations