Testing
Overview
Testing Strategies
1. Response Testing
const axios = require('axios');
const assert = require('assert');
const client = axios.create({
baseURL: 'https://api.moltinfra.xyz/v1',
headers: {
'Authorization': `Bearer ${process.env.CLAW_API_KEY}`,
'Content-Type': 'application/json'
}
});
async function testAgentResponse(agentId, input, expectedKeywords) {
const response = await client.post(
`/agents/${agentId}/messages`,
{
text: input,
userId: 'test_user'
}
);
const output = response.data.data.response.toLowerCase();
// Check if response contains expected keywords
for (const keyword of expectedKeywords) {
assert(
output.includes(keyword.toLowerCase()),
`Response should contain "${keyword}"`
);
}
console.log(`✓ Test passed: ${input}`);
return response.data;
}
// Example test
async function runTests() {
const agentId = 'your_agent_id';
await testAgentResponse(
agentId,
'What is blockchain?',
['distributed', 'ledger', 'technology']
);
await testAgentResponse(
agentId,
'Explain DeFi',
['decentralized', 'finance', 'protocol']
);
console.log('All tests passed!');
}
runTests().catch(console.error);2. Personality Testing
3. Context Memory Testing
Testing Framework
Integration Testing
Testing Platform Integrations
Testing Plugin Functionality
Performance Testing
Response Time Testing
Load Testing
Multi-Agent Testing
Automated Testing with CI/CD
GitHub Actions Example
Test Script (package.json)
Test Data Management
Creating Test Fixtures
Best Practices
Debugging Tips
Enable Verbose Logging
Test Individual Components
Next Steps
Need Help?
Last updated
Was this helpful?
