Method for automated analysis of software testing

Through automated test leakage analysis and machine learning model generation of test cases, it solves the problem of difficulty in identifying internal defects with traditional software testing methods, achieves more comprehensive and efficient software testing, and ensures software quality and productivity.

CN118642940APending Publication Date: 2024-09-13ROBERT BOSCH GMBH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410277857.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-03-13
Filing Date
2024-03-12
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Traditional software testing methods are difficult to fully identify internal defects and errors in software, resulting in the inability to fully find and repair potential sources of errors.

Method used

Adopt an automated approach by identifying error logs and test logs, conduct test leakage analysis based on machine learning, generate test cases suitable for reproducing error execution, and use machine learning models such as neural networks to optimize test cases to identify and fix errors.

Benefits of technology

It improves test coverage and software quality, reduces the workload of identifying test leaks, implements smarter automated testing, ensures that software can effectively identify and repair errors when functions change, and improves software reliability and productivity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642940A
    Figure CN118642940A
Patent Text Reader

Abstract

The invention relates to a method (100) for automated analysis of a software test of software, comprising the following steps:-determining an error log (50) regarding an error execution of the software, the error log (50) specifying an execution context of the error execution; determining a test log (60) generated from the execution of a software test of the software, the execution being prior to an erroneous execution of the software, where the software test comprises a plurality of existing test cases (70) by which various functions of the software are tested, where the test log (60) specifies a respective execution context of the existing test cases (70); -performing an evaluation of the test log (60) based on the error log (50), the evaluation being performed based on a similarity of an execution context of the error execution to a corresponding execution context of the existing test case (70), the evaluation being performed based at least in part on machine learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for automated analysis of software testing and also to a computer program, a device and a storage medium for the purpose. Background Art

[0002] It is known that within the framework of software testing, automated execution of test cases can be provided. Test cases can be checks that check the reaction of a software system to unexpected or erroneous inputs. These tests are particularly intended to identify potential sources of errors in the software that lead to crashes or unexpected behavior.

[0003] Automation of software testing has proven useful for achieving improved test coverage and thereby improved software production. It is known that methods for automating test patterns can be used. Various testing methods and techniques can find errors or defects in the implemented software during the entire software testing life cycle. Here, test leakage analysis (English Test leakage analysis) methods can help find problems that transfer from one test phase to the next test phase, and thus the effectiveness of the test can be determined.

[0004] However, it is conceivable that certain defects or errors exist in the innermost layers of the software, so that traditional testing methods may not be able to find and identify all errors and defects. Summary of the invention

[0005] The subject matter of the invention is a method having the features of claim 1, a computer program having the features of claim 8, a device having the features of claim 9 and a computer-readable storage medium having the features of claim 10. Further features and details of the invention are derived from the respective dependent claims, the description and the drawings. Features and details described in connection with the method according to the invention naturally also apply in connection with the computer program according to the invention, the device according to the invention and the computer-readable storage medium according to the invention, and vice versa, respectively, so that the disclosure of the individual inventive aspects always refers to one another or can refer to one another.

[0006] The subject matter of the invention is in particular a method for automated analysis of software tests of software, the method comprising the following method steps, which are preferably performed automatically and / or repeatedly and / or with the aid of a computer:

[0007] - determining an error log about an erroneous execution of the software, wherein the error log preferably specifies the execution context of the erroneous execution, preferably in the following way: the error log indicates at least one called function and / or input value and / or execution environment and / or output of the software at that time and / or output as a prerequisite and / or output as a result of the erroneous execution;

[0008] - determining test logs generated from the execution of software tests of the software, the execution being in particular before an erroneous execution of the software, wherein the software tests may include a plurality of existing test cases, by means of which various functions of the software may be tested, wherein the test logs specify the respective execution contexts of the existing test cases, preferably in the following manner: the test logs indicate at least one called function and / or input value and / or execution environment and / or output of the software at that time and / or output as a prerequisite and / or output as a result of the execution of the test cases;

[0009] - Based on the error log, an evaluation of the test logs is performed, wherein the evaluation is preferably performed based on a similarity between an execution context of the error execution and a corresponding execution context of the existing test cases.

[0010] This makes it possible in particular to automatically perform a test leakage analysis. It can also be provided that the evaluation is performed at least in part based on machine learning. Therefore, the idea of ​​the present invention can be that the capabilities of machine learning (ML) can be used in an automated manner to support test leakage analysis. Thereby, the following advantages are achieved: the workload in identifying test leaks (English test leakages) can be reduced. Here, the method can also support that these tests can become more comprehensive and more mature. The use of AI (KI, artificial intelligence) can achieve: learning from the identified errors or defects through AI, producing more demanding software and creating smarter automated tests.

