@echo off chcp 65001 >nul echo ======================================== echo 智能图书管理系统 - 本地测试执行 echo ======================================== echo. echo 🔧 准备测试环境... echo ---------------------------------------- REM 检查Maven是否安装 where mvn >nul 2>&1 if %errorlevel% neq 0 ( echo ❌ 错误: 未找到Maven,请先安装Maven echo. pause exit /b 1 ) echo ✅ Maven已安装 echo. echo 🧹 清理旧的测试结果... if exist target\surefire-reports ( rmdir /s /q target\surefire-reports echo ✅ 已清理旧的测试报告 ) else ( echo ℹ️ 无需清理 ) echo. echo 🔨 编译测试代码... echo ---------------------------------------- call mvn clean test-compile if %errorlevel% neq 0 ( echo. echo ❌ 测试编译失败! echo. pause exit /b 1 ) echo. echo ✅ 测试编译成功 echo. echo 🧪 执行测试... echo ---------------------------------------- call mvn test set TEST_RESULT=%errorlevel% echo. if %TEST_RESULT% equ 0 ( echo ✅ 所有测试通过! ) else ( echo ⚠️ 部分测试失败,请查看详细报告 ) echo. echo 📊 生成测试报告... echo ---------------------------------------- call mvn surefire-report:report-only echo. echo 📋 测试结果总结: echo ---------------------------------------- echo. REM 统计测试结果 for /f "tokens=*" %%a in ('findstr /C:"Tests run:" target\surefire-reports\*.txt 2^>nul ^| find /C "Tests run:"') do set TEST_COUNT=%%a if defined TEST_COUNT ( echo ✅ 测试报告已生成 echo. echo 📁 查看测试结果: echo 1. 详细报告: LOCAL_TEST_REPORT.md echo 2. XML报告: target\surefire-reports\*.xml echo 3. 文本报告: target\surefire-reports\*.txt echo. echo 💡 提示: 运行 view_test_results.bat 查看测试总结 ) else ( echo ⚠️ 测试报告生成可能不完整 ) echo. echo ======================================== echo 测试执行完成! echo ======================================== echo. pause