Access control case selection method and device, electronic equipment and storage medium
Through the combination of BP neural network and sparrow search algorithm, the automatic selection of access-disabled use cases is realized, the problem of time-consuming and inconsistent manual selection is solved, and the efficiency of software development and selection accuracy is improved.
Patent Information
- Application Number
- CN202411314275.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
The selection process of access-disabled use cases in existing software development relies on manual selection, which is time-consuming and cumbersome, easily affected by subjective factors, and difficult to maintain, resulting in inconsistent test coverage, waste of resources and difficult to maintain.
BP neural network is used to train through machine learning, combine the sparrow search algorithm to optimize the initialization weight and threshold range, realize the automated selection of access-disabled use cases, reduce manual intervention and improve selection efficiency.
It improves the accuracy and consistency of the selection of access-disabled use cases, reduces manual workload, improves software development efficiency, and avoids the problems of slow convergence speed, local optimal solution and overfitting during training.
Smart Images

Figure CN119166524A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of test cases, and in particular to a method, device, electronic device, and storage medium for selecting access control cases. Background Art
[0002] In the field of software development, testing is a key step to ensure the quality and stability of software products. Software testing can be achieved by constructing test cases.
[0003] Access control examples are an important part of the software testing process and are used to verify that the basic functionality of the application is working properly. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device, and storage medium for selecting access control examples to achieve automatic selection of access control examples.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for selecting a door ban example, wherein the method comprises:
[0007] Determine the characteristic parameters required for access control;
[0008] The characteristic parameters are input into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0009] In some embodiments, a preset algorithm is used in the process of machine learning to optimize the initialization weights and threshold ranges in the BP neural network, including:
[0010] Using the sparrow search algorithm as the preset algorithm to optimize the initialization weight and threshold range in the BP neural network;
[0011] The weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer are optimized based on the sparrow search algorithm.
[0012] In some embodiments, the optimization of the weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer based on the sparrow search algorithm includes:
[0013] Initialize the position and fitness of the sparrow population and start a cycle, wherein the sparrow population includes discoverers and joiners;
[0014] Calculate the fitness and sort the population according to the discoverer and the joiner to obtain the current optimal individual position of the sparrow and the optimal fitness value;
[0015] According to the current optimal individual sparrow position and the optimal fitness value, imitate the sparrow's foraging behavior, update the discoverer's position and update the joiner's position;
[0016] Imitate anti-predator behavior, update the scout's position and update the historical optimal fitness;
[0017] When the maximum number of iterations is reached, the optimal individual position and fitness value are output.
[0018] In some embodiments, the method further comprises:
[0019] Input the optimal individual position and fitness value into the BP neural network, and obtain the optimal weight and threshold range;
[0020] The weights and threshold range in the BP neural network are updated according to the optimal weights and threshold range.
[0021] In some embodiments, the determining of characteristic parameters required for the door ban example includes:
[0022] According to the demand planning specification and software application, the characteristic parameters required for the access control example are collected as test data.
[0023] In some embodiments, inputting the characteristic parameters into a pre-trained screening model to obtain the selection result of the access ban example includes:
[0024] Inputting function points, interfaces and code changes as the feature parameters into the pre-trained screening model;
[0025] Outputting a value of 0 or 1 according to the pre-trained screening model, wherein when the value is 0, it indicates that the test case is not selected into the access prohibition case, and when the value is 1, it indicates that the test case is selected into the access prohibition case;
[0026] The gated cases to be screened are the set of test cases whose output neuron value is 1.
[0027] In a second aspect, an embodiment of the present application further provides a testing method, in which the method for selecting access control examples described in the first aspect above is adopted.
[0028] In a third aspect, an embodiment of the present application further provides a device for generating a door ban example, wherein the device comprises:
[0029] A determination module, used to determine the characteristic parameters required for the door lock example;
[0030] A screening module is used to input the characteristic parameters into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained by machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0031] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the above method.
[0032] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the above method.
[0033] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: first, the characteristic parameters required for the access control example are determined, and then the characteristic parameters are input into the pre-trained screening model to obtain the selection result of the access control example. The screening model is obtained by machine learning training using a BP neural network, and a preset algorithm is used to optimize the initialization weights and threshold ranges in the BP neural network during the machine learning process. The above method uses a preset algorithm to optimize the weights and thresholds of the BP neural network. Compared with a single BP neural network, the above method can better avoid problems such as slow convergence, falling into a local optimal solution, and overfitting during the training process, thereby improving the effectiveness and accuracy of the selected use cases. In addition, the above method can automatically generate access control examples, thereby quickly completing the screening of access control examples without the influence of human subjective factors, thereby improving production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0035] Figure 1 A flowchart of a method for selecting a door ban example in an embodiment of the present application;
[0036] Figure 2 This is a schematic diagram of the access control example selection process in the embodiment of the present application;
[0037] Figure 3 This is a BP neural network structure diagram in the embodiment of this application;
[0038] Figure 4This is a schematic diagram of the optimization of the sparrow search algorithm in the embodiment of this application;
[0039] Figure 5 This is a schematic diagram of the structure of a device for generating a door ban example in an embodiment of the present application;
[0040] Figure 6 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0042] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0043] The test case in the embodiments of the present application specifically refers to: a detailed, executable test plan or test specification used to verify the correctness of a specific software function, feature or system. The test case contains the input data, operation steps and expected output results of the test, aiming to ensure that the software can run as expected under different circumstances.
[0044] The access control examples in the embodiments of the present application specifically refer to: consisting of some test cases in a test case set (a collection of test cases), and its main goal is to detect whether the software is usable, whether it can be started, and whether there are obvious errors and other issues. Only when all the access control examples of the software version package pass, will the development propose the test, and the test will accept the test. If major problems are found in the process, the test will usually stop further testing, because the software version with serious problems may be tested in depth.
[0045] Specifically, the access control examples include a series of test cases for key functions, modules or scenarios to ensure the basic operating capabilities of the software before release. However, in the existing software development process, the selection of access control examples is usually a time-consuming and tedious task, and the selection of access control examples has the following shortcomings:
[0046] (1) Manual selection: Access control cases are usually manually selected from the test case set by software test engineers. This process takes a lot of time and resources and is easily affected by human factors. It has a subjective problem: Manual selection of test cases is easily affected by the subjective views of testers. Different testers may choose different cases, which may lead to inconsistent test coverage.
[0047] (2) Difficulty in updating: As applications continue to evolve and update, access control examples also need to be updated and maintained accordingly. Manual maintenance of access control examples may lead to missed or incorrect tests. This has time and resource consumption issues: Manual selection of access control examples requires a lot of human resources.
[0048] (3) Resource waste: Manual selection and execution of access control cases requires a lot of human resources, which may lead to extended development cycles and increased costs. It has a limited coverage problem: manual selection usually only covers the functions that testers consider to be the most important, and may ignore some potential problems or less used functions, thereby reducing test coverage.
[0049] (4) Consistency issues: Different test engineers may select access control cases in different ways, which may easily lead to inconsistent test coverage. It is difficult to maintain: Once the software changes, manually selected test cases may need to be updated frequently, which will cause additional workload and possible omissions.
[0050] The embodiment of the present application provides a method for selecting access control examples, which is used to automatically select access control examples. The method will be able to improve the efficiency of software development, reduce manual workload, and ensure the consistency and accuracy of the selection results. The generation / selection method provided in the implementation of the present application can provide a powerful tool for the software development team, which helps to launch high-quality software products more quickly.
[0051] The present application embodiment provides a method for selecting a door ban example, such as Figure 1 As shown, a flow chart of a method for selecting a door ban example in an embodiment of the present application is provided, and the method at least includes the following steps S110 to S120:
[0052] Step S110, determining the characteristic parameters required for the door prohibition example.
[0053] Considering that the goal of access control testing is to verify whether the basic functions of the software are normal to ensure the stability of the software project. The selection process of access control examples used in related technologies relies heavily on manual selection. However, this method is very time-consuming and cumbersome for large software projects, so it is necessary to automatically select access control examples according to actual needs.
[0054] The characteristic parameters include, but are not limited to, function points, interfaces, and code changes. It can be understood that the function points, interfaces, and code changes are interrelated, and any change in any of them may affect the implementation of the corresponding function. For example, the change of function point a may affect the interface, which in turn may cause code changes. Similarly, when the code changes, it is also easy to cause interface changes and changes in function points. In the embodiments of the present application, function points, interfaces, and code changes are selected as characteristic parameters, and the corresponding access control examples can be automatically selected in the subsequent screening model.
[0055] Step S120, inputting the characteristic parameters into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained by machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0056] The input of the pre-trained screening model is the feature parameter input, and the output is the selection result of the access control examples, thereby effectively improving the standardization and quality of the access control examples and greatly reducing the workload of the manual selection of access control examples.
[0057] In the process of training the screening model, a large amount of relevant data information of access control cases can be extracted from the demand planning specifications and software applications, and the obtained data can be used to train the machine learning model.
[0058] Specifically, the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the process of machine learning to optimize the initialization weights and threshold ranges in the BP neural network. Compared with a single BP neural network, it can better avoid problems such as slow convergence, falling into local optimal solutions, and overfitting during the training process, thereby improving the effectiveness and accuracy of selecting use cases.
[0059] It should be noted that access control examples play an important role, which can be used to verify whether the key functions of the system are operating normally, determine whether the development can proceed with subsequent operations, etc. However, the existing access control examples are generally selected manually, and there are defects in this process, such as the selection of test cases is easily affected by the subjective factors of testers, consumes a lot of human resources, and is difficult to maintain.
[0060] By inputting the characteristic parameters into the pre-trained screening model, the pre-trained screening model can automatically select access control examples through data analysis and learning. In this machine learning (BP neural network model), there are problems such as slow convergence, falling into local optimal solutions, overfitting, and sensitive parameter selection during the training process. Therefore, a preset algorithm is used to optimize its more sensitive weights and thresholds. After the screening model training is completed, only the function points, interfaces, code changes and other information need to be input to automatically select the corresponding access control examples.
[0061] After obtaining the selection result of the access control example according to the output of the model, it is necessary to select the access control example, based on the trained machine learning model, automatically output the result according to the input conditions, and select the test case with the output value of 1 to form the access control example.
[0062] In addition, it also includes: automatic execution and analysis, automatically executing the selected access control cases and analyzing the test results. If the test case fails, the problem is reported to the development team.
[0063] Preferably, the screening model can also be optimized and fed back: the machine learning model is continuously optimized based on the test results.
[0064] Through the above method, the weights and thresholds of the BP neural network are optimized using a preset algorithm. After the model training is completed, the corresponding access control examples can be automatically selected by simply inputting information such as function points, interfaces, and code changes. Therefore, the above method can effectively improve the standardization and quality of access control examples, and greatly reduce the workload of manually selecting access control examples.
[0065] Different from the single BP neural network in the related technology, the above method can better avoid the problems of slow convergence, falling into the local optimal solution, overfitting, etc. in the training process, and improve the effectiveness and accuracy of the selected use cases. In addition, the above method can automatically generate access control examples, so that the access control example screening can be completed quickly without the influence of human subjective factors, thereby improving production efficiency.
[0066] In one embodiment of the present application, a preset algorithm is used in the process of machine learning to optimize the initialization weights and threshold ranges in the BP neural network, including: using a sparrow search algorithm as the preset algorithm to optimize the initialization weights and threshold ranges in the BP neural network; based on the sparrow search algorithm, optimizing the weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer.
[0067] In the process of BP neural network training, the weight threshold is updated by forward propagation data and error reverse transmission. It is necessary to obtain the initial weight and threshold in the model. The method in the related art is to adopt a randomization method to obtain the initial weight and threshold parameters. After selecting the initial parameters, the gradient descent algorithm uses the initial parameter value as the starting point to optimize and update the parameters. Since the random initial parameters may not be the optimal starting point, i.e., both accurate training and reliable prediction, the reliability and stability of the trained model are greatly affected by the initial random parameters. In order to find the optimal solution faster in the process of BP neural network training, the sparrow search algorithm is introduced to solve this problem.
[0068] In one embodiment of the present application, the weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer are optimized based on the sparrow search algorithm, including: initializing the position and fitness of the sparrow population, and starting a cycle, the sparrow population including discoverers and joiners; calculating the fitness and sorting the population according to the discoverers and the joiners, and obtaining the current optimal sparrow individual position and the optimal fitness value; according to the current optimal sparrow individual position and the optimal fitness value, imitating the sparrow foraging behavior, updating the discoverer position and updating the joiner position; imitating the anti-predator behavior, updating the scout position and updating the historical optimal fitness; when the maximum number of iterations is reached, outputting the optimal individual position and fitness value.
[0069] like Figure 4 As shown in the figure, the sparrow search algorithm optimizes the weights and thresholds between the input layer and the hidden layer of the BP neural network and the weights and thresholds between the hidden layer and the output layer. The implementation steps are as follows:
[0070] Step S1, initializing the position and fitness of the sparrow population, as well as the initial values of other parameters.
[0071] Step S2, start loop, iteration <N
[0072] Step S3, sorting the population to obtain the current optimal individual sparrow position and the optimal fitness value.
[0073] Step S4, imitate the foraging behavior of sparrows and update the finder's position.
[0074] Step S5, update the joiner's location.
[0075] Step S6, imitate anti-predator behavior and update the scout position.
[0076] Step S7, updating the historical optimal fitness.
[0077] Step S8, execute steps 3 to 7, and when the maximum number of iterations is reached, end the loop and output the optimal individual position and fitness value.
[0078] f=min(MSETrainSet,TestSet)
[0079] In the formula, TrainingSet and TestingSet are samples of the training set and the testing set, respectively. After optimization using the sparrow search algorithm, the smaller the fitness function value, that is, the smaller the mean square error MSE, the more accurate the training is and the better the prediction accuracy of the model is.
[0080] The method in the embodiment of the present application mainly involves two parts: optimization algorithm and machine learning. The machine learning model realizes the automatic selection of access control examples by analyzing and learning the data. However, the BP neural network model has problems such as slow convergence, falling into local optimal solutions, overfitting, and sensitive parameter selection during the training process. Therefore, the sparrow search algorithm is introduced to optimize its more sensitive weights and thresholds. After the model training is completed, only the function points, interfaces, code changes and other information need to be input to automatically select the corresponding access control examples.
[0081] In one embodiment of the present application, the method further includes: inputting the optimal individual position and fitness value into the BP neural network, and obtaining the optimal weight and threshold range; and updating the weight and threshold range in the BP neural network according to the optimal weight and threshold range.
[0082] like Figure 4 As shown, the optimal individual position and fitness value are input into the BP neural network, and the optimal weight and threshold range are obtained. Since the sparrow search algorithm is introduced to optimize the weights and thresholds to which it is more sensitive, the weights and threshold ranges in the BP neural network are updated according to the optimal weights and threshold ranges output by the sparrow search algorithm.
[0083] In one embodiment of the present application, determining the characteristic parameters required for the access control example includes: collecting the characteristic parameters required for the access control example as test data according to a demand planning specification and a software application.
[0084] The feature parameters required for the newly input access control example are the same as those in the training stage, and data collection and data preprocessing are required in the training stage.
[0085] Specifically, data collection refers to collecting test data from demand planning and software applications, including input and expected output. The input includes but is not limited to: function points, interfaces, code changes, and the output is: the selected access control examples.
[0086] Specifically, data preprocessing refers to data preprocessing that aims to make the original data more suitable for model training, analysis or visualization to improve data quality and model performance. The steps involved in data preprocessing include but are not limited to:
[0087] Data cleaning: Detect and process errors, missing values, outliers, and duplicates in the data to prevent these problems from affecting the final accuracy of the model. Data transformation: Standardize, normalize, or logarithmize the data to ensure that the scales of different features are consistent, which helps the model converge. Data dimensionality reduction: When the data has a large number of features, dimensionality reduction can reduce the number of features and improve the training efficiency of the model while retaining the information of the original data as much as possible. Data segmentation: Divide the data set into training, validation, and test sets for model training, hyperparameter tuning, and performance evaluation.
[0088] In one embodiment of the present application, the inputting the feature parameters into a pre-trained screening model to obtain the selection result of the gate-disabled case includes: inputting function points, interfaces, and code changes as the feature parameters into a pre-trained screening model; outputting a value of 0 or 1 according to the pre-trained screening model, wherein when the value is 0, it indicates that the test case is not selected into the gate-disabled case, and when it is 1, it indicates that the test case is selected into the gate-disabled case; the screened gate-disabled case is a set of test cases whose output neuron value is 1.
[0089] like Figure 2 As shown in the figure, the model inputs: function points, interfaces, code changes; the model outputs: the number of output neurons is the length of the test case set, and the output of the neuron is 0 and 1. When the value is 0, it means that the test case is not selected into the gated case, and 1 means it is selected. In short, the gated case selected is the set of test cases with the output neuron value of 1.
[0090] The machine learning model consists of two parts: BP neural network and sparrow search algorithm. Figure 3 , which is a schematic diagram of the structure of the BP neural network in the embodiment of the present application, and the BP neural network is generally composed of an input layer, a hidden layer and an output layer. Each neuron receives relevant information from the previous neuron and outputs the information to the next layer of neurons through a weighted and activated function.
[0091] Assume that the training samples are {(x1,y1),(x2,y2),(x3,y3),···,(x p ,y p )},x∈R m ,y∈R q , then the outputs of the hidden layer and the output layer are:
[0092]
[0093] Where: ij , b j are the weights and thresholds between the input layer and the hidden layer respectively; ω jk ,θ k are the weights and thresholds between the hidden layer and the output layer, respectively.
[0094] Sparrow search algorithm:
[0095] The traditional BP model has problems such as slow convergence, falling into local optimal solution, overfitting, and sensitive parameter selection. Therefore, the sparrow search algorithm is introduced to optimize its more sensitive weights and thresholds.
[0096] In the simulation experiment, the population of n sparrows is as follows:
[0097]
[0098] Where: d represents the dimension of the problem to be optimized; n represents the number of sparrows.
[0099] The fitness of a sparrow population is in the following form:
[0100]
[0101] Where: f represents the fitness value.
[0102] The finder's position update formula is as follows:
[0103]
[0104] Where: represents the position information value of the i-th sparrow in the j-th dimension at the t-th iteration; α is a random number in [0,1]; R is the warning value; ST represents the safety value; Q is a random number that obeys the normal distribution; L is a matrix whose internal elements are all 1.
[0105] The position update formula of the joiner is as follows:
[0106]
[0107] Where: represents the position of the best fitness among the discoverers; Represents the position of the global worst fitness; A represents a column vector with the same dimension as the sparrow individual, and its internal elements are randomly composed of 1 and -1.
[0108] The scout's position update formula is as follows:
[0109]
[0110] Where: is the current global optimal position; β is the step size control parameter; K∈[-1 ,1 ] is a random number; f i is the fitness of the current sparrow individual; f g is the global optimal fitness value, f w is the global worst fitness value; ε is a very small constant to avoid the denominator being 0.
[0111] In an embodiment of the present application, a testing method is further provided, wherein the method for selecting a door prohibition example is adopted, and the method for selecting a door prohibition example includes:
[0112] Determine the characteristic parameters required for access control;
[0113] The characteristic parameters are input into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0114] In some embodiments, a preset algorithm is used in the process of machine learning to optimize the initialization weights and threshold ranges in the BP neural network, including:
[0115] Using the sparrow search algorithm as the preset algorithm to optimize the initialization weight and threshold range in the BP neural network;
[0116] The weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer are optimized based on the sparrow search algorithm.
[0117] In some embodiments, the optimization of the weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer based on the sparrow search algorithm includes:
[0118] Initialize the position and fitness of the sparrow population and start a cycle, wherein the sparrow population includes discoverers and joiners;
[0119] Calculate the fitness and sort the population according to the discoverer and the joiner to obtain the current optimal individual position of the sparrow and the optimal fitness value;
[0120] According to the current optimal individual sparrow position and the optimal fitness value, imitate the sparrow's foraging behavior, update the discoverer's position and update the joiner's position;
[0121] Imitate anti-predator behavior, update the scout's position and update the historical optimal fitness;
[0122] When the maximum number of iterations is reached, the optimal individual position and fitness value are output.
[0123] In some embodiments, the method further comprises:
[0124] Input the optimal individual position and fitness value into the BP neural network, and obtain the optimal weight and threshold range;
[0125] The weights and threshold range in the BP neural network are updated according to the optimal weights and threshold range.
[0126] In some embodiments, the determining of characteristic parameters required for the door ban example includes:
[0127] According to the demand planning specification and software application, the characteristic parameters required for the access control example are collected as test data.
[0128] In some embodiments, inputting the characteristic parameters into a pre-trained screening model to obtain the selection result of the access ban example includes:
[0129] Inputting function points, interfaces and code changes as the feature parameters into the pre-trained screening model;
[0130] Outputting a value of 0 or 1 according to the pre-trained screening model, wherein when the value is 0, it indicates that the test case is not selected into the access prohibition case, and when the value is 1, it indicates that the test case is selected into the access prohibition case;
[0131] The gated cases to be screened are the set of test cases whose output neuron value is 1.
[0132] The embodiment of the present application also provides a device 500 for generating a door lock example, such as Figure 5 As shown, a schematic diagram of the structure of a device for generating a door prohibition example in an embodiment of the present application is provided, wherein the device for generating a door prohibition example 500 at least includes: a determination module 510 and a screening module 520, wherein:
[0133] In one embodiment of the present application, the acquisition module 510 is specifically used to determine the characteristic parameters required for the door prohibition example.
[0134] Considering that the goal of access control testing is to verify whether the basic functions of the software are normal to ensure the stability of the software project. The selection process of access control examples used in related technologies relies heavily on manual selection. However, this method is very time-consuming and cumbersome for large software projects, so it is necessary to automatically select access control examples according to actual needs.
[0135] The characteristic parameters include, but are not limited to, function points, interfaces, and code changes. It can be understood that the function points, interfaces, and code changes are interrelated, and any change in any of them may affect the implementation of the corresponding function. For example, the change of function point a may affect the interface, which in turn may cause code changes. Similarly, when the code changes, it is also easy to cause interface changes and changes in function points. In the embodiments of the present application, function points, interfaces, and code changes are selected as characteristic parameters, and the corresponding access control examples can be automatically selected in the subsequent screening model.
[0136] In one embodiment of the present application, the acquisition module 520 is specifically used to: input the characteristic parameters into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0137] The input of the pre-trained screening model is the feature parameter input, and the output is the selection result of the access control examples, thereby effectively improving the standardization and quality of the access control examples and greatly reducing the workload of the manual selection of access control examples.
[0138] In the process of training the screening model, a large amount of relevant data information of access control cases can be extracted from the demand planning specifications and software applications, and the obtained data can be used to train the machine learning model.
[0139] Specifically, the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the process of machine learning to optimize the initialization weights and threshold ranges in the BP neural network. Compared with a single BP neural network, it can better avoid problems such as slow convergence, falling into local optimal solutions, and overfitting during the training process, thereby improving the effectiveness and accuracy of selecting use cases.
[0140] It should be noted that access control examples play an important role, which can be used to verify whether the key functions of the system are operating normally, determine whether the development can proceed with subsequent operations, etc. However, the existing access control examples are generally selected manually, and there are defects in this process, such as the selection of test cases is easily affected by the subjective factors of testers, consumes a lot of human resources, and is difficult to maintain.
[0141] By inputting the characteristic parameters into the pre-trained screening model, the pre-trained screening model can automatically select access control examples through data analysis and learning. In this machine learning (BP neural network model), there are problems such as slow convergence, falling into local optimal solutions, overfitting, and sensitive parameter selection during the training process. Therefore, a preset algorithm is used to optimize its more sensitive weights and thresholds. After the screening model training is completed, only the function points, interfaces, code changes and other information need to be input to automatically select the corresponding access control examples.
[0142] After obtaining the selection result of the access control example according to the output of the model, it is necessary to select the access control example, based on the trained machine learning model, automatically output the result according to the input conditions, and select the test case with the output value of 1 to form the access control example.
[0143] In addition, it also includes: automatic execution and analysis, automatically executing the selected access control cases and analyzing the test results. If the test case fails, the problem is reported to the development team.
[0144] Preferably, the screening model can also be optimized and fed back: the machine learning model is continuously optimized based on the test results.
[0145] In one embodiment of the present application, the screening module 520 is also used to
[0146] Using the sparrow search algorithm as the preset algorithm to optimize the initialization weight and threshold range in the BP neural network;
[0147] The weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer are optimized based on the sparrow search algorithm.
[0148] In one embodiment of the present application, the screening module 520 is also used to
[0149] Initialize the position and fitness of the sparrow population and start a cycle, wherein the sparrow population includes discoverers and joiners;
[0150] Calculate the fitness and sort the population according to the discoverer and the joiner to obtain the current optimal individual position of the sparrow and the optimal fitness value;
[0151] According to the current optimal individual sparrow position and the optimal fitness value, imitate the sparrow's foraging behavior, update the discoverer's position and update the joiner's position;
[0152] Imitate anti-predator behavior, update the scout's position and update the historical optimal fitness;
[0153] When the maximum number of iterations is reached, the optimal individual position and fitness value are output.
[0154] In one embodiment of the present application, the screening module 520 is also used to
[0155] Input the optimal individual position and fitness value into the BP neural network, and obtain the optimal weight and threshold range;
[0156] The weights and threshold range in the BP neural network are updated according to the optimal weights and threshold range.
[0157] In one embodiment of the present application, the determining module 510 is further configured to:
[0158] According to the demand planning specification and software application, the characteristic parameters required for the access control example are collected as test data.
[0159] In one embodiment of the present application, the screening module is also used
[0160] Inputting function points, interfaces and code changes as the feature parameters into the pre-trained screening model;
[0161] Outputting a value of 0 or 1 according to the pre-trained screening model, wherein when the value is 0, it indicates that the test case is not selected into the access prohibition case, and when the value is 1, it indicates that the test case is selected into the access prohibition case;
[0162] The gated cases to be screened are the set of test cases whose output neuron value is 1.
[0163] It can be understood that the above-mentioned device for generating access control examples can implement the various steps of the method for selecting access control examples provided in the aforementioned embodiments. The relevant explanations on the method for selecting access control examples are applicable to the device for generating access control examples and will not be repeated here.
[0164] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0165] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0166] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0167] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a generation device for access control examples at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0168] Determine the characteristic parameters required for access control;
[0169] The characteristic parameters are input into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0170] The above application Figure 1The method performed by the device for generating the gate-disabling example disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip having the ability to process signals. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or by instructions in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0171] The electronic device may also perform Figure 1 The method for executing the generation device of the access control example in the Figure 1 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0172] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 1 The method executed by the generating device of the door ban example in the embodiment shown is specifically used to execute:
[0173] Determine the characteristic parameters required for access control;
[0174] The characteristic parameters are input into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
[0175] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0176] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0177] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0179] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0180] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0181] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0182] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0183] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0184] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for selecting a door ban example, wherein: The method comprises: Determine the characteristic parameters required for access control; The characteristic parameters are input into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained through machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
2. The method of claim 1, wherein: In the process of machine learning, a preset algorithm is used to optimize the initialization weight and threshold range in the BP neural network, including: Using the sparrow search algorithm as the preset algorithm to optimize the initialization weight and threshold range in the BP neural network; The weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer are optimized based on the sparrow search algorithm.
3. The method of claim 2, wherein: The method of optimizing the weights and thresholds between the input layer and the hidden layer of the BP neural network, and the weights and thresholds between the hidden layer and the output layer based on the sparrow search algorithm includes: Initialize the position and fitness of the sparrow population and start a cycle, wherein the sparrow population includes discoverers and joiners; Calculate the fitness and sort the population according to the discoverer and the joiner to obtain the current optimal individual position of the sparrow and the optimal fitness value; According to the current optimal individual sparrow position and the optimal fitness value, imitate the sparrow's foraging behavior, update the discoverer's position and update the joiner's position; Imitate anti-predator behavior, update the scout's position and update the historical optimal fitness; When the maximum number of iterations is reached, the optimal individual position and fitness value are output.
4. The method of claim 3, wherein: The method further comprises: Input the optimal individual position and fitness value into the BP neural network, and obtain the optimal weight and threshold range; The weights and threshold range in the BP neural network are updated according to the optimal weights and threshold range.
5. The method of claim 1, wherein: The characteristic parameters required for determining the door ban include: According to the demand planning specification and software application, the characteristic parameters required for the access control example are collected as test data.
6. The method of claim 1, wherein: The step of inputting the characteristic parameters into a pre-trained screening model to obtain a selection result of the access control example includes: Inputting function points, interfaces and code changes as the feature parameters into the pre-trained screening model; Outputting a value of 0 or 1 according to the pre-trained screening model, wherein when the value is 0, it indicates that the test case is not selected into the access prohibition case, and when the value is 1, it indicates that the test case is selected into the access prohibition case; The gated cases to be screened are the set of test cases whose output neuron value is 1.
7. A test method, wherein: A method for selecting a door ban example as described in any one of claims 1 to 6 is adopted.
8. A device for generating a door ban example, wherein: The device comprises: A determination module, used to determine the characteristic parameters required for the door lock example; A screening module is used to input the characteristic parameters into a pre-trained screening model to obtain the selection result of the access control example, wherein the screening model is obtained by machine learning training using a BP neural network, and a preset algorithm is used in the machine learning process to optimize the initialization weights and threshold ranges in the BP neural network.
9. An electronic device, comprising: processor; as well as A memory arranged to store computer executable instructions, which when executed cause the processor to perform the method of any one of claims 1 to 6.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, causes the electronic device to execute any one of the methods of claims 1 to 6.
