|
@@ -1,15 +1,17 @@
|
|
|
-# ServicePilot 测试脚本目录说明
|
|
|
|
|
|
|
+# ServicePilot 综合测试脚本目录说明
|
|
|
|
|
|
|
|
-本目录按课程作业要求拆分为四类测试脚本:
|
|
|
|
|
|
|
+本目录按课程作业和历史实训提交方式拆分为四类测试单元。每个测试单元均包含测试说明、脚本入口和结果证据,便于分别提交、分别说明测试结果。
|
|
|
|
|
|
|
|
```text
|
|
```text
|
|
|
tests/
|
|
tests/
|
|
|
├─ unit_tests/ # 单元测试脚本
|
|
├─ unit_tests/ # 单元测试脚本
|
|
|
├─ api_tests/ # 接口测试脚本
|
|
├─ api_tests/ # 接口测试脚本
|
|
|
-├─ auto_tests/ # 自动化测试脚本
|
|
|
|
|
|
|
+├─ auto_tests/ # 自动化测试脚本与页面截图
|
|
|
└─ performance_tests/ # Locust 性能测试脚本
|
|
└─ performance_tests/ # Locust 性能测试脚本
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+提交结构说明见:`tests/提交结构说明.md`
|
|
|
|
|
+
|
|
|
## 1. 单元测试
|
|
## 1. 单元测试
|
|
|
|
|
|
|
|
位置:`tests/unit_tests`
|
|
位置:`tests/unit_tests`
|
|
@@ -28,6 +30,13 @@ cd E:\软测\ServicePilot\tests\unit_tests
|
|
|
powershell -ExecutionPolicy Bypass -File .\run_unit_tests.ps1
|
|
powershell -ExecutionPolicy Bypass -File .\run_unit_tests.ps1
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+结果输出:
|
|
|
|
|
+
|
|
|
|
|
+```text
|
|
|
|
|
+tests/unit_tests/reports/unit_test_log.txt
|
|
|
|
|
+tests/unit_tests/reports/unit_test_summary.txt
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
## 2. 接口测试
|
|
## 2. 接口测试
|
|
|
|
|
|
|
|
位置:`tests/api_tests`
|
|
位置:`tests/api_tests`
|
|
@@ -46,6 +55,13 @@ cd E:\软测\ServicePilot\tests\api_tests
|
|
|
powershell -ExecutionPolicy Bypass -File .\run_api_tests.ps1
|
|
powershell -ExecutionPolicy Bypass -File .\run_api_tests.ps1
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+结果输出:
|
|
|
|
|
+
|
|
|
|
|
+```text
|
|
|
|
|
+tests/api_tests/reports/api_test_log.txt
|
|
|
|
|
+tests/api_tests/reports/api_test_summary.txt
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
## 3. 自动化测试
|
|
## 3. 自动化测试
|
|
|
|
|
|
|
|
位置:`tests/auto_tests`
|
|
位置:`tests/auto_tests`
|
|
@@ -75,6 +91,15 @@ cd E:\软测\ServicePilot\tests\auto_tests
|
|
|
powershell -ExecutionPolicy Bypass -File .\run_auto_tests.ps1
|
|
powershell -ExecutionPolicy Bypass -File .\run_auto_tests.ps1
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+结果输出:
|
|
|
|
|
+
|
|
|
|
|
+```text
|
|
|
|
|
+tests/auto_tests/reports/auto_test_log.txt
|
|
|
|
|
+tests/auto_tests/reports/auto_test_summary.txt
|
|
|
|
|
+tests/auto_tests/artifacts/*.png
|
|
|
|
|
+tests/auto_tests/artifacts/auto-test-result.json
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
## 4. 性能测试
|
|
## 4. 性能测试
|
|
|
|
|
|
|
|
位置:`tests/performance_tests`
|
|
位置:`tests/performance_tests`
|
|
@@ -89,7 +114,8 @@ powershell -ExecutionPolicy Bypass -File .\run_auto_tests.ps1
|
|
|
需要安装 Locust:
|
|
需要安装 Locust:
|
|
|
|
|
|
|
|
```powershell
|
|
```powershell
|
|
|
-pip install locust
|
|
|
|
|
|
|
+cd E:\软测\ServicePilot\tests\performance_tests
|
|
|
|
|
+pip install -r requirements.txt
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
运行后端接口性能测试:
|
|
运行后端接口性能测试:
|
|
@@ -106,3 +132,13 @@ cd E:\软测\ServicePilot\tests\performance_tests
|
|
|
powershell -ExecutionPolicy Bypass -File .\run_frontend_performance.ps1
|
|
powershell -ExecutionPolicy Bypass -File .\run_frontend_performance.ps1
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+结果输出:
|
|
|
|
|
+
|
|
|
|
|
+```text
|
|
|
|
|
+tests/performance_tests/reports/backend-performance-report.html
|
|
|
|
|
+tests/performance_tests/reports/backend-performance_*.csv
|
|
|
|
|
+tests/performance_tests/reports/frontend-performance-report.html
|
|
|
|
|
+tests/performance_tests/reports/frontend-performance_*.csv
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+当前环境如未安装 Locust,脚本会生成 `reports/*_performance_pending.txt`,不伪造性能结果。
|