Automatic test management method and system based on Django and Vue

The automated test management system built with Django and Vue solves the problems of fragmentation and execution scheduling limitations in software testing frameworks, achieving efficient test management and report generation, reducing maintenance costs and improving execution efficiency.

CN121560737APending Publication Date: 2026-02-24TENTH RES INST OF TELECOMM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511627641.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-07
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Existing software automation testing frameworks are fragmented and lack a unified management platform, resulting in high test case maintenance costs, execution scheduling is limited to basic timing, and there is a lack of multi-dimensional data insight functions.

Method used

An automated test management system is built using Django and Vue. A three-level data model (Project-Script-TestCase) is constructed using Django ORM. RESTful APIs and asynchronous task management are implemented using DRF and Celery. The front end uses Vue.js and Element UI to implement a visual interactive interface, supporting project management, script uploading, test case execution, and report generation.

Benefits of technology

It achieves modular storage and association of scripts and test cases, reduces maintenance complexity, improves testing efficiency by 30%, increases execution efficiency by 30%, reduces report generation time to within 1 minute, and improves defect location efficiency by 80%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121560737A_ABST
    Figure CN121560737A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic test management method and system based on Django and Vue. The method comprises the following steps: constructing a Web service and an API (Application Program Interface); dependent installation and environment configuration; implementing a front-end interaction interface; project and script management; performing use case execution and log recording; and generating a test report. According to the embodiment, a three-level data model (Project-Script-TestCase) is constructed through Django ORM, and modular storage and association of scripts and cases are realized, so that logic isolation and quick retrieval are realized, a user can manage the scripts according to project dimensions, batch operation and condition query are supported, and the maintenance complexity is remarkably reduced; the execution result is automatically converted into the test report, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software testing technology, and in particular to an automated test management method based on Django and Vue. Background Technology

[0002] Currently, software automation testing mainly involves developing test scripts for testing tools, running test scripts, and maintaining scripts after updates to the software being tested. There is no unified framework, leading to redundant development and increasing maintenance difficulties as the script codebase grows.

[0003] Django is an open-source web development framework written in Python. It encourages rapid development and follows the MVC design. It emphasizes code reuse, and multiple components can be easily used as plugins to serve the entire framework. Data models are defined using Python classes, and ORM connects these models to relational databases, resulting in a very easy-to-use database API. Raw SQL statements can also be used within Django. Pytest is a mature, full-featured Python testing framework that provides a simple and easy-to-use API and a rich plugin ecosystem. It is widely used for functional testing, integration testing, and more. Pytest automatically recognizes and runs functions starting with `test_` as test cases. It provides rich assertion failure outputs, supports parameterized testing, and allows the same test function to be run multiple times with different parameters. Selenium is a powerful automated testing tool that can simulate real user behavior for web application testing. Combining different components and languages ​​can implement complex test scenarios and automated testing processes.

[0004] The related technologies have the following technical problems: (1) Framework fragmentation: The mainstream solution adopts a decentralized approach to develop test scripts, run test scripts, and maintain scripts after the version of the software under test is updated. The lack of a unified management platform leads to high maintenance costs for test cases.

[0005] (2) Execution scheduling limitations: Existing tools (such as TestNG and Katalon) only support basic scheduled execution and cannot achieve dynamic combination execution of cross-project test case sets.

[0006] (3) Insufficient visualization analysis: Most systems only provide basic text reports (such as Allure) and lack multi-dimensional data perspective functions.

[0007] Therefore, it is necessary to improve one or more of the problems existing in the above-mentioned related technical solutions.

[0008] It should be noted that this section is intended to provide background or context for the technical solutions of this disclosure as set forth in the claims. The description herein does not constitute an admission that it is prior art simply because it is included in this section. Summary of the Invention

[0009] The purpose of this invention is to provide an automated test management method and system based on Django and Vue, thereby overcoming, to at least some extent, one or more problems caused by the limitations and defects of related technologies.

