How gdefias/api_automation_test works
Project Type and Purpose
• This is a full-stack web application designed as an API testing and automation platform.
• The backend is built with Python (Django 2.0.2 and the Django REST framework) and is responsible for managing API endpoints, automation test cases, user authentication (including DingTalk login), and administration.
• The frontend is built with Vue.js (with Element UI) and provides the user interface for logging in, managing projects, viewing reports, and interacting with the API testing functionalities.
• The overall design includes Docker-based deployment (with Dockerfile, docker-compose, and Nginx configurations) for containerization and streamlined deployment, as well as CI/CD using Jenkins.
Main Components Identified
a. Frontend Client:
– Located in the “frontend” directory with all Vue.js-related source code, build configurations (webpack, babel), and static assets.
– Produces a single-page application (SPA) that interacts with the backend’s RESTful APIs.
b. Backend Server:
– Contains two primary Django modules (api_automation_test and api_test) with models, views, serializers, URLs, and business logic.
– Manages API endpoints, authentication, and testing logic.
– Uses Django REST framework and integrates with Swagger UI (accessible via /docs/) for API documentation.
c. Database and Data Persistence:
– MySQL is used as the primary data storage (configuration provided in api_automation_test/settings.py and setup scripts under “mysql”).
d. API Testing and Automation Workflow:
– Multiple modules (inside api_test and common directories) handle test case management, dynamic API testing, generating test reports, and exporting test documentation.
e. Infrastructure & Deployment:
– Docker and docker-compose support containerization.
– Nginx (with its own Dockerfile and configuration) serves as a reverse proxy/load balancer.
– Uwsgi handles the Python/Django application interface (UwsgiScript folder).
– CI/CD integration is supported via Jenkins (Jenkinsfile).
f. External Integrations:
– DingTalk login integration (configured in DingConfig.py).
– SwaggerUI for API documentation.
– Email notifications and file export features.
Relationships and Interactions
• The Frontend (Vue.js SPA) makes HTTP requests to the Backend’s REST APIs.
• The Backend processes requests, interacts with the MySQL database for CRUD operations, test case management, and user data, and returns responses.
• The backend also exposes Swagger documentation and supports mock API responses.
• Docker orchestrates the various deployment containers (backend, frontend, MySQL, Nginx) and ensures that all components communicate properly.
• CI/CD pipelines (Jenkins) are set up to build, test, and deploy the containers.
• Additional services (like DingTalk for login and email services for sending reports) plug into the backend workflow.
Architectural Patterns and Design Principles
• Separation of Concerns: Clear division between frontend (presentation layer) and backend (business logic and data access).
• REST API Design: Backend endpoints based on Django REST framework.
• Microservices-ish separation: Although it is not strictly microservices, the backend structure “api_test” and “api_automation_test” indicate modular design.
• Containerization: Use of Docker for isolating and deploying distinct components (backend, frontend, database, proxy server).
• CI/CD and automation are built into the deployment lifecycle.
Technologies and Frameworks
• Backend: Python 3.6, Django 2.0.2, Django REST framework, Uwsgi.
• Frontend: Vue.js, Element UI, Webpack.
• Database: MySQL.
• Deployment: Docker, docker-compose, Nginx.
• CI/CD: Jenkins.
• Other: SwaggerUI for API documentation, possibly additional libraries for emailing and file generation.