88 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
| # 测试脚本目录
 | ||
| 
 | ||
| 本目录包含了项目的所有测试脚本,按照功能进行了分类组织。
 | ||
| 
 | ||
| ## 目录结构
 | ||
| 
 | ||
| ```
 | ||
| tests/
 | ||
| ├── mcp_servers/          # MCP服务器相关测试脚本
 | ||
| │   ├── test_direct_search.sh
 | ||
| │   ├── test_local_mcp_servers.sh
 | ||
| │   ├── test_mcp_interface.sh
 | ||
| │   ├── test_mcp_servers.sh
 | ||
| │   ├── test_mcp_servers_comprehensive.py
 | ||
| │   ├── test_mcp_servers_improved.py
 | ||
| │   ├── test_mcp_servers_simple.py
 | ||
| │   ├── test_qdrant_ollama_server.py
 | ||
| │   ├── test_qdrant_ollama_tools.sh
 | ||
| │   ├── test_qdrant_ollama_tools_fixed.sh
 | ||
| │   ├── test_search_documents.sh
 | ||
| │   └── test_mcp_search_final.sh
 | ||
| ├── mcp_server_test_report.md  # MCP服务器测试报告
 | ||
| ├── run_all_tests.sh       # 自动化测试运行器
 | ||
| └── legacy/               # 旧的或不再使用的测试脚本
 | ||
| ```
 | ||
| 
 | ||
| ## MCP服务器测试脚本说明
 | ||
| 
 | ||
| ### Shell脚本
 | ||
| - `test_direct_search.sh`: 测试search_documents方法,通过SSH执行Python代码
 | ||
| - `test_local_mcp_servers.sh`: 检查MCP配置,测试服务器可用性(context7, qdrant, qdrant-ollama),验证环境变量
 | ||
| - `test_mcp_interface.sh`: 通过实际接口测试MCP服务器调用,包括tools/list和qdrant_search方法
 | ||
| - `test_mcp_servers.sh`: 通过initialize方法调用测试Qdrant和Qdrant-Ollama MCP服务器
 | ||
| - `test_search_documents.sh`: 添加测试文档并搜索"人工智能"(artificial intelligence)
 | ||
| - `test_qdrant_ollama_tools.sh`: 通过JSON-RPC调用测试search_documents和add_document工具
 | ||
| - `test_qdrant_ollama_tools_fixed.sh`: 测试search_documents、add_document和list_collections工具
 | ||
| - `test_mcp_search_final.sh`: 最终版本的MCP搜索测试脚本
 | ||
| 
 | ||
| ### Python脚本
 | ||
| - `test_qdrant_ollama_server.py`: 启动服务器,测试初始化、工具列表、文档添加和搜索功能
 | ||
| - `test_mcp_servers_comprehensive.py`: 使用asyncio和增强响应处理综合测试MCP服务器
 | ||
| - `test_mcp_servers_improved.py`: 改进版的MCP服务器测试,使用asyncio和增强响应处理
 | ||
| - `test_mcp_servers_simple.py`: 简化版MCP服务器测试,使用同步子进程调用
 | ||
| 
 | ||
| ## 使用方法
 | ||
| 
 | ||
| ### 运行单个测试脚本
 | ||
| ```bash
 | ||
| cd tests/mcp_servers
 | ||
| ./test_local_mcp_servers.sh
 | ||
| ```
 | ||
| 
 | ||
| 或运行Python测试:
 | ||
| ```bash
 | ||
| cd tests/mcp_servers
 | ||
| python test_mcp_servers_simple.py
 | ||
| ```
 | ||
| 
 | ||
| ### 批量运行所有测试
 | ||
| 使用自动化测试运行器脚本,可以一键运行所有测试并生成详细报告:
 | ||
| ```bash
 | ||
| cd tests
 | ||
| ./run_all_tests.sh
 | ||
| ```
 | ||
| 
 | ||
| 自动化测试运行器将:
 | ||
| - 自动运行所有Shell和Python测试脚本
 | ||
| - 彩色输出测试进度和结果
 | ||
| - 生成详细的测试报告(Markdown格式)
 | ||
| - 统计测试通过率和失败情况
 | ||
| - 保存测试日志到文件
 | ||
| 
 | ||
| ## 注意事项
 | ||
| 
 | ||
| - 所有测试脚本都依赖于正确的环境变量配置
 | ||
| - 测试前请确保相关服务(context7, qdrant, qdrant-ollama)已启动
 | ||
| - 某些测试可能需要SSH访问权限
 | ||
| 
 | ||
| ## 测试报告
 | ||
| 
 | ||
| `mcp_server_test_report.md` 文件包含了MCP服务器的详细测试结果,包括:
 | ||
| - context7、qdrant和qdrant-ollama三个服务器的测试状态
 | ||
| - 测试环境和方法说明
 | ||
| - 发现的问题和解决方案
 | ||
| - 环境变量配置详情
 | ||
| - 建议和后续改进方向
 | ||
| 
 | ||
| 建议在运行测试脚本前先阅读测试报告,了解当前的测试状态和已知问题。 |