[0010] This invention first provides an automated test management method based on Django and Vue, including: S1, Web Service and API Construction: Build web services using the Django framework, construct RESTful API interfaces using DRF, create a three-level model of Project, Script and TestCase through Django ORM, and integrate pytest and Selenium to form a test framework; S2, Dependency Installation and Environment Configuration: Install Django, pytest, and Selenium into Python, create a main project using Django, enter the project directory and create and register sub-applications using Python, then start the server using Python to complete the web application creation; S3, Front-end Interactive Interface Implementation: Based on Vue.js and Element UI, the front-end interface is built, and the project configuration form, script upload component, script / log list display component, and time picker component are developed. S4, Project and Script Management: Submit project information via front-end forms and call back-end APIs to complete project creation and environment variable configuration; Submit Selenium scripts via front-end upload components, and store script files and metadata on the back-end, supporting script queries by name, creator, and time range; S5, Test Case Execution and Logging: Select the target test case set to trigger immediate execution or configure scheduled execution; S6, Test Report Generation: After execution, an HTML format test report is automatically generated.

[0011] In this invention, the method further includes: S7, Send Email Notification: Executes an email sending task asynchronously via Celery, sending a report link and a summary of the execution results to a specified email address.

[0012] In this invention, in S5, when executing immediately, the front end calls the / api / run-testcase interface, and the back end starts an asynchronous task through Celery to execute the Selenium script; when executing on a schedule, execution is triggered by configuring crontab or interval rules through Celerybeat.

[0013] In this invention, in step S7, emails are sent based on the SMTP protocol.

[0014] In this invention, during execution, the execution status, start / end time, and detailed logs are stored in the ExecutionLog model.

[0015] In this invention, the test report includes: execution overview, classification analysis, and ECharts graphical results.

[0016] The present invention further provides an automated test management system based on Django and Vue, comprising: Backend service layer: The web service is built based on the Django framework, integrating DRF to build RESTful API interfaces, and also integrating the pytest testing framework and Selenium automated testing tool; the backend service layer uses Django ORM to build a three-level data model, namely the Project model storing project information, the Script model storing script metadata, and the TestCase model storing test case set information; and the backend service layer is configured with Celery distributed task queue to handle asynchronous execution of test cases and scheduled tasks; Front-end interaction layer: Based on the Vue.js framework and combined with the Element UI component library, a visual interactive interface is implemented, providing interactive entry points for project configuration, script upload and management, test case execution, log query and report viewing; Functional modules: The functional modules include a project management module, a script management module, a test case execution module, and a reporting and notification module.

[0017] In this invention, the backend service layer and the frontend interaction layer are in a separate architecture.

[0018] In this invention, the query parameters supported by the API in the backend service layer include: name, creator, and time range.

[0019] The technical solution provided by this invention may include the following beneficial effects: This invention discloses an automated test management method and system based on Django and Vue. It constructs a three-level data model (Project-Script-TestCase) through DjangoORM to realize the modular storage and association of scripts and test cases, thereby achieving logical isolation and fast retrieval. Users can manage scripts by project dimension, support batch operations and conditional queries, and significantly reduce maintenance complexity. The execution results are automatically converted into test reports to improve testing efficiency. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0021] Figure 1 A flowchart illustrating an automated test management method based on Django and Vue in an exemplary embodiment of this disclosure is shown. Figure 2 This diagram illustrates the architecture of an automated test management system based on Django and Vue, as shown in an exemplary embodiment of this disclosure. Figure 3 This diagram illustrates a test script management flowchart in an exemplary embodiment of this disclosure. Figure 4 This diagram illustrates the test script uploading process in an exemplary embodiment of this disclosure. Figure 5 This diagram illustrates the test script scheduling and execution flowchart in an exemplary embodiment of this disclosure. Figure 6 This diagram illustrates the execution flowchart of a scheduled task in an exemplary embodiment of this disclosure. Figure 7 This diagram illustrates a test report management flowchart in an exemplary embodiment of this disclosure. Figure 8 This diagram illustrates the process of sending test report emails in an exemplary embodiment of this disclosure. Detailed Implementation

[0022] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0023] Furthermore, the accompanying drawings are merely illustrative diagrams of embodiments of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.

[0024] This example implementation first provides an automated test management method based on Django and Vue. Please refer to [link / reference]. Figure 1 This method may include: S1-S6, as follows: S1, Web Service and API Construction: Build web services using the Django framework, construct RESTful API interfaces using DRF, create a three-level model of Project, Script and TestCase through Django ORM, and integrate pytest and Selenium to form a test framework; S2, Dependency Installation and Environment Configuration: Install Django, pytest, and Selenium into Python, create a main project using Django, enter the project directory and create and register sub-applications using Python, then start the server using Python to complete the web application creation; S3, Front-end Interactive Interface Implementation: Based on Vue.js and Element UI, the front-end interface is built, and the project configuration form, script upload component, script / log list display component, and time picker component are developed. S4, Project and Script Management: Submit project information via front-end forms and call back-end APIs to complete project creation and environment variable configuration; Submit Selenium scripts via front-end upload components, and store script files and metadata on the back-end, supporting script queries by name, creator, and time range; S5, Test Case Execution and Logging: Select the target test case set to trigger immediate execution or configure scheduled execution; S6, Test Report Generation: After execution, an HTML format test report is automatically generated.

