65 lines
1.8 KiB
Batchfile
65 lines
1.8 KiB
Batchfile
@echo off
|
||
chcp 65001 >nul
|
||
set PYTHONIOENCODING=utf-8
|
||
echo.
|
||
echo ===============================================
|
||
echo Socket JSON 传输系统 - Windows 测试工具
|
||
echo ===============================================
|
||
echo.
|
||
|
||
REM 检查 Python 是否安装
|
||
python --version >nul 2>&1
|
||
if errorlevel 1 (
|
||
echo ❌ 错误: 未找到 Python,请先安装 Python
|
||
echo 下载地址: https://www.python.org/downloads/
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo ✅ Python 已安装
|
||
python --version
|
||
echo.
|
||
|
||
REM 检查必需文件
|
||
echo 📋 检查必需文件...
|
||
set "missing_files="
|
||
if not exist server.py set "missing_files=%missing_files% server.py"
|
||
if not exist client.py set "missing_files=%missing_files% client.py"
|
||
if not exist test_data.json set "missing_files=%missing_files% test_data.json"
|
||
if not exist test_socket.py set "missing_files=%missing_files% test_socket.py"
|
||
|
||
if not "%missing_files%"=="" (
|
||
echo ❌ 缺少文件:%missing_files%
|
||
echo 请确保所有文件都在当前目录中
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo ✅ 所有必需文件都存在
|
||
echo.
|
||
|
||
REM 运行测试
|
||
echo 🚀 开始运行自动测试...
|
||
echo.
|
||
python test_socket.py
|
||
|
||
echo.
|
||
echo ===============================================
|
||
echo 测试完成!查看上方输出了解测试结果
|
||
echo ===============================================
|
||
echo.
|
||
|
||
REM 显示生成的文件
|
||
echo 📁 生成的文件:
|
||
if exist client_test.json echo - client_test.json (客户端测试数据)
|
||
if exist test_report.json echo - test_report.json (详细测试报告)
|
||
if exist received_data.json echo - received_data.json (服务器接收的数据)
|
||
echo.
|
||
|
||
echo 💡 提示:
|
||
echo 1. 如果需要手动测试,运行: python server.py
|
||
echo 2. 然后在另一个窗口运行: python client.py
|
||
echo 3. 查看详细测试报告: notepad test_report.json
|
||
echo.
|
||
|
||
pause |