You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
@ 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