[0025] In this embodiment, a three-level data model (Project-Script-TestCase) is built using Django ORM to achieve modular storage and association of scripts and test cases, thereby enabling logical isolation and fast retrieval. Users can manage scripts by project dimension, support batch operations and conditional queries, and significantly reduce maintenance complexity. The execution results are automatically converted into test reports to improve testing efficiency.

[0026] The specific process of each step in the above embodiments will be described below.

[0027] This invention adopts a front-end and back-end separation architecture. The back-end is built on the Django framework (a Python web development framework) to build web services and integrates DRF (Django REST framework) to construct RESTful API interfaces. The front-end uses the Vue.js framework and combines it with the Element UI component library (Element UI is a UI component library based on Vue) to implement a visual interactive interface.

[0028] S1, Web Services and API Construction. The Django framework is used to build web services and handle HTTP requests and business logic. DRF (Django REST framework): provides serializer and view components to build RESTful API interfaces.

[0029] In the Django ORM three-level data model, the Project model is used to store project information (name, description, environment variables); the Script model is used to store script metadata (name, creator, creation time, script file path); and the TestCase model stores test case information (script association, execution parameters).

[0030] Test framework integration: (1) pytest: Calls Selenium scripts through custom plugins, supporting assertions and exception handling.

[0031] (2) Selenium: Simulates browser operations and executes test cases.

[0032] S2, Dependency Installation and Environment Configuration. Python Environment: Ensure Django, pytest, and Selenium are installed in the lib folder of the Python root directory. This can be done by executing the Python setup.py install script.

[0033] Create a web application using commands: Create the main project using Django: django-admin startproject app_name; Navigate to the project directory: cd automation_platform; Run the manage.py script in Python to create a sub-application named test_manager: pythonmanage.py startapp test_manager.

[0034] Start the server with Python and create the web application.

[0035] S3, front-end interaction; Vue.js: adopts component-based development to achieve dynamic data binding; Element UI: uses el-table to display the script list.

[0036] The backend implementation creates a Project model with fields including: name (project name), description, and env_vars (environment variables). It then uses DRF's ModelViewSet to generate CRUD (Create, Read, Update, Delete) APIs.

[0037] This embodiment provides the functionality to issue project management requests and display the response results. It also provides functions for adding projects, modifying project information, deleting projects, and querying projects based on conditions at the bottom of the page. The page list displays the results of these operations.

[0038] S4, Project Management and Script Management Figure 3 ).

[0039] Please refer to Figure 4 Script upload: The front-end uploads .py files via the el-upload component, and the back-end stores the files in the media / scripts / directory and saves the metadata to the Script model.

[0040] Conditional query: The backend API supports query parameters such as name, created_by, and created_time, and returns paginated results.

[0041] List display: The front-end uses el-table to display the script list, supporting click operations (edit, delete).

[0042] This embodiment provides the functionality to issue script management requests and display the response results. It also provides functions for uploading scripts, modifying script management information, deleting scripts, and querying scripts based on conditions on the page. The page list displays the results of these operations.

[0043] S5, please refer to Figure 5 Test case execution and logging: Select the target test case set to trigger immediate execution or configure scheduled execution. Test cases can be executed according to priority.

[0044] Execute immediately: After the user selects a test case set, the front end calls the / api / run-testcase interface, the back end starts an asynchronous task (using Celery), executes the Selenium script and returns the status (success / failure).

[0045] Please refer to Figure 6 Scheduled execution: Use Celery Beat to configure scheduled tasks. After the user sets the execution time, the system triggers the script to execute via crontab or interval.

[0046] Log model: Create an ExecutionLog model with fields including: test_case_id (test case set ID), status (status), start_time (start time), end_time (end time), and details (detailed log).

[0047] Query function: Supports filtering logs by keywords (such as "failure") and time range, with the front end using el-date-picker to select the time.

[0048] This embodiment provides functions for issuing execution test case set requests and obtaining execution result status prompts, allowing users to select and execute test case sets. It also provides a function to create scheduled tasks to execute test case sets, executing the selected test cases at a specified time. The execution process is recorded in the execution log. Upon completion, the execution status is displayed to the user. Successfully executed test case sets generate test reports, while failed test case sets terminate the execution process and display the reason for the failure.

[0049] S6, please refer to Figure 7 Test report generated.

[0050] The report structure includes: (1) Execution overview: total number of test cases, pass rate, execution time.

[0051] (2) Classification analysis: Statistical analysis of pass / fail test cases by module or function.

[0052] (3) Graphical results: Use ECharts to generate bar charts and pie charts to display the data.

[0053] Report storage: Generates HTML format reports and saves them to the media / reports / directory. Supports front-end downloading, allows local report download, and enables sending reports to a specified email address.

[0054] S7, please refer to Figure 8 Send an email notification.

[0055] SMTP protocol implementation: Configure mail server parameters (SMTP address, port, username, password). Send emails using django.core.mail, including a report link and a summary of the execution results.

[0056] Asynchronous sending: Email sending tasks are processed asynchronously through Celery, avoiding blocking the main thread.

[0057] This example implementation also provides an automated test management system based on Django and Vue. Please refer to [link / reference]. Figure 2 The system includes: Backend service layer: The web service is built based on the Django framework, integrating DRF to build RESTful API interfaces, and also integrating the pytest testing framework and Selenium automated testing tool; the backend service layer uses Django ORM to build a three-level data model, namely the Project model storing project information, the Script model storing script metadata, and the TestCase model storing test case set information; and the backend service layer is configured with Celery distributed task queue to handle asynchronous execution of test cases and scheduled tasks; Front-end interaction layer: Based on the Vue.js framework and combined with the Element UI component library, a visual interactive interface is implemented, providing interactive entry points for project configuration, script upload and management, test case execution, log query and report viewing; Functional modules: The functional modules include a project management module, a script management module, a test case execution module, and a reporting and notification module.

[0058] Project management module: Supports project creation / configuration and environment variable management; Script management module: Supports uploading, adding, deleting, modifying, querying, and conditionally querying Selenium scripts; Test case execution module: Supports immediate and scheduled execution of script sets, and records execution logs; Reports and Notifications Module: Generates test reports and supports email sending.

[0059] Regarding the system in the above embodiments, the specific ways in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.

[0060] The system process is described below.

[0061] (1) User operation process: Users can upload scripts, configure projects, and select test case sets through the front-end interface.

[0062] Click the "Execute Now" or "Execute on Schedule" button to trigger the backend task.

[0063] (2) System processing flow: The backend receives the request and calls Selenium to execute the script. The automated scripts can be scheduled according to priority, and subsequent test scripts can use the results of previous tests. The execution results are written to the log and a test report is generated; Once the report is completed, an email sending task will be triggered.

[0064] (3) Key component interactions: Frontend: Vue + Element UI → Backend: Django + DRF → Testing framework: pytest + Selenium → Database: MySQL.

[0065] In summary, the beneficial effects of this invention are mainly reflected in the following three aspects: 1. Highly flexible test management capabilities Technical approach: A three-tiered data model (Project-Script-TestCase) is constructed using Django ORM to achieve modular storage and association of scripts and test cases. Existing technologies typically employ a flat database table structure, leading to a chaotic relationship between scripts and test cases. This invention, however, achieves logical isolation and rapid retrieval through a hierarchical model.

[0066] Advantages: Users can manage scripts by project dimension, support batch operations and conditional queries, and significantly reduce maintenance complexity.

[0067] 2. Multi-mode test case scheduling and execution Technical approach: Integrating Celery asynchronous task queues and the DRF API interface to achieve scheduled, batch, and repetitive scheduling modes. This invention embeds the scheduling logic within a web service, reducing system dependencies. Existing technologies rely on third-party scheduling tools (such as Jenkins), requiring additional server and script triggering logic configuration. This invention, however, reduces system coupling by directly calling the built-in task queue and API. Users do not need to install external tools; they can configure scheduling rules directly through the web interface, improving execution efficiency by over 30%.

[0068] Furthermore, the data transfer between test scripts in this application is a technological breakthrough, employing variable transfer technology: the "extract variable" function saves fields from the execution result as variables, supporting cross-script reuse.

