|
| 1 | +# ⚡ 快速测试指南 |
| 2 | + |
| 3 | +**5分钟快速验证你的修改** 🚀 |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🎯 方法1: 一键自动验证 (推荐) |
| 8 | + |
| 9 | +```bash |
| 10 | +cd /Users/shaojie/IdeaProjects/spring-ai |
| 11 | +./verify-changes.sh |
| 12 | +``` |
| 13 | + |
| 14 | +**期望输出**: |
| 15 | +``` |
| 16 | +🎉 恭喜!所有验证通过! |
| 17 | +✨ 你的修改已准备就绪,可以提交PR |
| 18 | +``` |
| 19 | + |
| 20 | +**测试覆盖**: |
| 21 | +- ✅ Spring Java Format 验证 |
| 22 | +- ✅ 核心单元测试 (18个测试) |
| 23 | +- ✅ 模块所有测试 (100+个测试) |
| 24 | +- ✅ 模块构建 |
| 25 | + |
| 26 | +**耗时**: 约1-2分钟 |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## 📋 方法2: 手动分步验证 |
| 31 | + |
| 32 | +### **第1步: 格式验证** (必须) |
| 33 | + |
| 34 | +```bash |
| 35 | +./mvnw spring-javaformat:validate -pl spring-ai-model |
| 36 | +``` |
| 37 | + |
| 38 | +**通过标准**: `BUILD SUCCESS` |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +### **第2步: 运行核心测试** (必须) |
| 43 | + |
| 44 | +```bash |
| 45 | +./mvnw test -Dtest=DefaultToolCallingManagerTests -pl spring-ai-model |
| 46 | +``` |
| 47 | + |
| 48 | +**通过标准**: `Tests run: 18, Failures: 0, Errors: 0` |
| 49 | + |
| 50 | +**期望看到的日志**: |
| 51 | +``` |
| 52 | +DEBUG DefaultToolCallingManager -- Executing tool call: toolA (synchronous mode) |
| 53 | +DEBUG DefaultToolCallingManager -- Executing async tool call: asyncTool |
| 54 | +DEBUG DefaultToolCallingManager -- Tool 'asyncTool' supports async execution, using callAsync() |
| 55 | +``` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### **第3步: 运行所有测试** (推荐) |
| 60 | + |
| 61 | +```bash |
| 62 | +./mvnw test -pl spring-ai-model |
| 63 | +``` |
| 64 | + |
| 65 | +**通过标准**: `BUILD SUCCESS`,无失败测试 |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +### **第4步: 完整构建** (推荐) |
| 70 | + |
| 71 | +```bash |
| 72 | +./mvnw clean install -pl spring-ai-model |
| 73 | +``` |
| 74 | + |
| 75 | +**通过标准**: JAR文件成功创建 |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## 🔍 验证关键日志 |
| 80 | + |
| 81 | +### **同步方法日志检查** |
| 82 | + |
| 83 | +运行测试后,应该看到: |
| 84 | + |
| 85 | +``` |
| 86 | +DEBUG - Executing tool call: toolName (synchronous mode) |
| 87 | +``` |
| 88 | + |
| 89 | +**如果工具支持异步但在用同步方法**: |
| 90 | +``` |
| 91 | +DEBUG - Tool 'toolName' implements AsyncToolCallback but executing in synchronous mode. |
| 92 | + Consider using executeToolCallsAsync() for better performance. |
| 93 | +``` |
| 94 | + |
| 95 | +### **异步方法日志检查** |
| 96 | + |
| 97 | +``` |
| 98 | +DEBUG - Executing async tool call: toolName |
| 99 | +DEBUG - Tool 'toolName' supports async execution, using callAsync() |
| 100 | +``` |
| 101 | + |
| 102 | +或者(同步工具回退): |
| 103 | +``` |
| 104 | +DEBUG - Tool 'toolName' does not support async, using sync fallback on boundedElastic scheduler |
| 105 | +``` |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 🧪 验证特定功能 |
| 110 | + |
| 111 | +### **只验证日志改进** |
| 112 | + |
| 113 | +```bash |
| 114 | +# 运行测试并过滤日志 |
| 115 | +./mvnw test -Dtest=DefaultToolCallingManagerTests -pl spring-ai-model | \ |
| 116 | + grep "synchronous mode\|async tool call" |
| 117 | +``` |
| 118 | + |
| 119 | +**期望输出**: |
| 120 | +``` |
| 121 | +Executing tool call: toolA (synchronous mode) |
| 122 | +Executing tool call: toolB (synchronous mode) |
| 123 | +Executing async tool call: asyncTool |
| 124 | +... |
| 125 | +``` |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +### **验证异步功能** |
| 130 | + |
| 131 | +```bash |
| 132 | +# 运行异步工具测试 |
| 133 | +./mvnw test -Dtest=DefaultToolCallingManagerTests#testAsync* -pl spring-ai-model |
| 134 | +``` |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## ❌ 如果验证失败 |
| 139 | + |
| 140 | +### **格式错误** |
| 141 | + |
| 142 | +```bash |
| 143 | +# 自动修复 |
| 144 | +./mvnw spring-javaformat:apply -pl spring-ai-model |
| 145 | + |
| 146 | +# 重新验证 |
| 147 | +./mvnw spring-javaformat:validate -pl spring-ai-model |
| 148 | +``` |
| 149 | + |
| 150 | +### **测试失败** |
| 151 | + |
| 152 | +```bash |
| 153 | +# 查看详细错误 |
| 154 | +./mvnw test -Dtest=DefaultToolCallingManagerTests -pl spring-ai-model -X |
| 155 | +``` |
| 156 | + |
| 157 | +### **构建失败** |
| 158 | + |
| 159 | +```bash |
| 160 | +# 清理并重建 |
| 161 | +./mvnw clean |
| 162 | +./mvnw install -pl spring-ai-model |
| 163 | +``` |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## ✅ 成功标准 |
| 168 | + |
| 169 | +**全部通过时,你会看到**: |
| 170 | + |
| 171 | +``` |
| 172 | +✅ 代码格式 通过 |
| 173 | +✅ 单元测试 (DefaultToolCallingManagerTests) 通过 |
| 174 | +✅ 模块测试 (spring-ai-model) 通过 |
| 175 | +✅ 模块构建 通过 |
| 176 | +
|
| 177 | +🎉 恭喜!所有验证通过! |
| 178 | +``` |
| 179 | + |
| 180 | +--- |
| 181 | + |
| 182 | +## 📚 详细文档 |
| 183 | + |
| 184 | +- **完整测试指南**: [TESTING_GUIDE.md](TESTING_GUIDE.md) |
| 185 | +- **代码规范检查**: [CODE_STYLE_COMPLIANCE_REPORT.md](CODE_STYLE_COMPLIANCE_REPORT.md) |
| 186 | +- **日志改进说明**: [LOGGING_IMPROVEMENTS.md](LOGGING_IMPROVEMENTS.md) |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## 🎯 最常用命令 |
| 191 | + |
| 192 | +```bash |
| 193 | +# 一键验证所有 |
| 194 | +./verify-changes.sh |
| 195 | + |
| 196 | +# 只验证格式 |
| 197 | +./mvnw spring-javaformat:validate -pl spring-ai-model |
| 198 | + |
| 199 | +# 只跑核心测试 |
| 200 | +./mvnw test -Dtest=DefaultToolCallingManagerTests -pl spring-ai-model |
| 201 | + |
| 202 | +# 完整构建 |
| 203 | +./mvnw clean install -pl spring-ai-model |
| 204 | +``` |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +**最后更新**: 2025-10-29 |
| 209 | +**预计耗时**: 1-2分钟(自动化)| 5-10分钟(手动) |
| 210 | + |
0 commit comments