The Testing Sandbox
There's nothing worse than deploying a tool and watching it fail on real data. The Testing Sandbox lets you run individual steps, inspect variables, and squash bugs—all without burning through API credits or waiting for full pipeline runs.
What You'll Learn
- How to test individual steps in isolation
- Setting up test inputs and variables
- Understanding test output and timing
- Testing without API calls using mock providers
Why Test Steps Individually?
Imagine a 5-step tool that's failing. Is it step 1? Step 4? The output template? Running the whole thing over and over is slow and expensive. Step-by-step testing lets you:
Isolate Problems
Test one step at a time
Save Money
Only call APIs when ready
Iterate Fast
Quick feedback loops
Opening the Testing Sandbox
The Testing Sandbox is built into the Visual Builder. Here's how to access it:
- Open the Visual Builder:
cmdforge - Navigate to My Tools and select a tool (or create a new one)
- Click Edit to open the tool builder
- Find the step you want to test
- Click the Test button on that step
The Testing Sandbox dialog opens with everything you need:
Input Section
- Test input text area
- Variable table for setting values
- Provider override dropdown
Output Section
- Step output display
- Output variables table
- Execution time
- Success/error status
Testing a Prompt Step
Prompt steps call your AI provider. Here's how to test one:
1. Set Your Test Input
In the input text area, enter the text you want to process:
The quick brown fox jumps over the lazy dog.
This is a sample sentence for testing purposes.
2. Set Variables
If your prompt uses variables like {language} or {max_length},
fill them in the variables table:
| Variable | Value |
|---|---|
input |
(auto-filled from test input) |
language |
Spanish |
max_length |
100 |
3. Choose a Provider
Select which provider to use for this test. You can:
- Use the step's default provider
- Override with a different provider
- Use
mockfor testing without API calls
4. Run the Test
Click Run Test and watch the magic happen. You'll see:
- Output - What the AI returned
- Output Variable - The value stored in
output_var - Timing - How long the call took (in milliseconds)
- Status - Success or error with details
Testing a Code Step
Code steps run Python. The sandbox lets you verify your logic:
Set Up Variables
Code steps often depend on outputs from previous steps. Enter those values manually:
| Variable | Value |
|---|---|
emails_raw |
[email protected], [email protected], invalid-email |
count |
3 |
View All Output Variables
After running, you'll see every variable your code step creates:
emails = ['[email protected]', '[email protected]']
unique_count = 2
is_valid = True
Debugging Tip
If your code step isn't working, add temporary print()
statements. The output will appear in the error/output section, helping you trace what's happening.
Testing a Tool Step
Tool steps call other tools. Testing them works the same way:
- Set the input that will be sent to the tool
- Configure any arguments the tool needs
- Optionally override the provider
- Run and verify the output
This is incredibly useful for debugging composed tools—you can verify each tool in the chain is receiving and producing the right data.
Testing Without API Calls
Don't want to burn through API credits while iterating? Use the mock provider:
Option 1: Override in the Sandbox
Select mock from the provider dropdown before running your test.
Option 2: Create a Smart Mock
Add a mock provider that returns realistic test data:
# In ~/.cmdforge/providers.yaml
providers:
- name: mock
command: 'echo "This is a mock response for testing"'
- name: mock-json
command: 'echo "{"status": "ok", "count": 42}"'
- name: mock-summary
command: 'echo "This is a summary of the input text."'
Pro Tip: Echo the Input
For testing variable flow, create a mock that echoes its input:
- name: echo-mock
command: 'cat' # Just returns whatever is piped in
Common Testing Scenarios
Scenario: "My variable is empty"
Check these in order:
- Is the variable name spelled correctly? (
output_varmatches what you're using) - Did the previous step actually set it? (Test that step first)
- Are you using the right syntax? (
{varname}not$varname)
Scenario: "Provider call failed"
Verify:
- Is the provider configured in
~/.cmdforge/providers.yaml? - Does the provider CLI work on its own? Try:
echo "test" | claude -p - Are API keys/auth set up correctly?
Scenario: "Code step error"
The error message shows the Python exception. Common causes:
- NameError - Variable from previous step not available (test that step)
- SyntaxError - Check your Python indentation and syntax
- TypeError - You're treating a string as a list, or vice versa
The Testing Workflow
Here's how the pros do it:
- 1. Test Step 1 with mock provider - Verify input handling
- 2. Test Step 1 with real provider - Confirm AI output format
- 3. Copy Step 1's output, paste as Step 2's input - Test the handoff
- 4. Repeat for each step - Build confidence layer by layer
- 5. Run the full tool - Everything should work!
Next Steps
- Compose tools together - Build powerful pipelines
- Master code steps - Add Python processing
- Publish your tested tool - Share with confidence