[0011] Test cases are an important part within the framework of software testing and are used to ensure that the software runs without errors and reliably. Here, test cases for software testing can be defined by specific instructions and / or by a set of steps. The instructions and / or these steps can describe: what is to be tested, especially the functions of the software; and / or how to test it; and / or what results are expected. To this end, test objectives can be specified for test cases, and test conditions can be specified. In addition, it is possible to define, especially step by step, what is to be tested for the test case, including the actions that must be performed in order to achieve the test objectives. Then, the expected results of the test case can be specified. However, in practice, if the function undergoes a code change that affects the parameters used to identify the function, errors often occur in such test cases. Examples of such changes are: changes in name parameters, changes in the type of an object, or changes in a parent container. If the function has changed, the identification of the element may fail, and the test may also perform unexpected actions, which may lead to a series of errors. Traditionally, the adjustment and maintenance of such changes require a lot of research, updates, and repetition of continuous tests in order to verify the revised test cases.

[0012] It is also possible that in the method according to the invention, based on the evaluation performed, test cases suitable for reproducing the erroneous execution are generated. In other words, new test cases can be generated which are suitable for reproducing the erroneous execution compared to the existing test cases. The generation of test cases can be carried out, for example, by a machine learning model trained for this. This has the advantage that the consideration of the similarity of the execution context can be automatically trained by machine learning in order to generate test cases on this basis which are still missing for a comprehensive check of the software in software testing.

[0013] The execution context may include, in particular, information indicating the context of the input and / or output of the software and, if necessary, other execution conditions when executing the software according to the test case or when the software is executed incorrectly. For this purpose, the execution context may be indicated, for example, by a log of the input and / or output of the software.

[0014] In another possibility, provision can be made that the generated test case is based on at least one of these existing test cases, wherein preferably for the generation the following steps are performed:

[0015] - identifying at least one of the existing test cases whose execution context has the greatest similarity to the execution context of the erroneous execution, preferably by means of a machine learning model such as a neural network trained therefor;

[0016] - adapting the identified at least one test case such that the test case is suitable for reproducing the erroneous execution.

[0017] The adjustment can be made by changing the parameterization of the test case. Within the framework of the test case, the software can be checked, for example, by executing the software according to the parameterization of the test case. For this purpose, for example, the parameterization can be used to predetermine which functions are to be executed with which parameter values. In this case, for example, it can also be predetermined which elements of the user interface of the software are to be activated. The reaction of the software can then be evaluated, error states can be detected, and the software can thereby be checked for unexpected or incorrect inputs.

[0018] According to another possibility, it can be provided that the following steps are performed:

[0019] -Execute the generated test cases;

[0020] - Checking whether the erroneous execution of the software is reproduced or not by executing the generated test case;

[0021] - adjusting the software so that errors leading to erroneous execution of the software are eliminated in the program code of the software and / or integrating the generated test cases into the testing process.

[0022] It can also be provided that a generative machine learning model, preferably a neural network, is provided in order to perform the evaluation within the framework of the method according to the invention and preferably in order to generate test cases suitable for reproducing the erroneous execution based on the determined errors and test logs. Here, the machine learning model can have at least one of the following network architectures: variational autoencoder, generative adversarial network, autoregressive model. This can, for example, use machine learning (ML) in order to derive which steps were previously performed with the relevant configuration in association with serious defects or errors. It can also be achieved that potential improvements in the test suite for software testing are suggested. The proposed solution is based in particular on analyzing the logs (English logs) provided when serious errors occur, using machine learning algorithms, in comparison with logs stored from previous test activities.

[0023] Within the framework of the present invention, it can be provided that the machine learning model is trained or has been trained by the following steps:

[0024] - determining training data, wherein the training data may include example error logs for various erroneous executions of the software and example test logs for software tests of the software, wherein, preferably, test cases of the software tests are not suitable for reproducing the erroneous executions, and wherein the training data include annotation data specifying test cases suitable for reproducing the erroneous executions;

[0025] - Initialize the weights of the machine learning model;

[0026] -Performing a training process to optimize the weights of the machine learning model based on the training data, wherein the training process uses a loss function that minimizes the difference between data generated by the machine learning model and the annotated data.

[0027] Optionally, it is also conceivable that: in the method according to the present invention, when the evaluation is repeatedly performed, continuous learning of the machine learning model is provided, preferably based on the error and test logs determined here, preferably by retraining and / or by incremental learning, in which retraining the determined error and test logs are included in the training data.

[0028] The subject of the invention is also a computer program, in particular a computer program product, which includes instructions which, when executed by a computer, cause the computer to carry out the method according to the invention. The advantages brought about by the computer program according to the invention are thus the same as those already described in detail with respect to the method according to the invention.

