We added a bunch of new features to our project. In addition to the default tests that projects ship with, let’s write some new tests to cover our new feature scope:
Feature
Test Type
What We’re Validating
Multi-agent configuration
Component
Two agents with unique Discord tokens, voice IDs, and plugins
Multi-agent runtime
E2E
Both agents initialize and run simultaneously
ElizaOS projects ship with comprehensive built-in tests for core functionality (character config, plugin loading, runtime behavior). For details on the default test structure, see Testing Projects.
The project-starter.e2e.ts file already contains default tests for core functionality (agent initialization, message processing, memory storage). Add these multi-agent specific tests to the existing ProjectStarterTestSuite.tests array:
src/__tests__/e2e/project-starter.e2e.ts
export const ProjectStarterTestSuite: TestSuite = { name: 'project-starter-e2e', tests: [ { name: 'agent_should_respond_to_greeting', fn: async (runtime: IAgentRuntime) => { // ... existing test code } }, // ... other existing tests // Add the new multi-agent tests: { name: 'multi_agent_project_should_load_both_agents', fn: async (runtime: IAgentRuntime) => { // This test validates that our multi-agent project setup works correctly // It should run once for each agent in the project (Shakespeare and Hemingway) const agentName = runtime.character.name; const agentId = runtime.agentId; // Verify agent has valid identity if (!agentName) { throw new Error('Agent name is not defined'); } if (!agentId) { throw new Error('Agent ID is not defined'); } // Check it's one of our expected agents from the multi-agent guide const expectedAgents = ['Shakespeare', 'Hemingway']; if (!expectedAgents.some(expected => agentName.toLowerCase().includes(expected.toLowerCase()))) { throw new Error(`Unexpected agent name: ${agentName}. Expected one containing: ${expectedAgents.join(', ')}`); } logger.info(`✓ Multi-agent project: ${agentName} initialized successfully`); } }, // Additional tests: agents_should_have_distinct_discord_configurations, // agents_should_have_distinct_voice_configurations, etc.
# Run all testselizaos test# Run only component testselizaos test --type component# Run only E2E tests elizaos test --type e2e# Run specific test suite (case sensitive)elizaos test --name "multi-agent"