Method and system for automatically generating automated test case based on business data
By automatically generating and optimizing automated test cases, the problems of long regression testing time and high cost in the express delivery industry are solved, the testing efficiency and quality are improved, and the rapid iteration of business systems is supported.
Patent Information
- Application Number
- CN202411534523.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-25
AI Technical Summary
In the express delivery industry, frequent changes in business systems lead to an increase in the scope and complexity of regression testing, resulting in high-cost automated test cases writing and maintenance, inefficient test scripts running and maintaining, and excessive regression testing time.
By obtaining business data in the business system, performing standardized processing, generating test cases using preset intelligent models, and generating executable automated test cases based on the automated test script model. At the same time, obtain the execution indicators of automated test cases and use the adaptive optimization model to optimize the test cases.
It reduces the time and cost of writing and maintaining test cases, improves the efficiency of regression testing, significantly improves the efficiency and quality of business system testing, reduces the cost of regression testing, and supports the rapid iteration of business systems and market response.
Smart Images

Figure CN119512944A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a method, system, computer device and readable storage medium for automatically generating automated test cases based on business data. Background Art
[0002] In the express delivery industry, with the frequent changes and releases of business systems, the scope and complexity of regression testing continues to increase, resulting in each regression test consuming a lot of time and human resources. The current testing process faces the following key challenges:
[0003] 1. High cost of automated test case writing and maintenance: The traditional automated test case writing process requires testers to have good programming skills and a deep understanding of business logic, write detailed test steps and convert them into automated test code. This not only requires high skills of testers, but also increases the cost of training and team building.
[0004] 2. Inefficient test script operation and maintenance: During the operation and maintenance of automated test cases, test scripts are often faced with problems such as poor readability, poor stability, and high maintenance costs. Frequent changes to the system require testers to constantly update and revise test scripts, further consuming a lot of time and human resources.
[0005] 3. Regression testing takes too long: Each regression test covers a wide range and has complex test steps, resulting in a long test cycle, which affects the rapid iteration and launch of the business system.
[0006] Therefore, improving the efficiency and quality of automated testing and reducing the time and cost required for regression testing are issues that need to be urgently addressed in the current testing process of the express delivery industry. Summary of the invention
[0007] Based on this, a method, system, computer device and readable storage medium for automatically generating automated test cases based on business data are provided to solve the above technical problems.
[0008] A method for automatically generating automated test cases based on business data, comprising:
[0009] Acquire business data in a business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data, and system log data;
[0010] Generate test cases based on the first data through a preset intelligent model, and generate executable automated test cases based on the automated test script model and the test cases;
[0011] Acquire execution indicators of automated test cases, and optimize the automated test cases based on an adaptive optimization model, wherein the execution indicators include at least one of coverage, execution time, and resource consumption of the automated test cases.
[0012] In one embodiment, the step of obtaining the execution index of the automated test case and optimizing the automated test case based on the adaptive optimization model includes:
[0013] Execute the automated test case and obtain the execution index in the test result of the automated test case;
[0014] The adaptive optimization model corresponding to the execution indicator is obtained based on the execution indicator, and the automated test case is optimized by the adaptive optimization model.
[0015] In one embodiment, the method for automatically generating automated test cases based on business data further includes:
[0016] Execute the automated test cases based on a preset period and collect test results;
[0017] The test results are analyzed and a test report is output.
[0018] In one of the embodiments, the adaptive optimization model includes a priority sorting optimization model and a deduplication optimization model.
[0019] In one embodiment, the step of generating a test case based on the first data by using a preset intelligent model, and generating an executable automated test case based on an automated test script model and the test case includes:
[0020] Acquire the first data and generate the test case through the preset intelligent model;
[0021] An automated test script model is obtained, and an executable automated test case is generated based on the automated test script model and the test case, wherein the automated test script model includes test operations and checkpoints.
[0022] In one embodiment, the step of obtaining business data in the business system, and performing standardization processing on the business data, and determining the first data includes:
[0023] Collecting the business data in the business system, wherein the business data includes at least one of business process data, operation step data and system log data;
[0024] The business data is cleaned and uniformly formatted, the first data is output, and the first data is stored in a database.
[0025] A system for automatically generating automated test cases based on business data, comprising:
[0026] A data module, used to obtain business data in the business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data and system log data;
[0027] A use case module, connected to the data module, for generating a test case based on the first data through a preset intelligent model, and generating an executable automated test case based on an automated test script model and the test case;
[0028] The optimization module is connected to the use case module and is used to obtain the execution index of the automated test case and optimize the automated test case based on the adaptive optimization model. The execution index includes at least one of the coverage, execution time and resource consumption of the automated test case.
[0029] In one of the embodiments, the adaptive optimization model includes a priority sorting optimization model and a deduplication optimization model.
[0030] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the above embodiments when executing the computer program.
[0031] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.
[0032] Compared with traditional technologies, the above-mentioned method, system, computer device and readable storage medium for automatically generating automated test cases based on business data, first, obtain business data in the business system, and standardize the business data to determine the first data, wherein the business data includes at least one of business process data, operation step data and system log data; secondly, generate test cases based on the first data through a preset intelligent model, and generate executable automated test cases based on the automated test script model and the test cases; finally, obtain the execution index of the automated test case, and optimize the automated test case based on the adaptive optimization model, wherein the execution index includes at least one of the coverage, execution time and resource consumption of the automated test case. The present application adopts the above-mentioned method, and by automatically generating and executing test cases, it not only reduces the time and cost of test case writing and maintenance, but also improves the efficiency of regression testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 A flowchart of a method for automatically generating automated test cases based on business data provided in an embodiment of the present application;
[0035] Figure 2 A structural block diagram of a system for automatically generating automated test cases based on business data provided in an embodiment of the present application;
[0036] Figure 3 This is a diagram of the internal structure of a computer device provided in one embodiment of the present application.
[0037] Description of reference numerals:
[0038] 10. A system for automatically generating automated test cases based on business data; 100. Data module; 200. Use case module; 300. Optimization module. DETAILED DESCRIPTION
[0039] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0040] The serial numbers assigned to the components herein, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings). In the description of this application, it should be understood that the orientation or position relationship indicated by the terms "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", etc. are based on the orientation or position relationship shown in the accompanying drawings, which is only for the convenience of describing this application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to this application.
[0041] In the present application, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0042] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be an intermediate element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be an intermediate element at the same time.
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0044] See also Figure 1 An embodiment of the present application provides a method for automatically generating automated test cases based on business data. The method includes:
[0045] S102: Acquire business data in a business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data, and system log data.
[0046] In some embodiments, business data in a business system can be obtained through a processor or a server, and the business data can be standardized to determine the first data. Specifically, historical business data can be collected from the logs, databases, and API interfaces (Application Programming Interfaces) of the business system. These business data include business processes, operating steps and their associated data, input and output data, etc. In some embodiments, the collected business data can be cleaned to remove noise and irrelevant information, and then the business data can be converted into a unified format and the first data can be obtained, which is convenient for subsequent processing and analysis, while also ensuring the consistency and integrity of the first data. In some embodiments, the cleaned and formatted first data is stored in a database for subsequent use.
[0047] S104: Generate test cases based on the first data using a preset intelligent model, and generate executable automated test cases based on an automated test script model and the test cases.
[0048] In some embodiments, before the automated test case is executed, it is necessary to build and configure the test environment to ensure that the automated test case can be executed in a real system environment. In some embodiments, a test case can be generated based on the first data by a processor or a server through a preset intelligent model, and an executable automated test case can be generated based on an automated test script model and the test case. Specifically, the first data can be converted into a test case by a preset intelligent model. Then an executable automated test case can be automatically generated according to the test case and the automated test script model. Among them, the automated test script model includes common test operations and checkpoints. In some embodiments, the automated test case can be implemented using common test frameworks and tools (such as Selenium, Appium, etc.).
[0049] S106: Obtain execution indicators of automated test cases, and optimize the automated test cases based on an adaptive optimization model, wherein the execution indicators include at least one of coverage, execution time, and resource consumption of the automated test cases.
[0050] In some embodiments, the execution index of the automated test case can be obtained through a processor or a server, and the automated test case can be optimized based on an adaptive optimization model. Specifically, when executing the automated test case, the execution index of the automated test case can be collected and analyzed. By analyzing the coverage, execution time, and resource consumption of the automated test case, problems and anomalies in the execution of the automated test case can be identified, and the automated test case can be optimized through an adaptive optimization model, thereby improving the coverage, accuracy, and other indicators of the automated test case. In some embodiments, the adaptive optimization model can be a priority sorting optimization model and a deduplication optimization model. This embodiment adopts the above method, and by automatically generating and executing test cases, not only the time and cost of test case writing and maintenance are reduced, but also the efficiency of regression testing is improved. Through this embodiment, the efficiency and quality of business system testing can be significantly improved, the cost of regression testing can be reduced, and the rapid iteration and market response of business systems can be supported.
[0051] In some embodiments, the step of obtaining execution indicators of automated test cases and optimizing the automated test cases based on an adaptive optimization model includes: executing the automated test cases and obtaining execution indicators in the test results of the automated test cases; obtaining the adaptive optimization model corresponding to the execution indicators based on the execution indicators, and optimizing the automated test cases through the adaptive optimization model.
[0052] In some embodiments, when the execution indicator is coverage, the adaptive optimization model corresponding to the coverage can be obtained, so that the automated test cases can be optimized through the adaptive optimization model to improve the coverage of the automated test cases. Similarly, when the execution indicator is resource consumption, the adaptive optimization model corresponding to resource consumption can be obtained, so that the automated test cases can be optimized through the adaptive optimization model to reduce the resource consumption of the automated test cases. In this way, appropriate adaptive optimization models and strategies can be applied to improve test efficiency and coverage, so that the automated test cases can be dynamically adjusted and optimized according to actual business needs and system changes to ensure the stability, performance and maintainability of the automated test cases.
[0053] In some embodiments, the method for automatically generating automated test cases based on business data also includes: executing the automated test cases based on a preset period and collecting test results; analyzing the test results and outputting a test report. In some embodiments, the preset period can be set according to actual needs, as long as the automated test cases can be optimized and the performance of the automated test cases can be improved. In some embodiments, automated test cases can be executed regularly or on demand, and detailed information of each automated test execution can be recorded, including execution time, test results, and abnormal situations. The test results are analyzed to identify problems and anomalies in the execution of the test cases, and a detailed test report is generated, including a summary of test results, a list of problems, suggestions for improvement, etc. The test report can be fed back to the development team to facilitate continuous improvement and optimization of the system.
[0054] In some embodiments, the step of generating a test case based on the first data through a preset intelligent model, and generating an executable automated test case based on an automated test script model and the test case includes: obtaining the first data and generating the test case through the preset intelligent model; obtaining an automated test script model, and generating an executable automated test case based on the automated test script model and the test case, wherein the automated test script model includes test operations and checkpoints. In some embodiments, the generated automated test cases are stored in a database for easy management and retrieval.
[0055] In some embodiments, the step of obtaining business data in the business system and standardizing the business data to determine the first data includes: collecting the business data in the business system, the business data including at least one of business process data, operation step data and system log data; cleaning and uniformly formatting the business data, outputting the first data, and storing the first data in a database for easy management and retrieval.
[0056] See also Figure 2 , an embodiment of the present application provides a system 10 for automatically generating automated test cases based on business data. The system 10 for automatically generating automated test cases based on business data includes: a data module 100, a use case module 200, and an optimization module 300. The data module 100 is used to obtain business data in a business system, and perform standardization processing on the business data to determine first data. The business data includes at least one of business process data, operation step data, and system log data. The use case module 200 is connected to the data module 100. The use case module 200 is used to generate test cases based on the first data through a preset intelligent model, and generate executable automated test cases based on an automated test script model and the test cases. The optimization module 300 is connected to the use case module 200. The optimization module 300 is used to obtain execution indicators of automated test cases, and optimize the automated test cases based on an adaptive optimization model. The execution indicators include at least one of coverage, execution time, and resource consumption of automated test cases. In some embodiments, the adaptive optimization model includes a priority sorting optimization model and a deduplication optimization model.
[0057] In some embodiments, the specific structure of the data module 100 is not limited, as long as it has the function of obtaining business data in the business system, performing standardization processing on the business data, and determining the first data. Specifically, the data module 100 can be a controller, a processor, etc. The specific structure of the data module 100 can be selected according to actual needs and is not specifically limited here.
[0058] In some embodiments, the specific structure of the use case module 200 is not limited, as long as it has the function of generating a test case based on the first data through a preset intelligent model, and generating an executable automated test case based on the automated test script model and the test case. Specifically, the use case module 200 can be a microprocessor or an integrated controller, etc. The specific structure of the use case module 200 can be selected according to actual needs and is not specifically limited here.
[0059] In some embodiments, the specific structure of the optimization module 300 is not limited, as long as it has the function of obtaining the execution index of the automated test case and optimizing the automated test case based on the adaptive optimization model. Specifically, the optimization module 300 can be a microprocessor or an integrated controller, etc. The specific structure of the optimization module 300 can be selected according to actual needs and is not specifically limited here. This embodiment not only reduces the time and cost of test case writing and maintenance, but also improves the efficiency of regression testing by automatically generating and executing test cases. Through this embodiment, enterprises can significantly improve the efficiency and quality of business system testing, reduce the cost of regression testing, and support rapid iteration and market response of business systems.
[0060] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for automatically generating automated test cases based on business data is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0061] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0062] See also Figure 3 Another embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method for automatically generating automated test cases based on business data as described in any one of the above embodiments are implemented.
[0063] In one embodiment, the processor implements the following steps when executing the computer program:
[0064] S102: Acquire business data in a business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data, and system log data;
[0065] S104: Generate a test case based on the first data by using a preset intelligent model, and generate an executable automated test case based on an automated test script model and the test case;
[0066] S106: Obtain execution indicators of automated test cases, and optimize the automated test cases based on an adaptive optimization model, wherein the execution indicators include at least one of coverage, execution time, and resource consumption of the automated test cases.
[0067] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for automatically generating automated test cases based on business data as described in any one of the above embodiments are implemented.
[0068] In one embodiment, the computer program, when executed by a processor, implements the following steps:
[0069] S102: Acquire business data in a business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data, and system log data;
[0070] S104: Generate a test case based on the first data by using a preset intelligent model, and generate an executable automated test case based on an automated test script model and the test case;
[0071] S106: Obtain execution indicators of automated test cases, and optimize the automated test cases based on an adaptive optimization model, wherein the execution indicators include at least one of coverage, execution time, and resource consumption of the automated test cases.
[0072] The above-mentioned computer device and computer-readable storage medium, by automatically generating and executing test cases, not only reduce the time and cost of test case writing and maintenance, but also improve the efficiency of regression testing. Through this embodiment, enterprises can significantly improve the efficiency and quality of business system testing, reduce the cost of regression testing, and support rapid iteration and market response of business systems.
[0073] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0074] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0075] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for automatically generating automated test cases based on business data, characterized in that: include: Acquire business data in a business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data, and system log data; Generate test cases based on the first data through a preset intelligent model, and generate executable automated test cases based on the automated test script model and the test cases; The execution index of the automated test case is obtained, and the automated test case is optimized based on the adaptive optimization model, wherein the execution index includes at least one of the coverage, execution time and resource consumption of the automated test case.
2. The method for automatically generating automated test cases based on business data according to claim 1, characterized in that: The step of obtaining the execution index of the automated test case and optimizing the automated test case based on the adaptive optimization model includes: Execute the automated test case and obtain the execution index in the test result of the automated test case; The adaptive optimization model corresponding to the execution indicator is obtained based on the execution indicator, and the automated test case is optimized by the adaptive optimization model.
3. The method for automatically generating automated test cases based on business data as claimed in claim 2, characterized in that: The method further comprises: Execute the automated test cases based on a preset period and collect test results; The test results are analyzed and a test report is output.
4. The method for automatically generating automated test cases based on business data as claimed in claim 2, characterized in that: The adaptive optimization model includes a priority sorting optimization model and a deduplication optimization model.
5. The method for automatically generating automated test cases based on business data according to claim 1, characterized in that: The step of generating a test case based on the first data by using a preset intelligent model, and generating an executable automated test case based on an automated test script model and the test case comprises: Acquire the first data and generate the test case through the preset intelligent model; An automated test script model is obtained, and an executable automated test case is generated based on the automated test script model and the test case, wherein the automated test script model includes a test operation and a checkpoint.
6. The method for automatically generating automated test cases based on business data according to claim 1, characterized in that: The step of obtaining business data in the business system, performing standardization processing on the business data, and determining the first data comprises: Collecting the business data in the business system, wherein the business data includes at least one of business process data, operation step data and system log data; The business data is cleaned and uniformly formatted, the first data is output, and the first data is stored in a database.
7. A system for automatically generating automated test cases based on business data, characterized in that: include: A data module, used to obtain business data in the business system, and perform standardization processing on the business data to determine first data, wherein the business data includes at least one of business process data, operation step data and system log data; A use case module, connected to the data module, for generating a test case based on the first data through a preset intelligent model, and generating an executable automated test case based on an automated test script model and the test case; The optimization module is connected to the use case module and is used to obtain the execution index of the automated test case and optimize the automated test case based on the adaptive optimization model. The execution index includes at least one of the coverage, execution time and resource consumption of the automated test case.
8. The system for automatically generating automated test cases based on business data as claimed in claim 7, characterized in that: The adaptive optimization model includes a priority sorting optimization model and a deduplication optimization model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.