CN117234919A - System unit testing method based on machine learning algorithm, electronic equipment and medium - Google Patents

System unit testing method based on machine learning algorithm, electronic equipment and medium Download PDF

Info

Publication number
CN117234919A
CN117234919A CN202311202582.7A CN202311202582A CN117234919A CN 117234919 A CN117234919 A CN 117234919A CN 202311202582 A CN202311202582 A CN 202311202582A CN 117234919 A CN117234919 A CN 117234919A
Authority
CN
China
Prior art keywords
machine learning
system unit
learning algorithm
testing method
unit testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311202582.7A
Other languages
Chinese (zh)
Inventor
冀雪阳
卢炜
范红霞
李洪军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HUADI COMPUTER GROUP CO Ltd
Original Assignee
HUADI COMPUTER GROUP CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by HUADI COMPUTER GROUP CO Ltd filed Critical HUADI COMPUTER GROUP CO Ltd
Priority to CN202311202582.7A priority Critical patent/CN117234919A/en
Publication of CN117234919A publication Critical patent/CN117234919A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a system unit testing method based on a machine learning algorithm, electronic equipment and a medium. The method may include: establishing a machine learning Neuroph tool library, training and testing initial data through a multi-layer assembly neural network, and establishing an initial model; analyzing the logic and structure of the code, and generating a new test case according to the initial model; executing a new test case, recording actual output, comparing the actual output with corresponding expected output, and adjusting an initial model; and classifying and sorting the new test cases according to the comparison result to generate a test report. The application carries out coverage test from multiple angles, reduces the error rate of the system and can discover the problems existing in the system earlier.

Description

