Method and system for automatically testing user interface based on decision tree and neural network algorithm
Through the user interface automation testing method based on decision tree and neural network algorithm, the traditional test problems are solved, efficient and accurate user interface testing is achieved, and manual intervention and maintenance costs are reduced.
Patent Information
- Application Number
- CN202510333440.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-07-29
AI Technical Summary
Traditional user interface testing relies on low manual operation efficiency, error-prone and difficult to cover in full. The existing automation tools are poorly adaptable, resulting in high testing costs and long time, making it difficult to meet the needs of rapid iteration.
The user interface automation testing method based on decision tree and neural network algorithm is adopted to construct training data sets through data acquisition, cleaning and feature extraction, and the decision tree and deep neural network training model is used to generate user operation sequences and monitor test results, and the model is regularly updated to adapt to interface changes.
Improves testing efficiency and accuracy, reduces manual intervention and script maintenance costs, enhances testing flexibility and adaptability, and adapts to rapid user interface changes.
Smart Images

Figure CN120386723A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and particularly relates to a user interface automation testing method and system based on decision tree and neural network algorithms. Background Art
[0002] With the acceleration of the digitalization process, the software industry has shown explosive growth. As the core part of software-user interaction, the complexity of the design and functions of the user interface has increased sharply. From diverse interface layouts to rich interactive elements, the quality of the user interface directly affects the user experience and the market competitiveness of the software.
[0003] Traditional user interface testing mainly relies on manual operations. This method is inefficient. Testers need to spend a lot of time repeating test cases, and are prone to errors due to factors such as fatigue and human negligence. In addition, in the face of numerous complex test scenarios, manual testing is difficult to achieve comprehensive coverage, there is a risk of test loopholes, and it is impossible to effectively guarantee software quality. Although recent user interface automation testing tools have made some progress, there are still obvious deficiencies. They often require testers to write a large number of complex scripts, which not only puts high requirements on the programming ability of testers, but also consumes a lot of time and energy. Moreover, when the software user interface changes frequently or the requirements are adjusted, these tools have poor adaptability and require large-scale modification and maintenance of the scripts, increasing the test cost and time cost, and it is difficult to meet the needs of rapid iterative software development.
[0004] Therefore, in order to improve testing efficiency and enhance testing accuracy, it is necessary to provide a more efficient, intelligent and flexible user interface automation testing solution. Summary of the Invention
[0005] The present invention aims to overcome the deficiencies of the prior art and innovatively proposes a user interface automation testing method and system based on decision tree and neural network machine learning algorithms, thereby improving the efficiency and accuracy of user interface testing, effectively reducing the degree of manual intervention and the cost required for script maintenance, and bringing a more efficient, reliable and economical solution to the field of user interface testing.
[0006] A user interface automation testing method based on decision tree and neural network algorithms according to the present invention includes the following steps:
[0007] Step S1, data collection and preprocessing: Collect operation data on the user interface through an automated testing tool, including attribute information of user interface elements, user operation data and interface change situations, and perform cleaning, feature extraction and normalization processing on the data to construct a training data set;
[0008] Step S2, Model Training: Recursively partition the training data based on the decision tree algorithm, extract decision rules for classification or regression to form a decision tree model. Meanwhile, divide the training data set into a training set and a validation set, and use the deep neural network algorithm to optimize the training of the decision tree model to improve the prediction performance of the model;
[0009] Step S3, Test Execution: Use the trained user interface operation prediction model to generate a user operation sequence based on the input user interface feature information, and perform automated test operations on the user interface. Monitor the changes in the user interface during the test, compare the test results with the expected results of the model, and perform corresponding processing according to the comparison results;
[0010] Step S4, Model Update and Optimization: Update the training data set based on the newly added user interface test data, and use the incremental learning method to optimize the user interface operation prediction model to improve the adaptability and prediction accuracy of the model.
[0011] Furthermore, Step S1 includes the following steps:
[0012] Step S101: Select representative software applications covering multiple different industry fields and different user interface design styles;
[0013] Step S102: Use an automated test tool to simulate a user performing preset interaction operations on the user interface of the application;
[0014] Step S103: During the execution of the interaction operation, collect the attribute information of the user interface elements, the specific content of the user operation, and the changes in the user interface after the interaction operation through the application programming interface of the automated test tool;
[0015] Step S104: Store the collected data, and remove duplicate, invalid, or abnormal data records through a data cleaning algorithm to maintain the logical association before and after the collected test data and the hierarchical relationship of the elements, ensuring the integrity and consistency of the test data;
[0016] Step S105: Extract features from the cleaned data, convert the data into numerical feature vectors, perform normalization processing on the feature data, and then construct a training data set.
[0017] Furthermore, in Step S1:
[0018] The preset interaction operations include: user login, registration, information search, information browsing, form submission, file download;
[0019] The attribute information of the user interface elements includes: the identity identifier, name, type, and location of the elements;
[0020] Details of the user operations, including: operation type, operation parameters, and operation time;
[0021] Changes in the user interface after the operation, including: page jump, element display / hiding, and data update.
[0022] Further, step S2 includes the following steps:
[0023] Step S201: Recursively partition the training data set constructed in step S1 based on the decision tree algorithm, determine the decision path according to different values of data feature attributes, extract the rules for classification or regression, and form a basic decision tree model;
[0024] Step S202: Divide the preprocessed training data set into a training set and a validation set according to a preset ratio, and use the deep neural network algorithm to train the basic decision model to enhance the generalization ability and prediction performance of the model;
[0025] Step S203: During the model training process, use the training set to train the selected machine learning model, minimize the error function between the prediction result and the actual result by adjusting the model parameters, and use the validation set to evaluate the performance of the model, monitor the accuracy and recall rate indicators of the model. When the performance of the model on the validation set no longer improves, terminate the training and save the optimized model parameters to form a trained user interface operation prediction model.
[0026] Further, step S3 includes the following steps:
[0027] Step S301: Input the feature information of the user interface of the software application to be tested into the trained user interface operation prediction model;
[0028] Step S302: Based on the input feature information, the model generates a recommended user operation sequence and the corresponding expected results;
[0029] Step S303: Use the automated testing tool described in step S1 to sequentially execute operations on the user interface page according to the operation sequence generated by the model, and monitor the actual changes in the user interface after each operation;
[0030] Step S304: Compare the actual changes in the user interface with the results predicted by the model. If the two are consistent, continue to execute the next operation in step S303. If the two are inconsistent, record the abnormal information, including the operation steps, expected results, actual results, and the current state of the user interface, and pause the testing process for testers to analyze and debug.
[0031] Furthermore, step S4 includes the following steps:
[0032] Step S401: Regularly collect new user interface test data, including test data for newly developed software functions and test data generated after updating the user interface of existing software.
[0033] Step S402: Merge the newly collected data into the original training dataset, and retrain and optimize the model to improve the adaptability and prediction accuracy of the model for new user interfaces and user operations.
[0034] Step S403: In the model update process, adopt the incremental learning method to avoid retraining the complete dataset.
[0035] According to another aspect of the present invention, there is also provided a user interface automated test system based on decision tree and neural network algorithms, including:
[0036] Data acquisition module: Responsible for collecting operation data on different user interfaces, and preprocessing the collected data to provide data support for model training.
[0037] Model training module: Use decision tree and neural network algorithms to train the collected data to construct and optimize the user interface operation prediction model.
[0038] Test execution module: According to the output of the user interface operation prediction model, perform automated test operations on the user interface to be tested, and monitor and verify the test results.
[0039] Model update module: Regularly update the training dataset, and use the incremental learning method to retrain and optimize the user interface operation prediction model.
[0040] Compared with the prior art, the present invention has the following remarkable advantages:
[0041] 1. Improve test efficiency: Automatically generate test cases and operation sequences through the machine learning model, greatly reducing the time and workload of manual script writing, and enabling rapid testing of a large number of UI interfaces, thereby improving test efficiency.
[0042] 2. Enhance test accuracy: The machine learning-based model can learn the characteristics of various UI interfaces and the patterns of user operations, thus more accurately predicting and executing test operations, and reducing test errors caused by human negligence or misoperation.
[0043] 3. Strong adaptability: It can automatically adapt to changes and updates of the UI interface, without the need to frequently modify test scripts, reducing maintenance costs, and improving the flexibility and scalability of testing. Description of the Drawings
[0044] Figure 1 is a schematic flowchart of a user interface automated testing method based on decision tree and neural network algorithms provided by an embodiment of the present invention.
[0045] Figure 2 is an example diagram of splitting functions in a system for user interface automated testing based on decision tree and neural network algorithms provided by an embodiment of the present invention.
[0046] Figure 3 is a schematic flowchart of step S1: data collection and preprocessing of the present invention.
[0047] Figure 4 is a schematic flowchart of the operation of the test execution module of the present invention. Detailed Description of the Invention
[0048] The following will describe in detail the specific embodiments of the present invention with reference to the accompanying drawings. As Figure 1 shown in the preferred embodiment of the present invention, it includes the following steps:
[0049] Step S1, data collection and preprocessing: Collect operation data on the user interface through an automated testing tool, including attribute information of user interface elements, user operation data, and interface change situations, and perform cleaning, feature extraction, and normalization processing on the data to construct a training data set;
[0050] Step S2, model training: Recursively partition the training data based on the decision tree algorithm, extract decision rules for classification or regression to form a basic decision tree model. At the same time, divide the training data set into a training set and a validation set, and use the deep neural network algorithm to optimize and train the decision tree model to improve the prediction performance of the model;
[0051] Step S3, test execution: Use the trained user interface operation prediction model to generate a user operation sequence based on the input user interface feature information, perform automated test operations on the user interface, monitor the change situation of the user interface during the test, compare the test results with the expected results of the model, and perform corresponding processing according to the comparison results;
[0052] Step S4, model update and optimization: Update the training data set based on the newly added user interface test data, and use the incremental learning method to optimize the user interface operation prediction model to improve the adaptability and prediction accuracy of the model.
[0053] As Figure 3 shown, step S1 specifically includes the following steps:
[0054] Step S101: Select representative software applications that cover multiple different industry fields and different user interface design styles;
[0055] Step S102: Use automated testing tools such as Selenium, Appium, etc. to simulate users performing preset interaction operations on the user interface of the application, including but not limited to common operation scenarios such as logging in, registering, browsing information, submitting forms, etc.;
[0056] Step S103: During the execution of the interaction operations, collect the attribute information of the user interface elements through the application programming interface of the automated testing tool, such as the element's authentication information, name, type, location, etc., the specific content of the user operation, such as the operation type, operation parameters, operation time, etc., and the changes in the user interface after the interaction operation, such as page jumps, element display and hiding, data updates, etc.;
[0057] Step S104: Store the collected data, and remove duplicate, invalid or abnormal data records through data cleaning algorithms, maintaining the logical association before and after the collected test data and the hierarchical relationship of the elements to ensure the integrity and consistency of the test data;
[0058] Step S105: Extract features from the cleaned data, convert the data into numerical feature vectors, and perform normalization processing on the feature data so that data with different features have the same scale and distribution for subsequent model training, and then construct a training dataset.
[0059] Step S2: Build and train a user interface operation prediction model based on the training dataset constructed in Step S1, which specifically includes the following steps:
[0060] Step S201: Recursively partition the training dataset constructed in Step S1 based on the decision tree algorithm, determine the decision path according to different values of the data feature attributes, extract the rules for classification or regression, and form a basic decision tree model;
[0061] Step S202: Divide the preprocessed training dataset according to a preset ratio into a training set and a validation set, such as 80% of the data as the training set and 20% of the data as the validation set, and use the backpropagation neural network algorithm to train the basic decision model to enhance the generalization ability and prediction performance of the model;
[0062] Step S203: During the model training process, use the training set to train the selected machine learning model. By adjusting the model's parameters, such as the weights and biases of the neural network, minimize the error function between the predicted result and the actual result, and use the validation set to evaluate the performance of the model. Monitor the accuracy and recall metrics of the model. When the performance of the model on the validation set no longer improves, terminate the training and save the optimized model parameters to form a trained user interface operation prediction model.
[0063] Based on the user interface operation prediction model trained in Step S2, further perform tests on the user interface of the software application to be tested, which specifically includes the following steps:
[0064] Step S301: Input the feature information of the user interface of the software application to be tested into the trained user interface operation prediction model;
[0065] Step S302: Based on the input feature information, the model generates a recommended user operation sequence and the corresponding expected result;
[0066] Step S303: Use the automated testing tool described in Step S1 to sequentially perform operations on the user interface page according to the operation sequence generated by the model, and after each operation is executed, monitor the actual changes of the user interface;
[0067] Step S304: Compare the actual changes of the user interface with the results predicted by the model. If the two are consistent, continue to perform the next operation in Step S303. If the two are inconsistent, record the abnormal information, including the operation steps, expected results, actual results, and the current state of the user interface, and pause the testing process for testers to analyze and debug.
[0068] Finally, Step S4 is used to continuously update and optimize the user interface operation prediction model of the present invention, which specifically includes the following steps:
[0069] Step S401: Regularly collect new user interface test data, which can come from the testing of newly developed software functions or the test data generated after updating the user interface of existing software;
[0070] Step S402: Merge the newly collected data into the original training dataset and retrain and optimize the model to improve the adaptability and prediction accuracy of the model to new user interfaces and user operations;
[0071] Step S403: In the model update process, adopt the incremental learning method to avoid retraining the entire dataset, thereby improving the training efficiency and reducing the consumption of computing resources.
[0072] As Figure 2 shown, the present invention provides a user interface automated testing system based on decision tree and neural network algorithms. The system includes a data acquisition module, a model training module, a test execution module, and a model update module to implement the entire process of automated testing.
[0073] The data acquisition module is used to collect operation data on the user interface, including attribute information of user interface elements, user operation data, and interface change situations. The collected data is stored and preprocessed. The data cleaning algorithm is used to remove redundant, invalid, or abnormal data, while maintaining the logical relevance of the interactive script data before and after and the hierarchical relationship of user interface elements. After feature extraction and normalization processing, it is converted into a numerical feature vector, and a training data set is constructed to provide data support for model training.
[0074] The model training module recursively partitions the training data set based on the decision tree algorithm, constructs a tree-structured model, and extracts decision rules for classification or regression to form a basic decision model. Subsequently, the training data set is divided into a training set and a validation set according to a preset ratio, and the deep neural network algorithm is used to optimize and train the basic decision model to improve the generalization ability and prediction performance of the model. During the training process, the model training module uses the training set to optimize the model, minimizes the prediction error by adjusting the model parameters, and uses the validation set to evaluate the model performance. Key indicators including accuracy and recall are monitored. When the performance on the validation set no longer improves, the training is terminated and the optimized model parameters are saved to form a user interface operation prediction model.
[0075] The test execution module is responsible for performing automated test operations on the user interface to be tested according to the trained user interface operation prediction model. As Figure 4 shown, first, the test execution module extracts the feature information of the user interface page and inputs it into the prediction model. The model generates a recommended user operation sequence and the corresponding expected results based on the input feature information. Subsequently, the test execution module sequentially performs automated test operations on the user interface according to the operation sequence, including but not limited to simulating mouse click operations, simulating keyboard input operations, etc. After each operation is executed, the test execution module monitors the actual change situation of the user interface and compares the change situation with the expected results predicted by the model. If the two are consistent, the subsequent operations are continued. If the two are inconsistent, the abnormal information, including the operation steps, expected results, actual results, and the current state of the page, is recorded, and the test process is paused for testers to analyze and debug.
[0076] The model update module is used to regularly update the user interface operation prediction model to maintain its adaptability and prediction accuracy for newly added user interfaces and user operations. The model update module regularly collects new user interface test data, including test data for newly developed software functions and test data generated after user interface updates. The data is merged into the original training dataset, and during the model update process, an incremental learning method is used to optimize the user interface operation prediction model to avoid retraining the entire dataset, improve training efficiency, and reduce computational resource consumption.
[0077] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A user interface automated testing method based on decision tree and neural network algorithms, characterized in that It includes the following steps: Step S1, data collection and preprocessing: Collect operation data on the user interface through an automated testing tool, including the attribute information of user interface elements, user operation data, and interface change situations. Clean, extract features, and normalize the data to construct a training dataset; Step S2, model training: Recursively partition the training data based on the decision tree algorithm, extract decision rules for classification or regression to form a basic decision tree model. At the same time, divide the training dataset into a training set and a validation set, and use the deep neural network algorithm to optimize the training of the decision tree model to improve the prediction performance of the model; Step S3, test execution: Use the trained user interface operation prediction model to generate a user operation sequence based on the input user interface feature information, and perform automated test operations on the user interface. Monitor the change situation of the user interface during the test, compare the test results with the expected results of the model, and perform corresponding processing according to the comparison results; Step S4, model update and optimization: Update the training dataset based on the newly added user interface test data, and use the incremental learning method to optimize the user interface operation prediction model to improve the adaptability and prediction accuracy of the model.
2. The user interface automated testing method based on decision tree and neural network algorithms according to claim 1, wherein Step S1 includes the following steps: Step S101: Select representative software applications covering multiple different industry fields and different user interface design styles; Step S102: Use an automated testing tool to simulate a user performing preset interaction operations on the user interface of the application; Step S103: During the execution of the interaction operation, collect the attribute information of user interface elements, the specific content of user operations, and the change situation of the user interface after the interaction operation through the application programming interface of the automated testing tool; Step S104: Store the collected data, and remove duplicate, invalid, or abnormal data records through a data cleaning algorithm to maintain the logical association before and after the collected test data and the hierarchical relationship of elements, ensuring the integrity and consistency of the test data; Step S105: Extract features from the cleaned data, convert the data into numerical feature vectors, normalize the feature data, and then construct a training dataset.
3. The user interface automated testing method based on decision tree and neural network algorithms according to claim 2, characterized in that In Step S1: The preset interaction operations include: user login, registration, information search, information browsing, form submission, file download; The attribute information of the user interface elements includes: element identification, name, type, location; The detailed information of the user operation includes: operation type, operation parameters, operation time; The change situation of the user interface after the operation includes: page jump, element display / hide, data update.
4. The user interface automation testing method based on decision tree and neural network algorithms according to claim 1, characterized in that, Step S2 includes the following steps: Step S201: Recursively partition the training dataset constructed in Step S1 based on the decision tree algorithm, determine the decision path according to different values of data feature attributes, extract rules for classification or regression, and form a basic decision tree model; Step S202: Divide the preprocessed training data set into a training set and a validation set according to a preset ratio, and use a deep neural network algorithm to train the basic decision model to enhance the generalization ability and prediction performance of the model; Step S203: During the model training process, use the training set to train the selected machine learning model, minimize the error function between the prediction result and the actual result by adjusting the model parameters, and use the validation set to evaluate the performance of the model, monitor the accuracy and recall rate indicators of the model. When the performance of the model on the validation set no longer improves, terminate the training and save the optimized model parameters to form a trained user interface operation prediction model.
5. The user interface automation testing method based on decision tree and neural network algorithms according to claim 1, characterized in that Step S3 includes the following steps: Step S301: Input the feature information of the user interface of the software application to be tested into the trained user interface operation prediction model; Step S302: Based on the input feature information, the model generates a recommended user operation sequence and the corresponding expected result; Step S303: Use the automated testing tool described in Step S1 to sequentially execute operations on the user interface page according to the operation sequence generated by the model, and monitor the actual changes of the user interface after each operation; Step S304: Compare the actual changes of the user interface with the results predicted by the model. If the two are consistent, continue to execute the next operation in Step S303. If the two are inconsistent, record the abnormal information, including the operation steps, expected results, actual results, and the current state of the user interface, and pause the testing process for testers to analyze and debug.
6. The user interface automated testing method based on the decision tree and neural network algorithms according to claim 1, wherein Step S4 includes the following steps: Step S401: Regularly collect new user interface test data, including test data for newly developed software functions and test data generated after updating the user interface of existing software; Step S402: Merge the newly collected data into the original training data set, and retrain and optimize the model to improve the adaptability and prediction accuracy of the model for new user interfaces and user operations; Step S403: In the model update process, adopt an incremental learning method to avoid retraining the complete data set.
7. A user interface automated testing system based on decision tree and neural network algorithms, characterized in that, including: Data acquisition module: Responsible for collecting operation data on different user interfaces and preprocessing the collected data to provide data support for model training; Model training module: Use decision tree and neural network algorithms to train the collected data to construct and optimize the user interface operation prediction model; Test execution module: Execute automated test operations on the user interface to be tested according to the output of the user interface operation prediction model, and monitor and verify the test results; Model update module: Regularly update the training data set and use the incremental learning method to retrain and optimize the user interface operation prediction model.