How baizunxian/zerorunner works
Project Type and Purpose
• This is a full-stack automated testing platform with a clear separation between a Python-based backend and a modern Vue3 frontend.
• The backend (built on Python with FastAPI, celery, SQLAlchemy, and Redis) primarily handles API, UI, and system test tasks with asynchronous job scheduling. It also appears to include modules for test runner execution (the “zerorunner” subfolder) and extensive support for API/UITest case management.
• The frontend (built using Vite, Vue3, and Element Plus) provides the user interface for interacting with test cases, reports, system configurations, and real-time updates (via WebSocket integration).
File Structure
• Backend:
• The directory structure under “backend” is organized into multiple layers:
∗ “autotest” – Contains APIs, jobs, models, schemas, services, and utilities that show a layered (often MVC-like) approach.
∗ “celery_worker” – Manages asynchronous and scheduled tasks using celery with separate modules for schedulers and tasks.
∗ “zerorunner” – Likely encapsulates core logic for test-case parsing, running, reporting, and result formatting.
∗ Other configuration and initialization files (.env files, config.py) to support environment management.
• Notice the clear separation between modules handling API testing, UI testing, system management (like user roles, menus, notifications) and job management.
• Frontend:
• The “frontend” directory reveals a structured Vue3 project, with separate folders for API abstractions, components (for test reporting, case editing, dashboards), layouts, routing, and state management.
• Clear delineation for components that build interactivity (e.g., Z-Report, Z-Step, etc.) and integrations with backend API endpoints.
• Additionally, various Docker and configuration files and multiple docker-compose files indicate that the project is containerized and supports deployment of the backend, frontend, MySQL, Redis, and Selenium services.
Examining the README
• The README clarifies the stack versions (FastAPI, Celery, Vue3, etc.) and provides instructions to launch both backend and frontend.
• It emphasizes the platform’s purpose as an “Automated Testing Platform” and shows example screenshots (like reporting pages) that reinforce the idea of a test orchestration and reporting tool.
a. Main Components:
• Frontend Client (Browser): Vue3 application built with Vite and Element Plus.
• Backend API Server: FastAPI server handling REST endpoints for API and UI test interactions.
• Asynchronous Task Processor: Celery Worker managing background jobs, scheduled tasks, and test case executions.
• Database Layer: MySQL for persistent storage (test cases, configurations, reports) and Redis for in-memory caching and message brokering.
• WebSocket Service: Modules within the backend (see “websocket” directories) handling real-time communication between the server and the frontend.
• Auxiliary Components: Components aiding test processing such as modules for parsing, executing test steps (“zerorunner” modules), and reporting.
b. Relationships and Interactions:
• The Frontend communicates with the Backend via RESTful APIs (and possibly WebSocket for real-time updates).
• The Backend processes incoming requests through various endpoints (grouped by API testing, UI testing, system management, etc.) and manages data in the MySQL database.
• For heavy or scheduled operations, the Backend delegates tasks to Celery Workers which then use Redis as a message broker (and might also interact with MySQL for storing results).
• The “zerorunner” slice of the backend forms the core test execution engine, processing test definitions, parsing test suites, and generating test reports.
• Deployment components (Docker configurations) indicate containerized deployment where each service/component interacts over defined network channels.
c. Architectural Patterns / Design Principles:
• Modular Organization: A layered (perhaps MVC-like) design separating business logic (services, schemas, models) from API controllers.
• Asynchronous Processing: Utilizes Celery for offloading time-consuming tasks and scheduled jobs.
• Clear Separation of Concerns: Frontend is isolated from backend logic, and configuration/environment details are externalized.
• Componentization in Frontend: Reusable Vue components with dedicated folders for views, layouts, and state management.
d. Technologies, Frameworks, and Libraries:
• Backend: Python3, FastAPI, Celery, SQLAlchemy, MySQL, Redis.
• Frontend: Vue3, Vite, Element Plus, plus additional libraries for state management and UI components.
• Containerization/Docker: Multiple docker-compose files to isolate and integrate development, testing, and production environments.
• WebSockets and real-time communication support for front-to-back updates.
Instructing the Principal Software Engineer
• Use clear and distinct labels for each component (e.g., “Vue3 Frontend”, “FastAPI Server”, “Celery Worker”, “MySQL Database”, “Redis Broker”).
• User interface components (front-end)
• Business logic (backend APIs and service layers)
• Asynchronous processing (celery-related modules)
• Data persistence layers (database and cache)