System unit testing method based on machine learning algorithm, electronic equipment and medium
Technical Field
The present application relates to the field of code optimization, and more particularly, to a system unit testing method, an electronic device, and a medium based on a machine learning algorithm.
Background
The system unit test is a software test method, and the traditional unit test requires a developer to write test cases manually. This requires a lot of labor and man-hours, and there may be missing or erroneous test cases, failure to capture all errors, and as software evolves and changes, unit testing also requires manual maintenance and updating.
Therefore, there is a need to develop a system unit testing method, an electronic device, and a medium based on a machine learning algorithm.
The information disclosed in the background section of the application is only for enhancement of understanding of the general background of the application and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
The application provides a system unit testing method, electronic equipment and a medium based on a machine learning algorithm, which are used for performing coverage test from multiple angles, reducing the system error rate and finding out the problems existing in a system earlier.
In a first aspect, an embodiment of the present disclosure provides a system unit testing method based on a machine learning algorithm, including:
establishing a machine learning Neuroph tool library, training and testing initial data through a multi-layer assembly neural network, and establishing an initial model;
analyzing the logic and structure of the codes, and generating new test cases according to the initial model;
executing a new test case, recording actual output, comparing the actual output with corresponding expected output, and adjusting the initial model;
and classifying and sorting the new test cases according to the comparison result to generate a test report.
Preferably, the initial data includes inputs and expected outputs of known test cases.
Preferably, the input of the known test case is substituted into the multi-layer assembled neural network, output prediction is performed, the output prediction is compared with the expected output, training and testing are performed on the multi-layer assembled neural network, and the trained neural network is the initial model.
Preferably, the method further comprises:
and according to the complexity, importance and historical defect data factors of the codes, assigning priorities to the test cases, and ensuring that the important test cases obtain higher test coverage rate.
Preferably, the method further comprises:
by learning normal code behavior, detecting anomalies or errant behavior, analyzing patterns and behavior during code execution, and identifying potential errors or anomalies.
Preferably, the method further comprises:
analyzing the test results and the code coverage data to identify error prone areas.
Preferably, the sorting comprises:
and analyzing and processing the repeatedly called modules, marking in a weighted mode, and storing the abnormal data test cases according to the module classification so as to carry out statistics and analysis.
Preferably, the test report is presented by means of an echartis chart.
In a second aspect, embodiments of the present disclosure further provide an electronic device, including:
a memory storing executable instructions;
and a processor executing the executable instructions in the memory to implement the machine learning algorithm based system unit testing method.
In a third aspect, the disclosed embodiments also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the machine learning algorithm based system unit testing method.
The method and apparatus of the present application have other features and advantages which will be apparent from or are set forth in detail in the accompanying drawings and the following detailed description, which are incorporated herein, and which together serve to explain certain principles of the present application.
Drawings
The foregoing and other objects, features and advantages of the application will be apparent from the following more particular descriptions of exemplary embodiments of the application as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the application.
FIG. 1 shows a flowchart of the steps of a system unit testing method based on a machine learning algorithm, according to one embodiment of the application.
Detailed Description
Preferred embodiments of the present application will be described in more detail below. While the preferred embodiments of the present application are described below, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein.
In order to facilitate understanding of the solution and the effects of the embodiments of the present application, three specific application examples are given below. It will be understood by those of ordinary skill in the art that the examples are for ease of understanding only and that any particular details thereof are not intended to limit the present application in any way.
Example 1
FIG. 1 shows a flowchart of the steps of a system unit testing method based on a machine learning algorithm, according to one embodiment of the application.
As shown in fig. 1, the system unit testing method based on the machine learning algorithm includes: step 101, a machine learning neuroth tool library is established, initial data training and testing are carried out through a multi-layer assembly neural network, and an initial model is established; 102, analyzing logic and structure of codes, and generating new test cases according to an initial model; step 103, executing a new test case, recording actual output, comparing the actual output with corresponding expected output, and adjusting an initial model; and 104, classifying and sorting the new test cases according to the comparison result to generate a test report.
In one example, the initial data includes inputs and expected outputs of known test cases.
In one example, inputs of known test cases are substituted into a multi-layer assembled neural network, output predictions are made and compared with expected outputs, training and testing are performed for the multi-layer assembled neural network, and the trained neural network is the initial model.
In one example, further comprising:
and according to the complexity, importance and historical defect data factors of the codes, assigning priorities to the test cases, and ensuring that the important test cases obtain higher test coverage rate.
In one example, further comprising:
by learning normal code behavior, detecting anomalies or errant behavior, analyzing patterns and behavior during code execution, and identifying potential errors or anomalies.
In one example, further comprising:
analyzing the test results and the code coverage data to identify error prone areas.
In one example, the sort arrangement includes:
and analyzing and processing the repeatedly called modules, marking in a weighted mode, and storing the abnormal data test cases according to the module classification so as to carry out statistics and analysis.
In one example, the test report is presented by way of an ECharts chart.
Specifically, a development framework is built, a machine learning Neuroph tool library is introduced, a multi-layer assembly neural network is adopted for data training and testing, and an initial model is obtained.
Preparing independent module source codes of a certain item, and writing test cases, including input and expected output. Ensuring the quality and accuracy of data, and carrying out necessary pretreatment and feature extraction; selecting an appropriate feature representation so that the machine learning algorithm can understand and process; the selected machine learning model is trained using the collected and prepared test data. Establishing a predictive capability of the model by learning a relationship between the input features and the expected output; and evaluating the trained initial model by using independent test data, and optimizing according to an evaluation result.
According to the existing code and test cases, a new test case is automatically generated through an initial model. And generating test cases with different inputs and boundary conditions according to the prediction capability and the test requirement of the model so as to increase the test coverage rate. When the test is correct, an interface is provided to support continuous learning and updating of the machine learning model with the appearance of new test data and code changes.
Therefore, the method can cover all code paths basically, and each path and boundary condition of the code is covered by generating a large number of unit test cases.
The mock framework is referenced to perform testing on the test cases and record the actual output. And comparing the actual output with the expected output, analyzing the test result, providing feedback and adjusting the initial model.
In the process, the test cases can be assigned with priority according to factors such as complexity, importance and historical defect data of codes. This helps the test team better allocate resources and ensures that important test cases get higher test coverage.
The method can also learn normal code behaviors, detect abnormal or wrong behaviors, identify potential errors or abnormal conditions by analyzing the modes and behaviors of the codes during execution, and help to find hidden problems. Conventional unit testing may capture some errors and anomalies, but is not guaranteed to capture all possible errors, some errors may occur only in a particular environment or under particular input conditions. The method can use machine algorithm to find more error information.
Test results and code coverage data may also be analyzed, advice is provided on which parts require more testing and debugging, error prone areas are identified, and relevant improvement advice is provided. Classifying, analyzing and identifying key functions according to the functional modules, providing a message interface for the outside and reminding abnormal conditions.
Analyzing and processing the repeatedly called modules to generate test reports, labeling the test reports in a weighted mode, classifying and storing abnormal data test cases according to the modules, facilitating statistics and analysis in later period, and displaying related data in an ECharts chart mode. The method can automatically execute the test case and generate a test report. It can monitor the progress and results of test execution and provide real-time feedback and reporting.
Example 2
The present disclosure provides an electronic device including: a memory storing executable instructions; and the processor runs the executable instructions in the memory to realize the system unit testing method based on the machine learning algorithm.
An electronic device according to an embodiment of the present disclosure includes a memory and a processor.
The memory is for storing non-transitory computer readable instructions. In particular, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM) and/or cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like.
The processor may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities, and may control other components in the electronic device to perform the desired functions. In one embodiment of the present disclosure, the processor is configured to execute the computer readable instructions stored in the memory.
It should be understood by those skilled in the art that, in order to solve the technical problem of how to obtain a good user experience effect, the present embodiment may also include well-known structures such as a communication bus, an interface, and the like, and these well-known structures are also included in the protection scope of the present disclosure.
The detailed description of the present embodiment may refer to the corresponding description in the foregoing embodiments, and will not be repeated herein.
Example 3
Embodiments of the present disclosure provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the machine learning algorithm based system unit testing method.
A computer-readable storage medium according to an embodiment of the present disclosure has stored thereon non-transitory computer-readable instructions. When executed by a processor, perform all or part of the steps of the methods of embodiments of the present disclosure described above.
The computer-readable storage medium described above includes, but is not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or removable hard disk), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).
It will be appreciated by persons skilled in the art that the above description of embodiments of the application has been given for the purpose of illustrating the benefits of embodiments of the application only and is not intended to limit embodiments of the application to any examples given.
The foregoing description of embodiments of the application has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the various embodiments described.

