Skip to content

test(tools): comprehensive test suite for workflow_tool module (+60 tests) - #148

Open
manus-use wants to merge 1 commit into
mainfrom
feat/test-workflow-tool
Open

test(tools): comprehensive test suite for workflow_tool module (+60 tests)#148
manus-use wants to merge 1 commit into
mainfrom
feat/test-workflow-tool

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Comprehensive test suite for the manus_agent.tools.workflow_tool module — 60 fully-mocked tests covering the ManusWorkflowManager class and the workflow_tool() entry-point function.

What's tested

ManusWorkflowManager.init (3 tests)

  • Agent registry creation with all 4 agent types
  • Empty agent instance cache on init
  • Config.from_file() invocation

ManusWorkflowManager.get_agent_for_task (9 tests)

  • Default agent type routing (→ manus)
  • Explicit routing for all 4 agent types (manus, browser, data_analysis, mcp)
  • Unknown agent_type fallback to ManusAgent
  • Agent instance caching (same type returns cached instance)
  • system_prompt forwarding to agent constructor
  • No system_prompt omits keyword

ManusWorkflowManager.execute_task (20 tests)

  • String result normalization
  • None result handling
  • Dict result with content list/string/None/other-type
  • Dict result with stop_reason='error'
  • Object result with .content attribute (list/string/None)
  • Unexpected result type fallback (stringification)
  • Dependency context injection (completed deps, non-completed excluded, missing result excluded)
  • No dependencies key
  • Multiple dependencies contributing context
  • Missing dependency in task_results (no crash)
  • Coroutine results (asyncio.run path)
  • Async agent returning dict/None
  • Exception during execution

ManusWorkflowManager.create_workflow (7 tests)

  • Basic creation success
  • Default priority assignment
  • UUID generation for empty workflow_id
  • Store failure propagation
  • Exception handling
  • Status initialization ('created')
  • task_results pending initialization

workflow_tool() entry point (15 tests)

  • All 5 actions: create, start, list, status, delete
  • Validation: missing tasks, missing workflow_id
  • Unknown action error
  • Missing toolUseId UUID generation
  • Top-level exception handling
  • kwargs forwarding to manager context
  • Explicit workflow_id usage

TOOL_SPEC validation (3 tests)

  • Correct name
  • Non-empty description
  • Agent type enum completeness

Edge cases (3 tests)

  • Multiple result items in dependency
  • Empty description task
  • Explicit workflow_id in create

Test methodology

  • 100% mocked — no real HTTP calls, no filesystem, no Docker
  • All agent classes, Config, and WorkflowManager base are mocked
  • Tests verify internal routing, result normalization, and error handling
  • Async coroutine paths tested with real asyncio.run()

Test results

1218 passed, 3 deselected, 3 warnings in 24.53s

(Baseline: 1158 + 60 new = 1218 total, 0 failures)

Open PRs checked (no overlap)

Checked all 50+ open PRs. Specifically confirmed no overlap with:

No existing open or merged PR covers workflow_tool.py testing. The only reference to WorkflowAgent in tests is a single import check in test_packageability.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant