Search

CN-121979777-A - Cloud environment-based database automatic test method, device, equipment and medium

CN121979777ACN 121979777 ACN121979777 ACN 121979777ACN-121979777-A

Abstract

A cloud environment-based database automation test method, device, equipment and medium relate to the technical field of database test and comprise the steps of receiving a test request based on Web service, executing a Pipeline script based on a CI/CD tool, wherein the script is configured to be executed, dynamically creating and configuring a virtual machine instance for testing in the cloud environment, deploying a target database, a test environment and a system monitoring agent on the virtual machine instance, calling a standardized test interface packaged by a construction tool to execute the test instance through the Pipeline script, wherein the calling flow of the standardized test interface is configured to be a pre-processing task, a test execution task and a post-processing task which are sequentially executed, acquiring performance index data reported by the system monitoring agent and carrying out visual display in the test execution process, calling Prefect a predefined arrangement workflow after the test execution is completed, and the arrangement workflow comprises a task for acquiring an original test result and a task for analyzing the data and generating a report. The application improves the database testing efficiency.

Inventors

  • XIN XIAOHUA
  • Zhang Zhuolun
  • Wen Shuyun
  • XU ZHIXIN
  • TONG WEI

Assignees

  • 国家工业信息安全发展研究中心

Dates

Publication Date
20260505
Application Date
20251219

Claims (9)

  1. 1. The automatic database testing method based on the cloud environment is characterized by comprising the following steps of: S1, constructing a Web service, receiving a test request based on the Web service, obtaining test configuration information and generating a test task instruction; S2, responding to the test configuration information and the test task instruction, executing a Pipeline script based on a CI/CD tool, wherein the Pipeline script is configured to execute the following steps: s201, calling a cloud platform API, and dynamically creating and configuring a virtual machine instance for testing in a cloud environment; s202, deploying a target database, a test environment and a system monitoring agent on the virtual machine instance; S3, selectively calling a standardized test interface packaged by a construction tool to execute a test case aiming at the target database through the Pipeline script, wherein the calling flow of the standardized test interface is configured into a pre-processing task, a test execution task and a post-processing task which are sequentially executed; S4, responding to the test execution task, acquiring performance index data of the virtual machine instance and/or the target database for test, which are reported by the system monitoring agent, in the test execution process, and performing visual display; And S5, after the test is executed, invoking Prefect a predefined scheduling workflow, wherein the scheduling workflow comprises a task for collecting an original test result and a task for analyzing data and generating a report.
  2. 2. The automated testing method of cloud environment based databases of claim 1, wherein, The preprocessing task is configured to execute data environment initialization operation in the target database according to test configuration information, wherein the operation comprises cleaning historical data, creating or reconstructing a database table structure and generating reference data required by a test; The test execution task is configured to call at least one test tool, apply a load or query request conforming to the test configuration information to the target database, and record an original test result and performance index data output by the test tool; The post processing task is configured to execute an environment recovery operation after the test execution is completed, wherein the operation comprises stopping the test load, archiving or transferring the log and the result file generated by the test, and cleaning temporary data generated in the test process.
  3. 3. The automated testing method of cloud environment based databases of claim 1, wherein, The tasks for analyzing data and generating reports are configured to generate test analysis reports based on raw test result data and the performance index data.
  4. 4. The method for automated testing of a cloud environment based database of claim 3, The tasks for analyzing the data and generating reports are further configured to: Receiving an error log generated in a test process, calling an AI large model interface to analyze error reasons, and acquiring analysis suggestions and/or SQL sentence optimization suggestions for the error log and correlating the analysis suggestions and/or SQL sentence optimization suggestions to the test analysis report; The AI large model interface and the AI large model parameters are configured in the Web service.
  5. 5. The automated testing method of cloud environment based databases of claim 1, wherein, The CI/CD tool is Jenkins, and the construction tool is Ant.
  6. 6. The automated testing method of cloud environment based databases of claim 1, wherein, The performance index data reported by the system monitoring agent is collected in real time through the monitoring system to realize visual display; Wherein the system monitoring agent is Node Exporter, and the monitoring system further comprises Prometaus and Grafana.
  7. 7. A cloud environment-based database automation testing device, comprising: The Web service module is used for constructing Web services, receiving test requests based on the Web services, obtaining test configuration information and generating test task instructions; The deployment module is used for responding to the test configuration information and the test task instruction and executing a Pipeline script based on a CI/CD tool, wherein the Pipeline script is configured to execute the following steps: Calling a cloud platform API, and dynamically creating and configuring a virtual machine instance for testing in a cloud environment; Deploying a target database, a test environment and a system monitoring agent on the virtual machine instance; The test module is used for selectively calling a standardized test interface packaged by the construction tool to execute the test case aiming at the target database through the Pipeline script, wherein the calling flow of the standardized test interface is configured into a pre-processing task, a test execution task and a post-processing task which are sequentially executed; the monitoring module is used for responding to the test execution task, acquiring performance index data of the virtual machine instance and/or the target database for test, which are reported by the system monitoring agent, and performing visual display in the test execution process; and the result analysis module is used for calling Prefect a predefined arranging workflow after the test execution is finished, wherein the arranging workflow comprises a task for collecting an original test result and a task for analyzing data and generating a report.
  8. 8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps of the cloud environment based database automation test method according to any of claims 1 to 6.
  9. 9. A readable storage medium, characterized in that it has stored thereon a program or instructions which, when executed by a processor, implement the steps of the cloud environment based database automation test method according to any of claims 1 to 6.