Claims (10)

1. A system unit testing method based on a machine learning algorithm, comprising:
establishing a machine learning Neuroph tool library, training and testing initial data through a multi-layer assembly neural network, and establishing an initial model;
analyzing the logic and structure of the codes, and generating new test cases according to the initial model;
executing a new test case, recording actual output, comparing the actual output with corresponding expected output, and adjusting the initial model;
and classifying and sorting the new test cases according to the comparison result to generate a test report.
2. The machine learning algorithm based system unit testing method of claim 1, wherein the initial data includes inputs and expected outputs of known test cases.
3. The system unit testing method based on the machine learning algorithm according to claim 2, wherein the input of the known test case is substituted into the multi-layer assembled neural network, output prediction is performed, comparison is performed with the expected output, training and testing are performed on the multi-layer assembled neural network, and the trained neural network is the initial model.
4. The machine learning algorithm based system unit testing method of claim 1, further comprising:
and according to the complexity, importance and historical defect data factors of the codes, assigning priorities to the test cases, and ensuring that the important test cases obtain higher test coverage rate.
5. The machine learning algorithm based system unit testing method of claim 1, further comprising:
by learning normal code behavior, detecting anomalies or errant behavior, analyzing patterns and behavior during code execution, and identifying potential errors or anomalies.
6. The machine learning algorithm based system unit testing method of claim 1, further comprising:
analyzing the test results and the code coverage data to identify error prone areas.
7. The machine learning algorithm based system unit testing method of claim 1, wherein the sort comprises:
and analyzing and processing the repeatedly called modules, marking in a weighted mode, and storing the abnormal data test cases according to the module classification so as to carry out statistics and analysis.
8. The machine learning algorithm-based system unit testing method of claim 1, wherein the test report is presented by means of an ECharts chart.
9. An electronic device, the electronic device comprising:
a memory storing executable instructions;
a processor executing the executable instructions in the memory to implement the machine learning algorithm based system unit testing method of any one of claims 1-8.
10. A computer readable storage medium, characterized in that it stores a computer program which, when executed by a processor, implements the machine learning algorithm based system unit testing method of any one of claims 1-8.
CN202311202582.7A 2023-09-18 2023-09-18 System unit testing method based on machine learning algorithm, electronic equipment and medium Pending CN117234919A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311202582.7A CN117234919A (en) 2023-09-18 2023-09-18 System unit testing method based on machine learning algorithm, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311202582.7A CN117234919A (en) 2023-09-18 2023-09-18 System unit testing method based on machine learning algorithm, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN117234919A true CN117234919A (en) 2023-12-15

Family

ID=89090610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311202582.7A Pending CN117234919A (en) 2023-09-18 2023-09-18 System unit testing method based on machine learning algorithm, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN117234919A (en)

Similar Documents

Publication Publication Date Title
CN105955889B (en) A kind of graphical interfaces automated testing method
US20210279577A1 (en) Testing of Computing Processes Using Artificial Intelligence
Ceylan et al. Software defect identification using machine learning techniques
US7451051B2 (en) Method and system to develop a process improvement methodology
CN107025170A (en) For the system and method for the test case augmentation of the automation based on covering designed a model
US11544176B1 (en) Systems and methods for automatically assessing and conforming software development modules to accessibility guidelines in real-time
CN103814373A (en) Automatic classification adjustment of recorded actions for automation script
CN115687115A (en) Automatic testing method and system for mobile application program
Efendioglu et al. Bug prediction of systemc models using machine learning
CN117435505B (en) Visual generation method of performance test script
Bons et al. Scripted and scriptless GUI testing for web applications: An industrial case
CN107704389B (en) Page testing method and device
US10546080B1 (en) Method and system for identifying potential causes of failure in simulation runs using machine learning
JP7190246B2 (en) Software failure prediction device
CN117234919A (en) System unit testing method based on machine learning algorithm, electronic equipment and medium
Abdulwareth et al. Toward a multi-criteria framework for selecting software testing tools
Jenkins A software testing primer
CN112817863B (en) AI-aided automatic test method and system based on AI deep learning
CN113157556A (en) Industry building software defect management method based on selected principal component identification
Honsel et al. Developer Oriented and Quality Assurance Based Simulation of Software Processes.
CN110032624A (en) A kind of screening sample method and device
CN113094095B (en) Agile development progress determining method and device
US11928047B2 (en) Contextual data generation for application testing in mixed reality simulations
WO2023033782A1 (en) Method and system for testing functionality of a software program using digital twin
Bons et al. Evaluating the complementarity of scriptless and scripted testing in industry: A case study

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination