This directory contains the end-to-end (E2E) testing framework for the AgentAPI project. The framework simulates realistic agent interactions using a script-based approach with JSON configuration files.
go test ./e2eThe testing framework (echo_test.go) does the following:
- Reads a file in
testdata/. - Starts the AgentAPI server with a fake agent (
echo.go). This fake agent reads the scripted conversation from the specified JSON file. - The testing framework then sends messages to the fake agent.
- The fake agent validates the expected messages and sends predefined responses.
- The testing framework validates the actual responses against expected outcomes.
- Create a new JSON file in
testdata/with a unique name. - Define the scripted conversation in the JSON file. Each message must have the following fields:
expectMessage: The message from the user that the fake agent expects.thinkDurationMS: How long the fake agent should 'think' before responding.responseMessage: The message the fake agent should respond with.
- Add a new test case in
echo_test.gothat references the newly created JSON file.
Be sure that the name of the test case exactly matches the name of the JSON file.
- Run the E2E tests to verify the new test case.