compliance/README.md
2025-08-07 15:23:25 +08:00

141 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DMS合规性测试工具
一个用于API合规性测试的Docker化工具支持OpenAPI规范验证、PDF报告生成和测试历史管理。
## 🚀 快速开始
### 使用Docker推荐
```bash
# 1. 构建并启动服务
./docker-build.sh
# 2. 访问服务
# API服务器: http://localhost:5050
# 历史查看器: http://localhost:5051
```
### 本地运行
```bash
# 1. 安装依赖
pip install -r requirements.txt
# 2. 启动API服务器
python api_server.py
# 3. 启动历史查看器(另一个终端)
python history_viewer.py
```
## 📋 主要功能
- **API合规性测试**基于OpenAPI规范的自动化测试
- **PDF报告生成**:生成详细的测试分析报告
- **测试历史管理**:查看和管理历史测试记录
- **严格等级控制**:根据严格等级分离必须和非必须测试用例
- **多服务架构**API服务和历史查看器独立运行
## 🔧 使用方法
### 命令行测试
```bash
# 基本使用
python run_api_tests.py \
--base-url http://your-api-server \
--openapi-file api-spec.yaml \
--strictness-level HIGH \
--generate-pdf
# DMS服务测试忽略SSL证书
python run_api_tests.py \
--dms ./assets/doc/dms/domain.json \
--base-url https://www.dev.ideas.cnpc \
--ignore-ssl \
--strictness-level CRITICAL
```
### Web界面测试
1. 访问 http://localhost:5050
2. 上传OpenAPI规范文件
3. 配置测试参数
4. 执行测试并下载报告
### 查看测试历史
访问 http://localhost:5051 查看历史测试记录和报告
## 📁 项目结构
```
compliance/
├── api_server.py # API服务器
├── history_viewer.py # 历史查看器
├── run_api_tests.py # 命令行测试工具
├── docker-build.sh # Docker构建脚本
├── docker-compose.yml # Docker Compose配置
├── requirements.txt # Python依赖
├── docker/ # Docker相关文件
├── tests/ # 测试脚本
├── docs/ # 详细文档
├── nginx/ # Nginx配置可选
├── test_reports/ # 测试报告目录
└── memory-bank/ # 项目文档和上下文
```
## 🐳 Docker部署
```bash
# 快速部署
./docker-build.sh
# 或使用Docker Compose
docker-compose up -d
```
## 🧪 测试
```bash
# 测试Docker部署
./tests/test-docker.sh
# 测试多服务功能
python tests/test_multi_service.py
```
## 📖 详细文档
查看 `docs/` 目录获取详细的部署和使用指南。
## 🛠️ 故障排除
### SSL证书问题
如果遇到SSL证书验证失败
```bash
# 使用--ignore-ssl参数开发/测试环境)
python run_api_tests.py --dms ./assets/doc/dms/domain.json --ignore-ssl
# 测试SSL配置
python test_ssl_ignore.py
```
详细说明请查看:[SSL证书处理指南](docs/SSL_Certificate_Handling.md)
### 其他问题
```bash
# 查看容器状态
docker ps
# 查看日志
docker logs dms-compliance-tool
```
## 🤝 开发
cursor-memory-bank在memory-bank目录下对话前先传给cursor或其他AI。