Automatic test case generation and execution method and system
Through NLP, OCR and knowledge base technologies, and dynamically adjusting test strategies with historical data and code coverage, the limitations of existing automation testing tools are solved and efficient and extensive automated testing is achieved.
Patent Information
- Application Number
- CN202510042557.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-03-18
AI Technical Summary
Existing automated testing tools rely on manual design test cases, static testing cannot be dynamically optimized, lacks intelligent optimization capabilities, has low utilization of historical data, and is difficult to support multi-environment and high-concurrency testing.
By obtaining user input content, using NLP and OCR technology to analyze and generate structured key data, combining knowledge base rules to generate preliminary test cases, and dynamically adjust test strategies through historical data and code coverage optimization, supporting distributed parallel execution and multi-environment automated testing.
Improve testing efficiency, improve test coverage, enhance cross-platform compatibility, support automated continuous testing, reduce manual intervention and maintenance costs, and shorten test cycles.
Smart Images

Figure CN119645881A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a method and system for generating and executing automated test cases. Background Art
[0002] In the process of software development and quality assurance, automated testing has become an important means to improve software quality and accelerate the development cycle. However, the automated testing tools and methods widely used in the market currently have some limitations, which are mainly manifested in the following aspects:
[0003] 1. Test case generation relies on manual design: Most existing automated testing tools rely on test engineers to manually write test cases. This method is not only time-consuming and labor-intensive, but may also lead to insufficient test coverage due to human omissions, and fail to fully detect potential defects in the software.
[0004] 2. Static testing lacks dynamic optimization: Many existing automated testing tools generate test cases mainly based on static code analysis. This method certainly has its value, but when faced with complex business logic and changing application scenarios, the effectiveness of test cases is often limited and it is difficult to adapt to dynamically changing needs.
[0005] 3. Lack of intelligent optimization capabilities: Traditional automated testing tools are usually unable to automatically adjust and optimize test strategies based on test results. For example, after executing a round of testing, the tool usually only provides a report on the test results, but does not automatically generate new test cases or optimize existing test cases based on test failures to further improve the effectiveness and coverage of the test.
[0006] 4. Low utilization of historical data: Although some automated testing tools can collect test data and historical test results, most tools fail to make full use of this data to optimize future testing processes. Historical test data is rarely analyzed and utilized, resulting in the same test problems recurring in multiple iterations.
[0007] To solve the above problems, see Figure 1 ,Existing automated testing tools usually consist of the following main modules:
[0008] 1. Test case management module: used to create, edit, manage and store test cases. This module usually requires testers to manually enter test cases and record information such as test steps, expected results, input and output parameters, etc.
[0009] 2. Test execution module: responsible for executing test cases step by step according to the pre-defined test plan and recording the execution results of each test step. The test execution module is often integrated with the development environment or CI / CD system, and can automatically trigger tests after code submission.
[0010] 3. Result analysis module: After the test is executed, this module generates a test report, recording the pass / fail status of each use case, log information, performance indicators, etc. However, most of these analyses are static, mainly based on simple statistics during the test process, and fail to deeply explore potential problems.
[0011] 4. Code coverage analysis module: Some advanced automated testing tools are equipped with code coverage analysis functions, which can calculate and display the code paths, branches, and conditions covered during the execution of test cases. The purpose of this type of module is to help testers understand the coverage of test cases, thereby guiding the supplementation or optimization of test cases.
[0012] Although the above modules can improve test efficiency to a certain extent, their limitations are also obvious:
[0013] 1. Limitations of manual test case design: Existing automated testing tools rely on testers to manually write test cases, which not only increases testing costs, but also easily leads to uneven test case quality, insufficient coverage and effectiveness due to different experience and technical levels of testers.
[0014] 2. Insufficient intelligent optimization: The existing system is unable to self-learn or optimize based on test execution results and historical data, resulting in repeated errors that cannot be automatically repaired, test strategies that cannot be automatically adjusted and optimized, and the inability to improve test coverage and execution efficiency.
[0015] 3. Inefficient use of historical data: Although some tools can store historical test data, they fail to effectively use this data to optimize test strategies, resulting in repeated and redundant testing processes and failure to fully improve test coverage and effectiveness.
[0016] 4. Lack of multi-environment support: Most existing tools only support test execution in a single environment (such as Windows, Linux, etc.), and cannot flexibly support multiple execution environments, devices and browsers, limiting the wide applicability of testing.
[0017] 5. Insufficient parallel processing capabilities: Most existing tools have difficulty supporting high-concurrency execution or parallel processing, resulting in long testing times and being unable to adapt to modern rapid iteration development models.
[0018] Therefore, the applicant has found a solution to the above-mentioned problem through beneficial exploration and research, and the technical solution to be introduced below is produced in this context. Summary of the invention
[0019] One of the technical problems to be solved by the present invention is to provide a method for generating and executing automated test cases that improves test efficiency, increases test coverage, improves execution performance, enhances cross-platform compatibility, and supports automated continuous testing in response to the deficiencies in the prior art.
[0020] The second technical problem to be solved by the present invention is to provide a system for realizing the above-mentioned method for generating and executing automated test cases.
[0021] As a first aspect of the present invention, a method for generating and executing an automated test case comprises:
[0022] Obtain input content uploaded by the user, and parse and process the input content uploaded by the user to obtain structured key data;
[0023] Generate preliminary test cases based on common rules of structured key data and knowledge base, optimize preliminary test cases based on historical data and code coverage, and generate test cases;
[0024] Writing a test script according to the test case and executing the test script;
[0025] Analyze and process the test execution results, generate execution structure and generate test case analysis report; and
[0026] Optimize the test execution results and historical data, and dynamically adjust the test strategy based on the optimization results.
[0027] In a preferred embodiment of the present invention, the input content is one or more combinations of a requirement document, a requirement picture or a test requirement description.
[0028] In a preferred embodiment of the present invention, the parsing of the input content uploaded by the user to obtain structured key data includes:
[0029] Extract and process the input content uploaded by the user to obtain the plain text content;
[0030] Use the NLP model to perform word segmentation and grammatical analysis on the extracted plain text content to identify key entities;
[0031] Parse key entities and extract key information related to the test through a custom rule base and pre-trained models; and
[0032] The parsed key information is converted into structured key data according to a predetermined structure for storage, which is convenient for subsequent test case generation and calling.
[0033] In a preferred embodiment of the present invention, the input content uploaded by the user is extracted and processed, including:
[0034] For text files, read the content directly and perform basic text cleaning;
[0035] For image files, OCR technology is used to extract text information from the image files and convert them into plain text format.
[0036] In a preferred embodiment of the present invention, the generating of preliminary test cases according to the general rules of the structured key data and the knowledge base, optimizing the preliminary test cases according to the historical data and the code coverage, and generating test cases include:
[0037] Retrieve matching general rules from the knowledge base and generate preliminary test cases based on the parsed structured key data;
[0038] Query the historical database based on the preliminary test cases, obtain historical test results of the same functional module or similar scenarios from the historical database, and automatically adjust the preliminary test cases if there are uncovered code paths or failure records;
[0039] Train machine learning models using features from historical data to generate optimization strategies; and
[0040] When generating test cases, the preliminary test cases are adjusted or additional test cases are added to the preliminary test cases according to the prediction results of the model to ensure maximum coverage and finally generate test cases.
[0041] In a preferred embodiment of the present invention, the analysis and processing of the test execution results, and the generation of the execution structure and the test case analysis report include:
[0042] Allocate different test nodes according to the complexity of the test cases and the requirements of the test environment;
[0043] Automatically initialize the execution environment of each test node according to the assigned tasks;
[0044] Execute test cases in parallel on each node, monitor the execution status of each node in real time, and collect execution logs and code coverage data;
[0045] If a node fails or the test execution fails, the task will be automatically retried or reallocated to other nodes;
[0046] Collect execution results from each node, adjust the task queue according to the priority of the test case, give priority to failed key cases, and aggregate the test data of all nodes into a central database for generating a global test analysis report.
[0047] In a preferred embodiment of the present invention, the optimizing process of the test execution results and historical data, and dynamically adjusting the test strategy according to the optimization process results, includes:
[0048] During the test execution phase, the execution results of each test case are monitored in real time and the execution log is recorded;
[0049] For failed use cases, analyze the failure reasons and re-execute, and support setting the maximum number of retries to avoid resource waste caused by infinite retries;
[0050] Combined with the data from the code coverage analysis module, uncovered code paths are identified, and new test cases are automatically generated or existing test cases are adjusted based on the uncovered areas to ensure that coverage is gradually improved;
[0051] Use machine learning models to continuously analyze historical data and automatically optimize and update test strategies;
[0052] After each test execution, the general rules in the knowledge base are updated based on the execution result feedback to improve the efficiency and effectiveness of future test case generation.
[0053] As a second aspect of the present invention, a system for implementing the above-mentioned method for generating and executing automated test cases includes:
[0054] A parsing and processing module, the parsing and processing module is used to obtain input content uploaded by the user, and parse the input content uploaded by the user to obtain structured key data;
[0055] A test case generation module, the test case generation module is used to generate preliminary test cases according to the structured key data and the general rules of the knowledge base, optimize the preliminary test cases according to the historical data and the code coverage, and generate test cases;
[0056] A test case execution module, the test case execution module is used to write a test script according to the test case and execute the test script;
[0057] A test execution analysis module, which is used to analyze and process the test execution results, and generate an execution structure and a test case analysis report; and
[0058] The test optimization and adjustment module is used to optimize the test execution results and historical data, and dynamically adjust the test strategy according to the optimization results.
[0059] Due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0060] 1. Improve testing efficiency and reduce manual intervention
[0061] Compared with traditional automated testing tools, the present invention automatically generates test cases through knowledge base, OCR, NLP and other technologies, avoiding a large number of steps of manually creating test cases, and can efficiently parse requirement documents, prototype designs and interface pictures, and automatically generate comprehensive test cases; the present invention reduces manual intervention through the optimization of intelligent algorithms and historical data, and greatly improves the efficiency of test generation and execution. The automated process of the present invention can speed up the speed of test case generation and execution, and is expected to reduce the test design time by more than 50% in complex projects. Compared with the existing technology, the present invention can achieve large-scale test automation, especially suitable for fast-iterative development environments.
[0062] 2. Improve test coverage and enhance test results
[0063] The present invention dynamically generates test cases for uncovered functions through code coverage analysis and the learning ability of historical data, ensuring that the test coverage is significantly improved. However, the prior art usually only provides test cases generated by static rules, which have low coverage and cannot be adjusted dynamically. Through accurate analysis of code coverage, the present invention can identify blind spots and uncovered code paths in the test and generate more targeted supplementary test cases, which is expected to increase test coverage by 20%-30%, which is particularly obvious when the project complexity is high, and can effectively reduce the risks caused by insufficient coverage.
[0064] 3. Distributed architecture supports concurrent processing and improves execution performance
[0065] The present invention adopts a distributed architecture that can efficiently handle large-scale concurrent test tasks, especially in multi-platform and multi-environment test scenarios, showing excellent parallel execution capabilities. Traditional testing tools often have low resource utilization and limited execution efficiency when facing large-scale concurrent scenarios. The distributed parallel execution strategy of the present invention is expected to reduce test execution time, especially when processing large-scale concurrent tasks, the response speed is expected to increase by 30%-50%. This technical advantage is effective in complex system testing of large enterprises, reducing resource waste and improving test efficiency.
[0066] 4. Centralized management of failed cases, optimized problem tracking and processing
[0067] The present invention has the function of centralized management of failed test cases, which can automatically aggregate failed test cases into the workspace and automatically remove passed test cases without code updates. However, the prior art lacks a mechanism for centralized management of failed test cases, resulting in high test maintenance costs and low problem tracking efficiency. The present invention is expected to reduce more than 40% of manual troubleshooting and maintenance time by automating the management of failed test cases, effectively improving the efficiency of problem location and repair. Users can concentrate on handling failed test cases, greatly shortening the test maintenance cycle.
[0068] 5.Environment adaptive switching to enhance cross-platform compatibility
[0069] The present invention supports automatic switching of multiple platforms and multiple environments, and can perform automated testing in different operating systems, browsers and configurations. However, the prior art usually requires manual adjustment of the test environment, or lacks comprehensive support for multiple environments, which easily leads to inconsistent test results. The environment adaptive switching function of the present invention ensures the stability and consistency of the test results, reduces the occurrence of cross-platform incompatibility problems, and is expected to reduce cross-platform compatibility failures by more than 50%, which is particularly important in projects that need to cover multiple operating systems or browser configurations.
[0070] 6. Self-learning and adaptive capabilities to optimize test strategies
[0071] The present invention can automatically optimize future test strategies and dynamically adjust test case generation rules through the analysis of historical data and machine learning capabilities. The existing technology usually only relies on fixed rules to generate test cases and lacks an adaptive adjustment mechanism. Through the self-learning function of the present invention, the system can continuously optimize the generation and execution strategies of test cases based on previous test results, and it is expected to improve test accuracy and efficiency by 10%-20%. This dynamic adjustment capability significantly reduces maintenance costs, especially in long-term projects.
[0072] 7.Integrate CI / CD pipeline to support automated continuous testing
[0073] The present invention is seamlessly integrated with the CI / CD pipeline and can automatically trigger the generation and execution of test cases when the code is submitted or updated, ensuring that code changes will not introduce new defects. However, traditional testing tools cannot be efficiently integrated into the CI / CD process, resulting in a long feedback cycle for testing and development. The present invention is expected to shorten the feedback cycle for testing and development by about 30% through deep integration with CI / CD, improving the efficiency of software iteration, especially in a rapid release development environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0075] Figure 1 It is a structural diagram of existing automated testing tools.
[0076] Figure 2It is a schematic diagram of the process of the present invention.
[0077] Figure 3 It is a schematic diagram of the system structure of the present invention. DETAILED DESCRIPTION
[0078] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below with reference to specific diagrams.
[0079] See also Figure 2 , the figure shows a method for generating and executing automated test cases, including the following steps:
[0080] Step S10, obtaining the input content uploaded by the user, and parsing the input content uploaded by the user to obtain structured key data.
[0081] Step S20, generating preliminary test cases according to the structured key data and the general rules of the knowledge base, optimizing the preliminary test cases according to the historical data and the code coverage, and generating test cases.
[0082] Step S30, writing a test script according to the test case, and executing the test script.
[0083] Step S40, analyzing and processing the test execution result, and generating an execution structure and a test case analysis report.
[0084] Step S50, optimizing the test execution results and historical data, and dynamically adjusting the test strategy according to the optimization results.
[0085] In step S10, the input content uploaded by the user may be one or a combination of a requirement document, a requirement picture, or a test requirement description.
[0086] In step S10, the input content uploaded by the user is parsed to obtain structured key data, including the following sub-steps:
[0087] Step S11, extract and process the input content uploaded by the user to obtain the plain text content. For text files, directly read the content and perform basic text cleaning (such as removing blank lines, punctuation processing, etc.); for image files, use OCR (such as Tesseract OCR) technology to extract the text information in the image file and convert it into plain text format.
[0088] Step S12: Use an NLP model (such as BERT or SpaCy) to perform word segmentation and grammatical parsing on the extracted plain text content to identify key entities (such as function names, operation steps).
[0089] Step S13, parse the key entities through the customized rule base and pre-trained model (combined with the knowledge base), and extract key information related to the test (such as input parameters, expected output, boundary values, etc.).
[0090] Step S14, converting the parsed key information into structured key data (such as JSON format) according to a predetermined structure for storage, so as to facilitate subsequent test case generation and calling.
[0091] In step S20, preliminary test cases are generated according to the general rules of the structured key data and the knowledge base, and the preliminary test cases are optimized according to the historical data and the code coverage, and test cases are generated, including the following sub-steps:
[0092] Step S21, retrieve matching general rules (such as character boundary processing, input verification, etc.) from the knowledge base, and generate preliminary test cases in combination with the parsed structured key data.
[0093] Step S22, query the historical database according to the preliminary test case, obtain the historical test results of the same functional module or similar scenarios from the historical database, and automatically adjust the preliminary test case (such as adding specific input boundary values, adding exception handling scenarios, etc.) if there are uncovered code paths or failure records.
[0094] Step S23, training a machine learning model (such as a decision tree or a random forest) using features in historical data (such as input parameter type, test results) to generate an optimization strategy.
[0095] Step S24, when the test cases are generated, the preliminary test cases are adjusted or additional test cases are added to the preliminary test cases according to the prediction results of the model to ensure that the coverage is maximized and finally generate the test cases.
[0096] In step S40, the test execution result is analyzed and processed, and an execution structure and a test case analysis report are generated, including the following steps:
[0097] Step S41, allocating different test nodes (eg, different virtual machines or containers) according to the complexity of the test case and the requirements of the test environment.
[0098] Step S42: automatically initialize the execution environment of each test node according to the assigned task (such as loading different operating system images or browser versions).
[0099] Step S43, execute the test cases in parallel on each node, monitor the execution status of each node in real time, and collect execution logs and code coverage data.
[0100] Step S44: If a node fails or the test execution fails, the task is automatically retried or reallocated to other nodes.
[0101] Step S45, collects execution results from each node, and adjusts the task queue according to the priority of the test case, giving priority to failed key test cases. The test data of all nodes are aggregated to the central database for generating a global test analysis report, realizing high-concurrency test execution on multiple platforms and multiple environments, ensuring efficient use of resources and improving test speed.
[0102] In step S50, the test execution results and historical data are optimized, and the test strategy is dynamically adjusted according to the optimization results, including the following steps:
[0103] Step S51, during the test execution phase, monitor the execution result of each test case in real time and record the execution log, including success / failure status, coverage path, etc.
[0104] Step S52, for failed use cases, analyze the reasons for failure (such as boundary values not covered, input not meeting requirements, etc.), automatically adjust the use cases and re-execute them, and support setting the maximum number of retries to avoid resource waste caused by infinite retries.
[0105] Step S53, combining the data from the code coverage analysis module, identifying uncovered code paths, and automatically generating new test cases or adjusting existing test cases based on the uncovered areas to ensure that the coverage rate is gradually improved.
[0106] Step S54, using a machine learning model (such as a Q-learning algorithm based on reinforcement learning) to automatically optimize and update the test strategy by continuously analyzing historical data.
[0107] Step S55, after each test is executed, the general rules in the knowledge base are updated according to the execution result feedback to improve the generation efficiency and effectiveness of future test cases.
[0108] See also Figure 3 , the figure shows a system for realizing the above-mentioned automated test case generation and execution method of the present invention, including a parsing and processing module 100, a test case generation module 200, a test case execution module 300, a test execution analysis module 400 and a test optimization and adjustment module 500.
[0109] The parsing and processing module 100 is used to obtain input content uploaded by the user, and parse the input content uploaded by the user to obtain structured key data.
[0110] The test case generation module 200 is used to generate preliminary test cases according to the general rules of structured key data and knowledge base, optimize the preliminary test cases according to historical data and code coverage, and generate test cases. Specifically, the test case generation module 200 automatically generates test cases by parsing the requirements document, interface pictures and the requirements description input by the user using OCR technology and natural language processing (NLP) technology. The general test requirements in the knowledge base (such as character boundary values, null value processing, etc.) are used to supplement the rules for case generation and ensure test coverage. Text and image information are extracted from the requirements document through OCR technology, and these data are passed to the natural language processing module in the form of signals for semantic analysis. The parsed key information, such as function module name, boundary value, etc., will be compared with the general rules in the knowledge base after data processing. Finally, the test cases generated by the system are sent to the test execution module through the API interface and are ready to enter the next test phase.
[0111] The present invention uses OCR technology and NLP technology to extract key information from requirement documents, prototypes or interface images, and automatically generates test cases in combination with general test rules in the knowledge base. The test case generation module 200 includes the following functions:
[0112] Demand input and analysis: Users generate requirements by uploading requirement documents, interface images, or providing specific use cases (such as "generate test cases for the login function, taking into account boundary conditions and input restrictions"), and the system parses them through OCR and NLP.
[0113] Knowledge base and custom rules: The system combines the parsed information with the common test requirements in the knowledge base to generate preliminary test cases. The knowledge base stores a large number of common test rules, such as character length restrictions, boundary value processing, special character processing, etc. Special administrators can conduct targeted training and updates.
[0114] Test case optimization: The system optimizes the generated test cases based on the knowledge base and historical data. For example, the system can automatically add specific scenarios such as boundary value and null value tests to improve test coverage. Through machine learning, the system will generate more targeted test cases based on the results of previous test executions, especially to supplement uncovered areas.
[0115] Test execution and parallel processing: The generated test cases are executed in parallel on multiple nodes through a distributed architecture. The system supports large-scale high-concurrency processing and significantly shortens the execution time.
[0116] Customized use case format: Users can define the use case fields required for the project, such as "use case name", "functional module", "preconditions", etc., through dialogue, and the system will generate formatted test cases according to the requirements.
[0117] Project workspace management: Use case requirements of different projects can be managed in their respective workspaces, and common test requirements can be added to the knowledge base for sharing with other projects.
[0118] Integration with CI / CD: The system can be seamlessly integrated into the CI / CD pipeline, automatically triggering test case generation and execution when the code is submitted or updated, ensuring that code changes do not introduce new defects.
[0119] Result analysis and feedback: After the test is completed, the system generates a detailed test report and automatically identifies potential uncovered areas by comparing historical test data, dynamically adjusting future use case generation strategies.
[0120] The test case execution module 300 is used to write a test script according to the test case and execute the test script. The test case execution module 300 supports multi-platform and multi-environment test execution, can automatically generate scripts and embed the execution environment, and perform efficient automated testing. The generated test cases are automatically assigned to the test execution module. The module can support high-concurrency testing, especially in large-scale testing scenarios, using a distributed architecture to improve test efficiency and response time. During the test execution process, the system monitors the code path coverage of each test case in real time. The coverage analysis module receives signals from the execution module, compares these data with historical test results, and automatically identifies uncovered code areas. The system will dynamically generate new test cases based on these data feedbacks, and further optimize them through the knowledge base to ensure the comprehensiveness of the test.
[0121] The test case execution module 300 automatically writes execution scripts based on the generated test cases and runs them in the built-in execution module. The system supports automatic switching of different operating systems, browsers and environments. The main functions include:
[0122] Dynamic parallel execution: The system can automatically adjust the number of parallel executions to improve efficiency based on the complexity of the use case and resource conditions.
[0123] Code reading and analysis: The system can directly read and analyze the underlying code, and identify key functions, modules, and variables related to the test cases by scanning the code base. This automated parsing function reduces the workload of manually understanding the code structure and greatly improves efficiency.
[0124] Environment adaptive switching: Supports automatic switching of execution environments (Linux, Windows, etc.) to ensure that test cases can be successfully executed on different platforms. In addition, the system supports executing tests across multiple browser configurations to ensure compatibility in different environments.
[0125] Token setting: To facilitate the distinction and management of system accounts, the system allows users to set token values when executing tests to ensure that operations of different users can be correctly identified.
[0126] Failed test case workspace management: The system will centralize the failed test cases into a dedicated workspace, so that users can centrally handle these failed test cases. When the test passes, the case will be automatically removed from the workspace.
[0127] Detailed execution report: The system generates a detailed execution report for each test execution, including statistics of successful and failed cases, log traces, and environment information.
[0128] The test execution analysis module 400 is used to analyze and process the test execution results, generate the execution structure and generate the test case analysis report. The test execution analysis module 400 is used to automatically analyze the test results after execution and generate a report. The report records in detail the execution results, abnormal conditions and the code paths covered by each test case. By comparing with historical test data, the system can identify potential uncovered areas and automatically generate supplementary cases. The test execution results are analyzed by intelligent algorithms, and detailed test reports are generated, automatically focusing on failed test cases.
[0129] The test optimization and adjustment module 500 is used to optimize the test execution results and historical data, and dynamically adjust the test strategy according to the optimization results. The test optimization and adjustment module 500 automatically optimizes the test strategy by analyzing historical data. It can learn from previous test results and dynamically adjust the priority of test case generation and execution. The optimization algorithm of the test optimization and adjustment module 500 includes:
[0130] Regression test optimization based on historical data: The system automatically generates or adjusts test cases based on historical data, giving priority to testing parts affected by code changes to improve testing efficiency.
[0131] Failure retry mechanism: For temporary failures, the system will automatically perform retry operations to ensure the accuracy of the test.
[0132] Coverage-based optimization: Through code coverage analysis, the system can dynamically generate supplementary use cases for uncovered functions or edge cases to ensure comprehensive testing.
[0133] Fine-grained log tracking and playback: The system provides a playback function for the execution process. Users can review each test step through log details to help locate the root cause of the problem.
[0134] Concurrency and performance optimization: The system uses a distributed architecture to handle large-scale concurrent scenarios, ensuring efficient response speed when processing a large number of use cases.
[0135] The knowledge base of the system of the present invention stores common test rules, which are maintained and updated by special administrators, and ordinary users can only reference these rules in projects. The knowledge base supports automated learning and optimization, and dynamically adjusts content according to project requirements.
[0136] Knowledge base expansion: Users can add certain rules to the knowledge base based on specific project requirements for reuse in other projects.
[0137] AI self-learning function: The system learns from the test results, automatically generates new test rules, continuously enriches the knowledge base, and optimizes future test case generation.
[0138] The present invention is an automated test case generation and execution system with self-learning and self-adaptive capabilities. The system parses input data such as requirement documents, prototype designs, and interface images into specific test cases through technologies such as knowledge base, natural language processing (NLP), and optical character recognition (OCR). Users can also generate personalized test cases by simply describing their requirements. The present invention can optimize and automatically execute test cases based on historical data, code coverage analysis, and concurrent processing strategies, support customized requirements for different projects, and seamlessly integrate with continuous integration / continuous delivery (CI / CD) systems to achieve full-process automated testing, with cross-platform, multi-environment testing capabilities, and support centralized management and processing of failed cases.
[0139] Due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0140] 1. Improve testing efficiency and reduce manual intervention
[0141] Compared with traditional automated testing tools, the present invention automatically generates test cases through knowledge base, OCR, NLP and other technologies, avoiding a large number of steps of manually creating test cases, and can efficiently parse requirement documents, prototype designs and interface pictures, and automatically generate comprehensive test cases; the present invention reduces manual intervention through the optimization of intelligent algorithms and historical data, and greatly improves the efficiency of test generation and execution. The automated process of the present invention can speed up the speed of test case generation and execution, and is expected to reduce the test design time by more than 50% in complex projects. Compared with the existing technology, the present invention can achieve large-scale test automation, especially suitable for fast-iterative development environments.
[0142] 2. Improve test coverage and enhance test results
[0143] The present invention dynamically generates test cases for uncovered functions through code coverage analysis and the learning ability of historical data, ensuring that the test coverage is significantly improved. However, the prior art usually only provides test cases generated by static rules, which have low coverage and cannot be adjusted dynamically. Through accurate analysis of code coverage, the present invention can identify blind spots and uncovered code paths in the test and generate more targeted supplementary test cases, which is expected to increase test coverage by 20%-30%, which is particularly obvious when the project complexity is high, and can effectively reduce the risks caused by insufficient coverage.
[0144] 3. Distributed architecture supports concurrent processing and improves execution performance
[0145] The present invention adopts a distributed architecture that can efficiently handle large-scale concurrent test tasks, especially in multi-platform and multi-environment test scenarios, showing excellent parallel execution capabilities. Traditional testing tools often have low resource utilization and limited execution efficiency when facing large-scale concurrent scenarios. The distributed parallel execution strategy of the present invention is expected to reduce test execution time, especially when processing large-scale concurrent tasks, the response speed is expected to increase by 30%-50%. This technical advantage is effective in complex system testing of large enterprises, reducing resource waste and improving test efficiency.
[0146] 4. Centralized management of failed cases, optimized problem tracking and processing
[0147] The present invention has the function of centralized management of failed test cases, which can automatically aggregate failed test cases into the workspace and automatically remove passed test cases without code updates. However, the prior art lacks a mechanism for centralized management of failed test cases, resulting in high test maintenance costs and low problem tracking efficiency. The present invention is expected to reduce more than 40% of manual troubleshooting and maintenance time by automating the management of failed test cases, effectively improving the efficiency of problem location and repair. Users can concentrate on handling failed test cases, greatly shortening the test maintenance cycle.
[0148] 5.Environment adaptive switching to enhance cross-platform compatibility
[0149] The present invention supports automatic switching of multiple platforms and multiple environments, and can perform automated testing in different operating systems, browsers and configurations. However, the prior art usually requires manual adjustment of the test environment, or lacks comprehensive support for multiple environments, which easily leads to inconsistent test results. The environment adaptive switching function of the present invention ensures the stability and consistency of the test results, reduces the occurrence of cross-platform incompatibility problems, and is expected to reduce cross-platform compatibility failures by more than 50%, which is particularly important in projects that need to cover multiple operating systems or browser configurations.
[0150] 6. Self-learning and adaptive capabilities to optimize test strategies
[0151] The present invention can automatically optimize future test strategies and dynamically adjust test case generation rules through the analysis of historical data and machine learning capabilities. The existing technology usually only relies on fixed rules to generate test cases and lacks an adaptive adjustment mechanism. Through the self-learning function of the present invention, the system can continuously optimize the generation and execution strategies of test cases based on previous test results, and it is expected to improve test accuracy and efficiency by 10%-20%. This dynamic adjustment capability significantly reduces maintenance costs, especially in long-term projects.
[0152] 7.Integrate CI / CD pipeline to support automated continuous testing
[0153] The present invention is seamlessly integrated with the CI / CD pipeline and can automatically trigger the generation and execution of test cases when the code is submitted or updated, ensuring that code changes will not introduce new defects. However, traditional testing tools cannot be efficiently integrated into the CI / CD process, resulting in a long feedback cycle for testing and development. The present invention is expected to shorten the feedback cycle for testing and development by about 30% through deep integration with CI / CD, improving the efficiency of software iteration, especially in a rapid release development environment.
[0154] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for generating and executing automated test cases, characterized in that: include: Obtain input content uploaded by the user, and parse and process the input content uploaded by the user to obtain structured key data; Generate preliminary test cases based on common rules of structured key data and knowledge base, optimize preliminary test cases based on historical data and code coverage, and generate test cases; Writing a test script according to the test case and executing the test script; Analyze and process the test execution results, generate the execution structure and generate the test case analysis report; as well as Optimize the test execution results and historical data, and dynamically adjust the test strategy based on the optimization results.
2. The method for generating and executing automated test cases according to claim 1, wherein: The input content is one or more combinations of requirement documents, requirement pictures or test requirement descriptions.
3. The method for generating and executing automated test cases according to claim 2, wherein: The input content uploaded by the user is parsed to obtain structured key data, including: Extract and process the input content uploaded by the user to obtain the plain text content; Use the NLP model to perform word segmentation and grammatical analysis on the extracted plain text content to identify key entities; Parse key entities and extract key information related to the test through a custom rule base and pre-trained models; and The parsed key information is converted into structured key data according to a predetermined structure for storage, which is convenient for subsequent test case generation and calling.
4. The method for generating and executing automated test cases according to claim 3, wherein: Extract and process the input content uploaded by the user, including: For text files, read the content directly and perform basic text cleaning; For image files, OCR technology is used to extract text information from the image files and convert them into plain text format.
5. The method for generating and executing automated test cases according to claim 1, wherein: The method of generating preliminary test cases according to the general rules of the structured key data and the knowledge base, optimizing the preliminary test cases according to the historical data and the code coverage, and generating test cases includes: Retrieve matching general rules from the knowledge base and generate preliminary test cases based on the parsed structured key data; Query the historical database based on the preliminary test cases, obtain historical test results of the same functional module or similar scenarios from the historical database, and automatically adjust the preliminary test cases if there are uncovered code paths or failure records; Train machine learning models (such as decision trees or random forests) using features from historical data to generate optimization strategies; and When generating test cases, the preliminary test cases are adjusted or additional test cases are added to the preliminary test cases according to the prediction results of the model to ensure maximum coverage and finally generate test cases.
6. The method for generating and executing automated test cases according to claim 1, wherein: The analysis and processing of the test execution results and the generation of the execution structure and the test case analysis report include: Allocate different test nodes according to the complexity of the test cases and the requirements of the test environment; Automatically initialize the execution environment of each test node according to the assigned tasks; Execute test cases in parallel on each node, monitor the execution status of each node in real time, and collect execution logs and code coverage data; If a node fails or the test execution fails, the task will be automatically retried or reallocated to other nodes; Collect execution results from each node, adjust the task queue according to the priority of the test case, give priority to failed key cases, and aggregate the test data of all nodes into a central database for generating a global test analysis report.
7. The method for generating and executing automated test cases according to claim 1, wherein: The optimizing process of the test execution results and historical data, and dynamically adjusting the test strategy according to the optimization process results, includes: During the test execution phase, the execution results of each test case are monitored in real time and the execution log is recorded; For failed use cases, analyze the failure reasons and re-execute, and support setting the maximum number of retries to avoid resource waste caused by infinite retries; Combined with the data from the code coverage analysis module, uncovered code paths are identified, and new test cases are automatically generated or existing test cases are adjusted based on the uncovered areas to ensure that coverage is gradually improved; Use machine learning models to continuously analyze historical data and automatically optimize and update test strategies; After each test execution, the general rules in the knowledge base are updated based on the execution result feedback to improve the efficiency and effectiveness of future test case generation.
8. A system for implementing the method for generating and executing automated test cases as claimed in any one of claims 1 to 7, characterized in that: include: A parsing and processing module, which is used to obtain input content uploaded by the user, and parse the input content uploaded by the user to obtain structured key data; A test case generation module, the test case generation module is used to generate preliminary test cases according to the structured key data and the general rules of the knowledge base, optimize the preliminary test cases according to the historical data and the code coverage, and generate test cases; A test case execution module, the test case execution module is used to write a test script according to the test case and execute the test script; A test execution analysis module, which is used to analyze and process the test execution results, and generate an execution structure and a test case analysis report; as well as The test optimization and adjustment module is used to optimize the test execution results and historical data, and dynamically adjust the test strategy according to the optimization results.
Citation Information
Cited By
Efficient PL / SQL database test case generation method and system
CN120407424A
Automatic black box testing method and related device
CN120849303A