Description

Cloud environment-based database automatic test method, device, equipment and medium Technical Field The present invention relates to the field of database testing technologies, and in particular, to a method, an apparatus, a device, and a medium for automatically testing a database based on a cloud environment. Background The performance, stability and reliability of the database are often directly related to the service quality of the whole application system, so that the database is sufficiently and effectively tested to be an important link for ensuring the quality of the application system. The traditional database test method generally depends on a physical or static test environment, a test team needs to manually configure server hardware, install an operating system, deploy database software, configure a network and the like, the whole process is tedious and time-consuming, and the test environment is very easy to be inconsistent due to manual operation, so that test results are difficult to reproduce, and the reliability of the test is reduced. With the rapid development of cloud computing technology, related technology starts to migrate its applications and services onto a cloud platform. Some database test schemes based on cloud environment utilize computing capability, storage capability and network resources provided by a cloud platform to realize quick deployment of the test environment and flexible allocation of the resources, but the following limitations still exist: The method has the advantages that firstly, the deployment of a test environment is complex and time-consuming, the manual configuration of hardware, software, network and other resources is low in efficiency, the problem of inconsistent environment is easily caused, secondly, the resource utilization rate is low, the lack of flexibility of a test team in resource allocation often causes resource waste and operation and maintenance cost increase, thirdly, the data collection and analysis efficiency is low, the time and effort are consumed due to the dependence on manual operation, errors are easily caused, and the accuracy and reliability of a test result are affected. Disclosure of Invention The invention provides a cloud environment-based database automatic test method, device, equipment and medium, which solve the problem of how to improve the database test efficiency. In order to achieve the above purpose, the application adopts the following technical scheme: in a first aspect, a method for automatically testing a database based on a cloud environment is provided, including: S1, constructing a Web service, receiving a test request based on the Web service, obtaining test configuration information and generating a test task instruction; S2, responding to the test configuration information and the test task instruction, executing a Pipeline script based on a CI/CD tool, wherein the Pipeline script is configured to execute the following steps: s201, calling a cloud platform API, and dynamically creating and configuring a virtual machine instance for testing in a cloud environment; s202, deploying a target database, a test environment and a system monitoring agent on the virtual machine instance; S3, selectively calling a standardized test interface packaged by a construction tool to execute a test case aiming at the target database through the Pipeline script, wherein the calling flow of the standardized test interface is configured into a pre-processing task, a test execution task and a post-processing task which are sequentially executed; S4, responding to the test execution task, acquiring performance index data of the virtual machine instance and/or the target database for test, which are reported by the system monitoring agent, in the test execution process, and performing visual display; And S5, after the test is executed, invoking Prefect a predefined scheduling workflow, wherein the scheduling workflow comprises a task for collecting an original test result and a task for analyzing data and generating a report. In a second aspect, a database automation testing device based on a cloud environment is provided, including: The Web service module is used for constructing Web services, receiving test requests based on the Web services, obtaining test configuration information and generating test task instructions; The deployment module is used for responding to the test configuration information and the test task instruction and executing a Pipeline script based on a CI/CD tool, wherein the Pipeline script is configured to execute the following steps: Calling a cloud platform API, and dynamically creating and configuring a virtual machine instance for testing in a cloud environment; Deploying a target database, a test environment and a system monitoring agent on the virtual machine instance; The test module is used for selectively calling a standardized test interface packaged by the construction tool to execute the test ca