[0029] The subject matter of the invention is also a data processing device which is set up to carry out the method according to the invention. For example, a computer can be provided as the device, which executes the computer program according to the invention. The computer can have at least one processor for executing the computer program. A non-volatile data memory can also be provided, in which the computer program can be stored and from which the processor can read the computer program for execution.

[0030] The subject of the invention may also be a computer-readable storage medium having a computer program according to the invention and / or comprising instructions which, when executed by a computer, cause the computer to carry out the method according to the invention. The storage medium is designed, for example, as a data memory, such as a hard disk and / or a non-volatile memory and / or a memory card. The storage medium may be integrated, for example, into the computer.

[0031] Furthermore, the method according to the invention can also be implemented as a computer-implemented method. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Other advantages, features and details of the present invention are apparent from the following description, in which embodiments of the present invention are described in detail with reference to the accompanying drawings. The features mentioned in the claims and in the description may reflect the essence of the invention individually or in any combination.

[0033] in:

[0034] Figure 1 Schematic visualizations of methods, apparatuses, storage media, and computer programs according to embodiments of the present invention are shown.

[0035] Figure 2 Another schematic diagram shows details of a method according to an embodiment of the invention. DETAILED DESCRIPTION

[0036] exist Figure 1 , a method 100, an apparatus 10, a storage medium 15 and a computer program 20 according to an embodiment of the present invention are schematically shown. Figure 1 The method steps for automating the analysis of software testing of software are also explained. According to the first method step 101, an error log 50 about the erroneous execution of the software can be determined. Here, the error log 50 can specify the execution context of the erroneous execution. Then, according to the second method step 102, the determination of the test log 60 can be provided. These test logs 60 can be generated from the execution of the software test of the software, which is executed before the erroneous execution of the software. These software tests can include a plurality of existing test cases 70, through which various functions of the software are tested. Here, these test logs 60 can specify the corresponding execution contexts of these existing test cases 70. The execution context can be understood in particular as: indicating the context of the input and / or output of the software when the software is executed according to the test case or when the erroneous execution, and other execution conditions when necessary. Then, according to the third method step 103, an evaluation of these test logs 60 based on the error log 50 can be provided, wherein the evaluation 103 is performed based on the similarity of the execution context of the erroneous execution with the corresponding execution contexts of these existing test cases 70. The evaluation 103 can be performed at least partially based on machine learning. This can also be achieved by generating a test case 70 based on the evaluation 103, which is suitable for reproducing the erroneous execution, wherein the test case 70 is preferably generated by a machine learning model 80 trained for this purpose.

[0037] Test cases are one of the important elements of software testing in particular. Here, a test case may represent the conditions under which the system to be tested is executed in order to find errors (bugs in English). If the test case finds an error, the test is considered successful. The occurrence of errors or defects means that the tests performed are insufficient and have some leaks (leakages in English). Therefore, it must be ensured that these errors or defects do not occur again; and that these software tests are improved by closing the leaks found. The goal of an embodiment of the present invention may be to implement a machine learning method (ML) into a test automation suite in order to check what can be improved in these software tests for each serious defect or error.

[0038] It can be provided that for each new serious defect or error, it is first ensured that: when the defect or error occurs, a log with information about the defect or error and / or the execution of the software is provided. The provided log can then be compared with the log that has been recorded from previous testing activities and analyzed. For this purpose, a machine learning algorithm can be used. The analysis can lead to the conclusion that the already defined test cases can be improved. It can also be determined in what way the test case can be improved, for example with regard to the configuration and / or parameter settings of the test case, etc. It is also possible to determine suggestions for new test cases based on the analysis, in particular based on a series of already defined basic test steps. In addition, the following notification can be output to the software tester: it is not possible to make suggestions for new test improvements or to create new test cases, and manual interaction is required to define the subsequent steps for improving the test.

[0039] In addition, according to the above steps, test scripts can be automatically generated. Strategies for creating new tests or improving existing tests are based on data mining artificial intelligence (AI, KI) algorithms of logs provided with serious errors or defects. For example, with the help of AI-ML algorithms, values ​​for creating new tests or for improving defined test paths can be determined directly from these logs. The advantage of this method is that it can ensure that any reported errors will not reappear in any application scenario, which will improve the effectiveness and efficiency of the entire testing activity.

[0040] In order to train the machine learning model 80 for the generation of the evaluation and / or the test case, training data can be provided first. In these training data, multiple test logs can be provided as input data and related annotation data. In the annotation data, these logs can be correctly assigned to previous test cases for exemplary determination and / or design situations. The machine learning model 80 can, for example, include at least one artificial neural network, such as a convolutional neural network (Convolutional Neural Network or CNN in English). Another possibility is to use a recurrent neural network (RNN), which is particularly suitable for processing sequences such as text or time series. For example, training can be performed by means of back propagation and / or supervised learning (Supervised Learning) to adjust the weights in the artificial neural network in this way. The model 80 is trained on these training data, for example, in a manner that the model makes predictions based on the input data, and then adjusts the weights by means of back propagation to achieve a better match with the annotation data. For example, the match can be checked by means of a loss function. For example, the mean square error (MSE), preferably the categorical cross-entropy (Categorical Cross-Entropy), is used as the loss function. Here, the ReLU activation function can also be used for the hidden layer and the Softmax activation function can be used for the output layer.