[0069] The dynamic binding architecture of scripts and test cases enables dynamic association between test scripts and test cases through parameterized test case templates, and supports automatic synchronization of test case versions with script updates.

[0070] Furthermore, a multi-dimensional priority evaluation model can be constructed by combining code coverage, historical defect density, and business impact to dynamically adjust test case priorities and prioritize coverage of high-risk modules. The above embodiments are based on what is feasible with the technology in this field.

[0071] 3. Automated report generation and log analysis Technical approach: Employing an HTML template engine and the ECharts chart library, the execution results are dynamically rendered into a visual report. Existing technologies require manual log organization and analysis using Excel, while this invention automatically associates data with the log model (ExecutionLog) and report template to generate a structured report.

[0072] Advantages: Report generation time is reduced from 30 minutes of manual compilation to less than 1 minute, and keyword log retrieval is supported, improving defect location efficiency by 80%. This invention achieves "one-click traceability" through database field-level association.

[0073] The report generation feedback can adopt a real-time feedback adjustment mechanism: by providing real-time feedback on test results, the priority of the module to which the failed test cases belong can be automatically increased, and the execution order of test cases can be dynamically adjusted based on the real-time test results.

[0074] It should be noted that although several modules of the system for executing actions are mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules for embodiment. Components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without any inventive effort.

[0075] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. An automated test management method based on Django and Vue, characterized in that, include: S1, Web Service and API Construction: Build web services using the Django framework, construct RESTful API interfaces using DRF, create a three-level model of Project, Script and TestCase through Django ORM, and integrate pytest and Selenium to form a test framework; S2, Dependency Installation and Environment Configuration: Install Django, pytest, and Selenium into Python, create a main project using Django, enter the project directory and create and register sub-applications using Python, then start the server using Python to complete the web application creation; S3, Front-end Interactive Interface Implementation: Based on Vue.js and Element UI, the front-end interface is built, and the project configuration form, script upload component, script / log list display component, and time picker component are developed. S4, Project and Script Management: Submit project information via front-end forms and call back-end APIs to complete project creation and environment variable configuration; Submit Selenium scripts via front-end upload components, and store script files and metadata on the back-end, supporting script queries by name, creator, and time range; S5, Test Case Execution and Logging: Select the target test case set to trigger immediate execution or configure scheduled execution; S6, Test Report Generation: After execution, an HTML format test report is automatically generated.

2. The automated test management method based on Django and Vue according to claim 1, characterized in that, The method further includes: S7, Send Email Notification: Executes an email sending task asynchronously via Celery, sending a report link and a summary of the execution results to a specified email address.

3. The automated test management method based on Django and Vue according to claim 1, characterized in that, In S5, for immediate execution, the frontend calls the / api / run-testcase interface, and the backend starts an asynchronous task through Celery to execute the Selenium script; for scheduled execution, execution is triggered by configuring crontab or interval rules through Celerybeat.

4. The automated test management method based on Django and Vue according to claim 2, characterized in that, In S7, emails are sent based on the SMTP protocol.

5. The automated test management method based on Django and Vue according to claim 3, characterized in that, During execution, the execution status, start / end time, and detailed logs are stored in the ExecutionLog model.

6. The automated test management method based on Django and Vue according to claim 1, characterized in that, The test report includes: execution overview, classification analysis, and ECharts graphical results.

7. An automated test management system based on Django and Vue, characterized in that, The system includes: Backend service layer: The web service is built based on the Django framework, integrating DRF to build RESTful API interfaces, and also integrating the pytest testing framework and Selenium automated testing tool; the backend service layer uses Django ORM to build a three-level data model, namely the Project model storing project information, the Script model storing script metadata, and the TestCase model storing test case set information; and the backend service layer is configured with Celery distributed task queue to handle asynchronous execution of test cases and scheduled tasks; Front-end interaction layer: Based on the Vue.js framework and combined with the Element UI component library, a visual interactive interface is implemented, providing interactive entry points for project configuration, script upload and management, test case execution, log query and report viewing; Functional modules: The functional modules include a project management module, a script management module, a test case execution module, and a reporting and notification module.

8. The automated test management system based on Django and Vue according to claim 7, characterized in that, The backend service layer and the frontend interaction layer are in a separate architecture.

9. The automated test management system based on Django and Vue according to claim 8, characterized in that, In the backend service layer, the API supports query parameters including: name, creator, and time range.