Build an AI-powered automated testing platform for internal company use, leveraging DeepSeek LLM and LangChain framework to achieve intelligent test case generation, automated script creation, and test execution management. The platform focuses on API testing (Pytest+Requests) and UI testing (Playwright) with Docker-based isolation and authorization control.
LayerTechnologyVersionPurposeFrontendVue3^3.3.0Reactive UI frameworkFrontend UIElement Plus^2.4.0UI component libraryState ManagementPinia^2.1.0Global state managementBackendFastAPI^0.104.0Async web frameworkAI FrameworkLangChain^0.1.0LLM orchestrationLLMDeepSeekAPICore AI capabilitiesAPI TestingPytest^7.4.0Test frameworkAPI Reportingpytest-json-report^1.5.0JSON report generationUI TestingPlaywright^1.40.0Browser automationDatabaseMySQL8.0Relational databaseVector DBChroma^0.4.0Vector retrievalDeploymentDockerLatestContainerization
text
【Frontend Layer】Vue3 + Element Plus + Pinia
↓ (Polling for progress)
【API Layer】FastAPI + Auth Interceptor
↓
【Business Layer】Auth Management, Test Design, Execution, Reporting
↓
【AI Layer】LangChain + DeepSeek + RAG (Chroma)
↓
【Test Engine Layer】Pytest (API) + Playwright (UI)
↓
【Data Layer】MySQL (Business) + Chroma (Vectors)
Permission Types:
all - Full functionalitygenerate - Case/script generation onlyexecute - Script execution onlyEncryption:
"yanghua" + timestamp + "360sb"Authorization Flow:
text
Request with auth_code → AuthInterceptor → Verify validity/expire/count/permission
→ Pass: Allow access + increment usage count
→ Fail: Return 401/403
AuthCodeService: CRUD, validation, count updatesAuthService: Global request interceptorSupported Document Formats:
Core Chains:
TestCaseChain: Generate test cases from documentsApiScriptChain: Generate Pytest+Requests scriptsUiScriptChain: Generate Playwright scriptsAI Configuration:
Integration:
pytest.main()pytest-json-reportEnvironment:
requirements.txtScript Features:
Playwright Configuration:
Capabilities:
Features:
Auto-generation:
AI Analysis Prompt:
text
Analyze the following test execution log and identify the failure reason:
{execution_log}
Provide:
1. Main failure cause
2. Possible problem location
3. Suggested solution
Keep it concise and highlight key information.
Configuration Management:
Features:
See references/architecture.md for complete SQL definitions.
json
{
"code": 200,
"msg": "success",
"data": {}
}
auth_code (required) - Authorization code for all core endpointsAuthorization:
POST /admin/add_auth - Create authorization codePOST /auth/verify - Verify authorizationGET /auth/list - List authorization codesAI Generation:
POST /generate/case - Generate test casesPOST /generate/api - Generate API scriptsPOST /generate/ui - Generate UI scriptsGET /progress/{task_id} - Get task progressAutomation Management:
POST /script/save - Save scriptGET /script/list - List scriptsGET /script/{id} - Get script detailsTest Execution:
POST /execute/run - Run test scriptGET /execute/record - Get execution recordsReport Management:
GET /report/generate - Generate reportGET /report/export - Export reportSystem Configuration:
GET /system/config - Get system configPOST /system/config - Update system configImplementation:
Polling Endpoint:
bash
GET /api/progress/{task_id}
# Response
{
"status": "processing|completed|failed",
"progress": 50,
"message": "Generating test cases..."
}
yaml
version: '3.8'
services:
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: ai_test_platform
volumes:
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
app:
build: .
ports:
- "8000:8000"
depends_on:
- mysql
volumes:
- ./data:/app/data
environment:
- DATABASE_URL=mysql+pymysql://root:root123@mysql:3306/ai_test_platform
- DEEPSEEK_API_KEY=your_api_key
volumes:
mysql_data:
./data/scripts/./data/reports/./data/screenshots/./data/chroma/Use this skill when:
text
ai-test-platform/
├── backend/
│ ├── app/
│ │ ├── api/ # API endpoints
│ │ ├── core/ # Core security and config
│ │ ├── models/ # Database models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ │ ├── auth.py # Authorization service
│ │ │ ├── ai.py # AI generation service
│ │ │ ├── execute.py # Execution service
│ │ │ └── report.py # Report service
│ │ └── main.py # FastAPI app
│ ├── tests/ # Test files
│ ├── Dockerfile
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── components/ # Vue components
│ │ ├── pages/ # Page components
│ │ ├── stores/ # Pinia stores
│ │ ├── api/ # API calls
│ │ └── main.js # Entry point
│ └── package.json
├── data/ # Persistent data
│ ├── scripts/
│ ├── reports/
│ ├── screenshots/
│ └── chroma/
├── docs/ # Documentation
├── scripts/ # Utility scripts
│ ├── generate_auth.py # Auth code generator
│ ├── init_db.py # Database initializer
│ └── setup.sh # Setup script
├── docker-compose.yml
└── README.md
bash
# Clone and setup
git clone <repo>
cd ai-test-platform
# Backend setup
cd backend
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
# Frontend setup
cd ../frontend
npm install
bash
python scripts/init_db.py
bash
python scripts/generate_auth.py
bash
# Backend
cd backend
uvicorn app.main:app --reload
# Frontend
cd frontend
npm run dev
bash
docker-compose up -d
references/architecture.md - Complete system architecture and database designreferences/AI 自动化测试平台 需求规格说明书.docx - Original requirementsreferences/AI 自动化测试平台 系统设计说明书.docx - Original system designreferences/architecture.md