[0041] Figure 2 An embodiment of the present invention in which an adaptive method is used is explained. According to step 201, it is first checked whether these logs indicate serious errors or defects and should therefore be regarded as error logs. Then, according to step 202, it can be checked with the help of a machine learning algorithm whether the test sequence in the provided log is contained in the log of the previous test activity. According to step 203, if so, tests similar to the tests performed in the provided log can be identified. According to step 204, if not, new tests can be created based on the indicated test steps. According to step 205, the execution of the updated test or the newly created test can be provided to ensure the reproduction of the error or defect. According to step 206, the code changes required to eliminate the error or defect can be initiated. According to step 207, the automatically adjusted test or the newly created test can be integrated into the test artifact or test suite.

[0042] The above description of the embodiments only describes the present invention within the framework of examples. Of course, as long as it is technically reasonable, the various features of these embodiments can be freely combined with each other without departing from the protection scope of the present invention.

Claims

1. A method (100) for automating the analysis of software testing of software, the method comprising the following steps: - determining (101) an error log (50) regarding an erroneous execution of the software, wherein the error log (50) specifies an execution context of the erroneous execution; - determining (102) a test log (60) generated from an execution of a software test of the software, the execution being before the erroneous execution of the software, wherein the software test comprises a plurality of existing test cases (70) by which various functions of the software are tested, wherein the test log (60) specifies a corresponding execution context of the existing test cases (70); - performing an evaluation (103) of the test log (60) based on the error log (50), wherein the evaluation (103) is performed based on a similarity between the execution context of the erroneous execution and a corresponding execution context of the existing test case (70), Wherein, the evaluating (103) is performed at least in part based on machine learning.

2. The method (100) according to claim 1, It is characterized in that Based on the evaluation (103), a test case (70) is generated which is suitable for reproducing the erroneous execution, wherein the test case (70) is preferably generated by a machine learning model (80) trained therefor.

3. The method (100) according to claim 2, It is characterized in that The generated test case (70) is based on at least one of the existing test cases (70), wherein for the generation the following steps are performed: - identifying at least one of the existing test cases (70) whose execution context has the greatest similarity to the execution context of the erroneous execution; - adapting at least one identified test case (70) such that said test case is suitable for reproducing said faulty execution, Preferably, the adjustment is performed by changing the parameterization of the test case (70).

4. The method (100) according to claim 2 or 3, It is characterized in that Perform the following steps: - executing the generated test cases (70); - Check: reproduce the erroneous execution of the software by executing the generated test case (70); - adjusting the software so that an error causing the erroneous execution of the software is eliminated in the program code of the software; and / or - Integrate the generated test cases (70) into the testing process.

5. The method (100) according to any one of the preceding claims, It is characterized in that A generative machine learning model (80), preferably a neural network, is provided to perform the evaluation (103) and preferably to generate test cases (70) suitable for reproducing the erroneous execution based on the determined errors and the test logs (50, 60), wherein the machine learning model (80) preferably has at least one of the following network architectures: variational autoencoder (VAE), generative adversarial network (GAN), autoregressive model.

6. The method (100) according to claim 5, It is characterized in that The machine learning model (80) is trained by the following steps: - determining training data, wherein the training data comprises example error logs for various erroneous executions of the software and example test logs for software tests of the software, wherein, preferably, test cases of the software tests are not suitable for reproducing the erroneous executions, and wherein the training data comprises annotation data specifying test cases suitable for reproducing the erroneous executions; - initializing the weights of the machine learning model (80); - performing a training process to optimize the weights of the machine learning model (80) based on the training data, wherein the training process uses a loss function that minimizes the difference between data generated by the machine learning model (80) and the annotation data.

7. The method (100) according to claim 5 or 6, It is characterized in that When the evaluation (103) is repeatedly performed, continuous learning of the machine learning model (80) is preferably provided based on the error and test logs (50, 60) determined therein, preferably by retraining and / or by incremental learning, wherein during the retraining the determined error and test logs (50, 60) are included in the training data.

8. A computer program (20) comprising instructions which, when executed by a computer (10), cause the computer to perform the method (100) according to any one of the preceding claims.

9. A data processing device (10) configured to carry out the method (100) according to any one of claims 1 to 7.

10. A computer-readable storage medium (15) comprising instructions which, when executed by a computer (10), cause the computer to perform the steps of the method (100) according to any one of claims 1 to 7.