MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_command

Method test_command

examples/commands/command_system_e2e_demo.py:86–106  ·  view source on GitHub ↗

Test a single command and report results.

(
        self, command: str, description: str, expect_in_output: List[str] = None
    )

Source from the content-addressed store, hash-verified

84 print()
85
86 def test_command(
87 self, command: str, description: str, expect_in_output: List[str] = None
88 ):
89 """Test a single command and report results."""
90 output.print(f"[dim]Testing:[/dim] {description}")
91 output.print(f"[yellow]Command:[/yellow] {command}")
92
93 success = self.run_command(command, expect_in_output)
94
95 if success:
96 output.success("✓ Passed")
97 else:
98 output.error("✗ Failed")
99 if expect_in_output:
100 output.warning(f"Expected to find: {', '.join(expect_in_output)}")
101
102 self.test_results.append(
103 {"command": command, "description": description, "success": success}
104 )
105 print()
106 return success
107
108 def run_demo(self):
109 """Run the complete e2e demo."""

Callers 1

run_demoMethod · 0.95

Calls 2

run_commandMethod · 0.95
successMethod · 0.80

Tested by

no test coverage detected