From 67a8493340f8db55c966ea0fe7310942f3bae82b Mon Sep 17 00:00:00 2001 From: Sambhav Dixit <94298612+sambhavnoobcoder@users.noreply.github.com> Date: Sun, 27 Oct 2024 19:16:27 +0530 Subject: [PATCH] Integration test - apart of modular and small unittests , its time to put to test for larger and more wholesome integration test - an end to end test , to check if this change in code causes any breaks in flow and normal functioning . --- tests/agents/test_agent_logging.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/agents/test_agent_logging.py b/tests/agents/test_agent_logging.py index 2fe13ea9..dcecb1bb 100644 --- a/tests/agents/test_agent_logging.py +++ b/tests/agents/test_agent_logging.py @@ -58,3 +58,29 @@ class TestAgentLogging(unittest.TestCase): 200 ) self.assertEqual(len(self.agent.agent_output.steps), 1) + +class TestAgentLoggingIntegration(unittest.TestCase): + def setUp(self): + self.agent = Agent(agent_name="test-agent") + + def test_full_logging_cycle(self): + task = "Test task" + max_loops = 1 + + result = self.agent._run(task, max_loops=max_loops) + + self.assertIsInstance(result, dict) + self.assertIn('steps', result) + self.assertIsInstance(result['steps'], list) + self.assertEqual(len(result['steps']), max_loops) + + if result['steps']: + step = result['steps'][0] + self.assertIn('step_id', step) + self.assertIn('timestamp', step) + self.assertIn('task', step) + self.assertIn('response', step) + self.assertEqual(step['task'], task) + self.assertEqual(step['response'], f"Response for loop 1") + + self.assertTrue(len(self.agent.agent_output.steps) > 0)