An automated testing method based on behavior-driven testing

Through an automated testing method based on behavior-driven testing, analyzing user behavior characteristics and software operation status and predicting user future behavior paths, the problem of insufficient dynamic relationship analysis of user behavior and software operation status by existing testing methods is solved, achieving more efficient and accurate test coverage and risk identification, and improving the stability and security of the software.

CN118860894BActive Publication Date: 2025-04-29HUBEI CENT CHINA TECH DEV OF ELECTRIC POWER
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411102010.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2025-04-29
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

The existing automated testing methods lack in-depth analysis of the complex dynamic relationship between user behavior and software operation status, resulting in insufficient test coverage, difficult to identify risk points and vulnerabilities, and difficult to adapt to rapid changes in user behavior.

Method used

An automated testing method based on behavior-driven testing is adopted to capture and analyze user behavior characteristics, extract behavior patterns and identify key operation states, generate hidden state transfer and observation probability models, predict user future behavior paths, and optimize test scenarios and use case design.

Benefits of technology

It improves the targetedness and accuracy of testing, enhances the ability to describe the dynamic relationship between software operations and user behavior, improves the accuracy of future user behavior path prediction, the accuracy of identifying risk points and the targetedness of test case design, thereby improving the stability and security of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860894B_ABST
    Figure CN118860894B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of software testing technology, specifically to an automated testing method based on behavior-driven testing, comprising the following steps: based on user behavior records, capturing operation time and click counts, decomposing behaviors into sequences, extracting user behavior feature descriptions, and generating user behavior feature data sets. In the present invention, by extracting behavior patterns and identifying key operation states from user behavior feature data sets, creating a mapping table between behavior data and key operation states, enhancing the pertinence and accuracy of the test, analyzing the relationship between states and observed data, calculating state transition frequencies and probability distributions of behavior data, in order to deeply understand software behavior and user interaction, optimize test scenarios, and improve the accuracy of predicting user behavior path models, making risk point identification more accurate, the adjusted test case set reveals potential risk points and vulnerabilities in the software, improving software stability and security, accelerating the testing process, and continuously improving software quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to an automated testing method based on behavior-driven testing. Background Art

[0002] The field of software testing technology is a key area that focuses on ensuring that the quality and performance of software systems meet predetermined standards and user requirements. The field includes a variety of testing methods, such as unit testing, integration testing, system testing, and acceptance testing. Through software testing, development teams are able to identify and fix defects, verify the correctness of functions, evaluate performance, and ensure the stability and reliability of software products. Software testing also includes automated testing, which can significantly improve the efficiency and consistency of the testing process, including in regression testing and large-scale testing scenarios. Modern software testing also incorporates continuous integration and continuous deployment practices to support agile and DevOps workflows.

[0003] Among them, automated testing is a method of performing software testing using automated tools, which aims to reduce the need for manual testing, improve the efficiency and reliability of testing, and automatically execute predefined test cases by writing test scripts or using graphical interface testing tools to detect defects and problems in the software. The main uses of automated testing include accelerating the testing process, improving test coverage, meeting the testing requirements of continuous integration and continuous deployment, and supporting the testing of large-scale and complex systems. It also helps to improve the repeatability and consistency of testing and ensure the continuous improvement of software quality.

[0004] Although existing automated testing methods can handle conventional software testing processes in automated testing, they lack in-depth analysis of the complex dynamic relationship between user behavior and software operating status. Conventional methods mainly rely on preset test cases and scenarios, which limits the breadth and depth of test coverage, resulting in the inability to effectively identify potential risk points and vulnerabilities. The lack of predictive ability for future user behavior paths makes it difficult for testing to adapt to rapid changes in user behavior, including when facing large-scale and complex systems. This deficiency leads to unstable and inconsistent test results, which in turn affects the overall quality assurance of the software. The lack of detailed analysis of behavioral data and state transitions also results in a lack of data support for the adjustment and optimization of test cases, limiting the efficiency and effectiveness of the testing process. Summary of the invention

[0005] The purpose of the present invention is to solve the shortcomings in the prior art and to propose an automated testing method based on behavior-driven testing.

[0006] In order to achieve the above object, the present invention adopts the following technical solution, an automated testing method based on behavior-driven testing, comprising the following steps:

[0007] S1: Based on user behavior records, including capturing operation time and click counts, decompose the behavior into sequences, extract user behavior feature descriptions, and generate user behavior feature datasets;

[0008] S2: extracting behavior patterns from the user behavior feature data set, identifying key operating states of the software, mapping behavior data with key operating states, creating a mapping table, and generating a state and observation data association table;

[0009] S3: Analyze the state and observation data association table, calculate the conversion frequency between each state, describe the dynamic relationship between user behavior and software operation state, and generate a hidden state transfer and observation probability model;

[0010] S4: Based on the hidden state transfer and observation probability model, analyze the user's behavior sequence in the future time period, identify the potential behavior path in the future time period, and generate a predicted user behavior path model;

[0011] S5: According to the predicted user behavior path model, identify risk points, refine test scenarios, formulate test indicators, design test cases, optimize the test process, and generate an adjusted test case set;

[0012] S6: Use the adjusted test case set to perform automated testing, compare the test results with user behavior differences, identify potential risk points and vulnerabilities, and generate test coverage and risk assessment results.

[0013] As a further solution of the present invention, the user behavior feature data set includes operation time, number of clicks, duration, and occurrence frequency; the state and observation data association table includes behavior pattern, operation state, and behavior and state mapping relationship; the hidden state transfer and observation probability model includes a state transition frequency matrix and a behavior data probability distribution matrix; the predicted user behavior path model includes future behavior sequences and potential behavior paths; the adjusted test case set includes a risk point identification list, test scenario definition, test indicator set, and test case group; the test coverage and risk assessment results include risk point segmentation, software stability impact analysis results, and software security impact analysis results.

[0014] As a further solution of the present invention, based on user behavior records, the operation time and click count are captured, the behavior is decomposed into sequences, and the user's behavior feature description is extracted. The steps of generating a user behavior feature data set are specifically as follows:

[0015] S101: Based on user behavior records, monitor user interactions in the software, and record the exact timestamp and click count of each operation in real time, including the time of launching applications, browsing functions, and exiting activities. By integrating timestamps and click counts, an operation record log is constructed;

[0016] S102: using the data in the operation record log, identifying the start and end time of the user behavior, measuring the duration and interaction intensity of independent activities, and obtaining operation sequence analysis data through the duration of events and interaction frequency;

[0017] S103: Analyze patterns in the operation sequence analysis data, identify operation frequency, operation duration, and typical behavior patterns of users, and generate a user behavior feature data set by aggregating the identified information.

[0018] As a further solution of the present invention, the steps of extracting behavior patterns from the user behavior feature data set, identifying the key operating status of the software, mapping the behavior data with the key operating status, creating a mapping table, and generating a status and observation data association table are specifically as follows:

[0019] S201: Filter key data from the user behavior feature data set, remove noise points, eliminate abnormal values ​​beyond a predetermined range, fill in missing data, normalize key data and missing data and unify data formats to obtain a user behavior processing data set;

[0020] S202: Based on the user behavior processing data set, statistically analyze the data, calculate the behavior frequencies of differentiated users, perform time series analysis on the behavior frequencies, identify recurring behavior patterns, cluster similar behaviors, and construct a user behavior pattern mapping table;

[0021] S203: Analyze the correspondence between user behavior and software operation status using the user behavior pattern mapping table, establish a mapping link with the software operation status for each behavior, determine the correspondence between behavior and status, and construct a status and observation data association table.

[0022] As a further solution of the present invention, the steps of analyzing the state and observation data association table, calculating the conversion frequency between each state, describing the dynamic relationship between user behavior and software operation state, and generating a hidden state transfer and observation probability model are specifically as follows:

[0023] S301: Based on the state and observation data association table, count the number of occurrences of each state, calculate the number of transitions between multiple states, and obtain a state transition frequency table by dividing the total number of occurrences by the total number of transitions;

[0024] S302: Based on the state and observation data association table, count the number of occurrences of each behavior in multiple states, calculate the probability of occurrence of each behavior in multiple states by proportion, and obtain a behavior probability distribution table by integrating probability information;

[0025] S303: Using the state transition frequency table and behavior probability distribution table, adopting a hidden Markov model, describing the dynamic relationship between user behavior and software operation state, and displaying the interaction pattern between behavior and state by associating behavior probability and state transition, obtaining a hidden state transfer and observation probability model.

[0026] As a further solution of the present invention, the formula of the hidden Markov model is as follows:

[0027] ;

[0028] in, To improve from the state Transfer to state The probability of Indicates at time In state and in time Transfer to state The probability of Indicates at time In state The probability of For time The weight coefficient of is the smoothing parameter, is the state extracted from the knowledge source To status The additional transition probability, is the number of additional knowledge sources, is the total number of time steps.

[0029] As a further solution of the present invention, based on the hidden state transfer and observation probability model, the steps of analyzing the user's behavior sequence in the future time period, identifying the potential behavior path in the future time period, and generating a model for predicting the user's behavior path are specifically as follows:

[0030] S401: Based on the hidden state transfer and observation probability model, collect the user's historical behavior sequence, perform statistical calculations on the conversion probability between each behavior and the previous and next states, predict the user's behavior sequence in the future time period, and obtain the user's future behavior sequence table;

[0031] S402: Based on the user's future behavior sequence list, analyze the time interval and continuity between behaviors, evaluate the mutual influence of multiple behaviors, identify continuous behavior patterns and potential change paths, and form a potential behavior path map;

[0032] S403: Utilizing the potential behavior path diagram, analyzing the behavior changes of the user in the future time period, determining the details of the behavior process and the state transition, evaluating the behavior trend and path of the user in the future time period, and obtaining a predicted user behavior path model.

[0033] As a further solution of the present invention, according to the predicted user behavior path model, the steps of identifying risk points, refining test scenarios, formulating test indicators, designing test cases, optimizing test processes, and generating an adjusted test case set are specifically as follows:

[0034] S501: Based on the predicted user behavior path model, analyze the key risk factors of each behavior node one by one, identify potential risk points associated with user behavior, create test scenarios according to the risk points, set test indicators for each scenario, and obtain a risk point test scenario set;

[0035] S502: Based on the risk point test scenario set, design test cases for multiple scenarios, specify input conditions, expected results, and exception handling procedures for each case, verify the coverage of the test case, and obtain a preliminary draft of the test case;

[0036] S503: Based on the draft test case, apply the decision tree algorithm, execute the test and evaluate the effectiveness of the case, adjust the test case parameters and process according to the test feedback, optimize the execution efficiency and accuracy of the test, and obtain an optimized test case set.

[0037] As a further solution of the present invention, the formula of the decision tree algorithm is as follows:

[0038] ;

[0039] in, represents the entropy of the target variable, For classification The probability of appearing in the data set, For classification The correction factor of For classification The weight of .

[0040] As a further solution of the present invention, the steps of performing automated testing using the adjusted test case set, comparing the test results with user behavior differences, identifying potential risk points and vulnerabilities, and generating test coverage and risk assessment results are specifically as follows:

[0041] S601: Based on the optimized test case set, the test case set is loaded into the test environment, each test case is run one by one, and the input data, processing process, output result and abnormal situation of the test case are recorded to obtain a test execution record;

[0042] S602: Based on the test execution record, compare the difference between the real-time test result and the user behavior path prediction, identify the risk points and vulnerabilities in the test through the difference, analyze the negative impact of the risk points and vulnerabilities on the stability and security of the software, and obtain a risk and vulnerability analysis document;

[0043] S603: Using the risk and vulnerability analysis document, evaluate the coverage of test cases and the impact of risk points, extract key test points, match risk analysis results, define risk levels, analyze test result differences, formulate risk response strategies, and obtain test coverage and risk assessment results.

[0044] Compared with the prior art, the advantages and positive effects of the present invention are:

[0045] In the present invention, by extracting behavior patterns from user behavior feature data sets and identifying key operating states, a deep understanding of software behavior and user interaction is achieved, a detailed mapping table is created by mapping behavior data to key operating states, the pertinence and accuracy of the test is enhanced, and the state and observation data relationship table is analyzed. By calculating the conversion frequency between states and the probability distribution of behavior data, a more comprehensive description of the dynamic relationship between software operation and user behavior is obtained, the accuracy of predicting future user behavior paths is improved, and the test scenarios are optimized, so that the identification of risk points is more accurate and the design of test cases is more targeted. When performing automated testing, the adjusted test case set can effectively reveal potential risk points and vulnerabilities in the software, thereby directly improving the stability and security of the software, which not only speeds up the testing process, but also provides continuous improvement of software quality through precise risk point analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a schematic diagram of the main steps of the present invention;

[0047] Figure 2 It is a schematic diagram of the refinement of S1 of the present invention;

[0048] Figure 3 It is a schematic diagram of the refinement of S2 of the present invention;

[0049] Figure 4 It is a schematic diagram of the refinement of S3 of the present invention;

[0050] Figure 5 It is a schematic diagram of the refinement of S4 of the present invention;

[0051] Figure 6 It is a detailed schematic diagram of S5 of the present invention;

[0052] Figure 7 It is a detailed schematic diagram of S6 of the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0054] In the description of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a target position, be constructed and operated in the target position, and therefore cannot be understood as a limitation on the present invention. In addition, in the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined.

[0055] Embodiment 1

[0056] See also Figure 1 The present invention provides a technical solution, an automated testing method based on behavior-driven testing, comprising the following steps:

[0057] S1: Based on user behavior records, including capturing the user's operation time and click times in the software, decomposing the behavior records into operation sequences, recording the duration and frequency of each sequence, extracting the user's behavior feature description, and generating a user behavior feature dataset;

[0058] S2: Extract the user's behavior pattern from the user behavior feature data set, identify the key operation status of the software, map the behavior data with the key operation status, create a mapping table and correspond the behavior and status, and generate a status and observation data association table;

[0059] S3: Analyze the state and observation data association table, calculate the conversion frequency between each state and the probability distribution of each behavior data, describe the dynamic relationship between user behavior and software operation state, and generate a hidden state transfer and observation probability model;

[0060] S4: Based on the hidden state transfer and observation probability model, analyze the behavior sequence of users in the future time period, identify the potential behavior path in the future time period, and generate a model to predict the user behavior path;

[0061] S5: Based on the predicted user behavior path model, identify risk points, refine test scenarios, formulate test indicators, design test cases, integrate risk points and test scenarios, verify the coverage and depth of test cases, adjust test case parameters, optimize the test process, and generate adjusted test case sets;

[0062] S6: Use the adjusted test case set to perform automated testing, load the test case set into the test environment, execute each test case in turn and collect the execution results, compare the test results with the differences in user behavior, identify potential risk points and vulnerabilities in the software, analyze the impact of potential risk points and vulnerabilities on software stability and security, and generate test coverage and risk assessment results.

[0063] The user behavior feature data set includes operation time, number of clicks, duration, and frequency of occurrence. The state and observation data association table includes behavior pattern, operation state, and behavior-state mapping relationship. The hidden state transfer and observation probability model includes state transition frequency matrix and behavior data probability distribution matrix. The user behavior path prediction model includes future behavior sequence and potential behavior path. The adjusted test case set includes risk point identification list, test scenario definition, test indicator set, and test case group. The test coverage and risk assessment results include risk point segmentation, software stability impact analysis results, and software security impact analysis results.

[0064] Specifically, if Figure 2 As shown in the figure, based on the user behavior record, the operation time and click count are captured, the behavior is decomposed into sequences, and the user's behavior feature description is extracted. The specific steps of generating the user behavior feature data set are as follows:

[0065] S101: Based on the user behavior records, monitor the user's interaction in the software, and record the exact timestamp and click count of each operation in real time, including the time of launching the application, browsing functions, and exiting activities. By integrating the timestamp and click count, the execution process of building the operation record log is as follows;

[0066] S101: Based on user behavior records, monitor user interactions in the software, record the exact timestamp and number of clicks for each operation in real time, and start a background process to capture the corresponding timestamp by monitoring the user interface actions (such as touch, click, slide, etc.) and click count Assign a unique identifier Oid to each operation, and the operation type (launching an application, browsing a function, exiting an activity, etc.), timestamp , Clicks The Oid is stored in the local cache and the data is uploaded to the server in batches periodically. On the server side, the timestamp and click count are integrated with the user's device information and operation context to build an operation record log using the following formula:

[0067] ;

[0068] in, Represents the operation record log. Representative The weight of the operation, Representative The timestamp of the operation, Representative Number of clicks per operation, Represents the total number of operations.

[0069] S102: Using the data in the operation record log, identify the start and end time of the user behavior, measure the duration and interaction intensity of independent activities, and obtain the operation sequence analysis data through the time length and interaction frequency of the event. The execution process is as follows;

[0070] S102: Using the data in the operation log, identify the start and end time of the user behavior. First, extract all operation record items from the operation log, including the timestamp. Number of hits and operation identifier Oid. By analyzing the timestamp difference of adjacent operation items and combining the number of clicks , determine the start and end time of independent activities, and calculate the duration of each independent activity (obtained by subtracting the start timestamp from the end timestamp) and the interaction strength (Calculated by dividing the total number of hits during the campaign by the duration Using the calculation results, we can obtain the operation sequence analysis data through the duration of the event and the frequency of interaction, using the following formula:

[0071] ;

[0072] in, represents the operation sequence analysis data, Representative The duration of each independent activity, Representative The interaction strength of each independent activity, Represents the total number of independent activities.

[0073] S103: Analyze the patterns in the operation sequence analysis data, identify the operation frequency, operation duration and the typical behavior pattern of the user, and generate the user behavior feature data set by aggregating the identified information. The execution process is as follows;

[0074] S103: Analyze the patterns in the operation sequence analysis data to identify the operation frequency, operation duration and typical behavior patterns of users. Cluster analysis methods will be used to analyze the operation frequency. , Operation duration and interaction strength As features, the operation records are classified, and each category represents a typical behavior pattern. Through the clustering process, representative user behavior features can be extracted from a large amount of operation data. By aggregating the identified information, a user behavior feature data set is generated, using the following formula:

[0075] ;

[0076] in, Represents the user behavior feature dataset, Representative The weight coefficient of each category, Representative The operating frequency of each category, Representative The duration of the operation of each category, Representative The interaction strength of each category, Represents the total number of categories.

[0077] Specifically, if Figure 3 As shown, the steps of extracting behavior patterns from user behavior feature data sets, identifying key operating states of software, mapping behavior data with key operating states, creating a mapping table, and generating a state and observation data association table are as follows:

[0078] S201: Filter key data from the user behavior feature data set, remove noise points, eliminate outliers beyond a predetermined range, fill in missing data, normalize key data and missing data and unify the data format, and obtain the user behavior processing data set. The execution process is as follows;

[0079] S201: Filter key data from the user behavior feature data set, remove noise points, eliminate outliers that exceed the predetermined range, and fill in missing data. First, identify and eliminate outliers whose values ​​are far from the average value. Outliers do not represent the normal behavior of users. Use interpolation or nearest neighbor method to fill in missing data points to ensure the integrity of the data set. Use the maximum and minimum normalization method to standardize the data, adjust all values ​​to the [0, 1] interval to eliminate the impact of different magnitudes, unify the data format, such as unifying the date and time into ISO8601 format, and use floating point representation for numbers to obtain the user behavior processing data set. The formula is as follows:

[0080] ;

[0081] in, Represents user behavior processing data sets, Representative The original value of the data point, and Represent the minimum and maximum values ​​in the data set, respectively. Represents the total number of data points.

[0082] S202: Based on the user behavior processing data set, statistical analysis is performed on the data, the behavior frequency of differentiated users is calculated, time series analysis is performed on the behavior frequency, repeated behavior patterns are identified, similar behaviors are clustered, and the execution flow of constructing a user behavior pattern mapping table is as follows;

[0083] S202: Based on the user behavior processing data set, statistical analysis is performed on the data to calculate the behavior frequency of differentiated users. First, the behavior records of each user are summarized, and then the frequency of each behavior is calculated. Through time series analysis methods, such as moving average or exponential smoothing, recurring behavior patterns are identified, and clustering algorithms such as K-means or DBSCAN are used to cluster similar behavior patterns to construct a user behavior pattern mapping table. The formula used is as follows:

[0084] ;

[0085] in, Represents the user behavior pattern mapping table, Representative The influence coefficient of the cluster center is Representative The total number of behaviors in the clusters, represents the total time period of observation, Represents the total number of clusters.

[0086] S203: Analyze the correspondence between user behavior and software operation status by using the user behavior pattern mapping table, establish a mapping link with the software operation status for each behavior, determine the correspondence between behavior and status, and construct the status and observation data association table. The execution process is as follows;

[0087] S203: Analyze the correspondence between user behavior and software operation status by using the user behavior pattern mapping table, establish a mapping link with the software operation status for each behavior, determine the correspondence between behavior and status, traverse each cluster in the user behavior pattern mapping table, and determine a set of target software operation status for each behavior pattern in the cluster. In this way, construct a state and observation data association table to provide a basis for subsequent behavior prediction and personalized recommendation. The formula used is as follows:

[0088] ;

[0089] in, Represents the association table between state and observation data, Representative The weight coefficient of the behavior mode, Representative The number of mappings between behavior patterns and software operation states, represents the total number of behavior patterns, Represents the number of types of behavior patterns.

[0090] Specifically, if Figure 4 As shown in the figure, the state and observation data association table is analyzed, the conversion frequency between each state is calculated, the dynamic relationship between user behavior and software operation state is described, and the steps of generating the hidden state transfer and observation probability model are as follows:

[0091] S301: Based on the state and observation data association table, count the number of occurrences of each state, calculate the number of transitions between multiple states, and divide the total number of occurrences by the total number of transitions to obtain the state transition frequency table. The execution process is as follows;

[0092] S301: Based on the state and observation data association table, count the number of occurrences of each state. First, traverse the state and observation data association table and record the number of occurrences of each state. , and simultaneously calculate the number of transitions between multiple states , that is, from the state Transfer to state Then, the state transition frequency is obtained by dividing the total number of occurrences by the total number of transitions, using the following formula:

[0093] ;

[0094] in, Represents the state To status The conversion frequency, Represents the state To status The number of transfers, Representation status The number of occurrences of Represents the total number of states.

[0095] S302: Based on the state and observation data association table, count the number of occurrences of each behavior in multiple states, calculate the probability of occurrence of each behavior in multiple states by proportion, and integrate the probability information to obtain the behavior probability distribution table. The execution process is as follows;

[0096] S302: Based on the state and observation data association table, count the number of occurrences of each behavior in multiple states. , calculate its The number of occurrences of , the probability of each behavior in multiple states is obtained by proportional calculation, that is, , where the probability of the behavior in all states is integrated to obtain the behavior probability distribution table, using the following formula:

[0097] ;

[0098] in, Representative behavior The probability distribution of Representative behavior In Status The number of occurrences of Representation status The number of occurrences of .

[0099] S303: Using the state transition frequency table and the behavior probability distribution table, adopting the hidden Markov model, describing the dynamic relationship between user behavior and software operation state, and displaying the interaction pattern between behavior and state by associating behavior probability and state transition, the execution flow of the hidden state transfer and observation probability model is as follows;

[0100] The formula of the hidden Markov model is as follows:

[0101] ;

[0102] in, To improve from the state Transfer to state The probability of Indicates at time In state and in time Transfer to state The probability of Indicates at time In state The probability of For time The weight coefficient of is the smoothing parameter, is the state extracted from the knowledge source To status The additional transition probability, is the number of additional knowledge sources, is the total number of time steps.

[0103] The execution process is as follows:

[0104] For each time step Assign a weight , increase or decrease its influence according to its position or holding condition in the observation sequence, calculate the state transition probability and state existence probability of each time step, and multiply it by the corresponding weight , introducing the smoothing parameter and additional sources of knowledge , in order to integrate historical data with new information sources, thereby optimizing the model's adaptability to unobserved data, and calculating the improved state transition probability through the integration of steps , not only the traditional hidden Markov model calculation steps are considered, but also additional adjustments are integrated to improve the prediction accuracy and model robustness.

[0105] Specifically, if Figure 5 As shown in the figure, based on the hidden state transfer and observation probability model, the user's behavior sequence in the future time period is analyzed, the potential behavior path in the future time period is identified, and the steps of generating a model for predicting the user's behavior path are as follows:

[0106] S401: Based on the hidden state transfer and observation probability model, collect the user's historical behavior sequence, perform statistical calculations on the conversion probability between each behavior and the previous and next states, predict the user's behavior sequence in the future time period, and obtain the user's future behavior sequence table. The execution process is as follows;

[0107] S401: Based on the hidden state transfer and observation probability model, collect the user's historical behavior sequence, first organize the user's past behavior data, and count each behavior And its before and after status The conversion probability , statistical calculations based on past observation probabilities And the actual number of times the behavior occurs, we can predict the user's behavior sequence in the future time period using the following formula:

[0108] ;

[0109] in, Representative behavior The predicted frequency in the future time period, Representative behavior In Status arrive The conversion probability, Representative behavior In state transfer arrive The probability of observation under Represents the total number of states.

[0110] S402: Based on the user's future behavior sequence list, analyze the time interval and continuity between behaviors, evaluate the mutual influence of multiple behaviors, identify continuous behavior patterns and potential change paths, and form a potential behavior path map. The execution process is as follows;

[0111] S402: Based on the user's future behavior sequence table, analyze the time interval and continuity between behaviors, and calculate the time interval between different behaviors and behavioral continuity indicators , the indicator is based on time intervals and behavior frequencies. By evaluating the mutual influence of multiple behaviors, continuous behavior patterns and potential change paths can be identified to form a potential behavior path map, using the following formula:

[0112] ;

[0113] in, Representative behavior To Behavior The continuity score, Representative behavior and behavior The continuity indicator, Representative behavior To Behavior The average time interval.

[0114] S403: Analyze the behavior changes of users in the future time period using the potential behavior path diagram, determine the details of the behavior process and state transitions, evaluate the behavior trends and paths of users in the future time period, and obtain the execution process of the predicted user behavior path model as follows;

[0115] S403: Analyze the behavior changes of users in the future time period by using the potential behavior path map, determine the details of the behavior process and state transitions through the behavior path map, and evaluate the behavior trends and paths of users in the future time period. Through this analysis, a prediction model of user behavior path is obtained, using the following formula:

[0116] ;

[0117] in, Representative behavior To Behavior The prediction path model, Representative The influence coefficient within a time period is Representative behavior To Behavior The continuity score, Represents the total number of time periods considered.

[0118] Specifically, if Figure 6 As shown in the figure, based on the predicted user behavior path model, the steps of identifying risk points, refining test scenarios, formulating test indicators, designing test cases, optimizing the test process, and generating an adjusted test case set are as follows:

[0119] S501: Based on the predicted user behavior path model, analyze the key risk factors of each behavior node one by one, identify the potential risk points associated with the user behavior, create test scenarios according to the risk points, set test indicators for each scenario, and obtain the execution process of the risk point test scenario set as follows;

[0120] S501: Based on the predicted user behavior path model, analyze the key risk factors of each behavior node one by one, first identify the potential risk points associated with the user behavior, and then analyze the behavior nodes. And risk points The degree of association , create targeted test scenarios based on risk points, and set corresponding test indicators for each scenario , thus forming a risk point test scenario set, using the following formula:

[0121] ;

[0122] in, Representative risk points A set of test scenarios, Representing behavior nodes And risk points The degree of correlation, Representative risk points The test indicators, Represents the total number of behavior nodes.

[0123] S502: Based on the risk point test scenario set, design test cases for multiple scenarios, specify input conditions, expected results and exception handling procedures for each case, verify the coverage of the test case, and obtain the execution process of the first draft of the test case as follows;

[0124] S502: Based on the risk point test scenario set, design test cases for multiple scenarios and specify input conditions for each test case , Expected Results and exception handling process , verify the coverage breadth of the test cases, using the following formula:

[0125] ;

[0126] in, Represents the first draft of the test case, Representative risk points The input conditions are Represents the expected result, Represents the exception handling process, Represents the total number of risk points.

[0127] S503: Based on the first draft of the test case, the decision tree algorithm is applied to execute the test and evaluate the effectiveness of the case. The test case parameters and process are adjusted according to the test feedback to optimize the execution efficiency and accuracy of the test. The execution process of the optimized test case set is as follows;

[0128] S503: Based on the first draft of the test case, apply the decision tree algorithm, execute the test and evaluate the effectiveness of the case, adjust the test case parameters and process according to the test feedback, optimize the execution efficiency and accuracy of the test, and obtain the optimized test case set.

[0129] The formula for the decision tree algorithm is as follows:

[0130] ;

[0131] in, represents the entropy of the target variable, For classification The probability of appearing in the data set, For classification The correction factor of For classification The weight of

[0132] The execution process is as follows:

[0133] For each category , calculate the probability of its occurrence , and then calculate a correction factor based on the target attribute of the classification or the previous error rate , and then assign a weight This weight can be determined by the efficiency of the classified test case in identifying defects in historical data. Combining the corrected probability and weight, and recalculating the entropy to evaluate the uncertainty of the entire data set, can more accurately locate high-risk test cases and optimize the test case set construction process. Weight coefficient The determination method includes using historical data analysis, such as dynamically adjusting weights by looking at the failure and success rates of past test cases, to ensure that the weights reflect the latest testing trends and results.

[0134] Specifically, if Figure 7 As shown in the figure, the steps to perform automated testing using the adjusted test case set, compare the test results with user behavior differences, identify potential risk points and vulnerabilities, and generate test coverage and risk assessment results are as follows:

[0135] S601: Based on the optimized test case set, the test case set is loaded into the test environment, each test case is run one by one, and the input data, processing process, output results and abnormal conditions of the test case are recorded, and the execution process of the test execution record is obtained as follows;

[0136] S601: Based on the optimized test case set, load the test case set into the test environment, run each test case one by one, and record the input data of the test case , Process , output results and abnormal situations Through detailed records, a complete test execution record is formed, using the following formula:

[0137] ;

[0138] in, Represents the test execution record, Representative The input data of the test cases, Represents the processing process, Represents the output result, Represents an abnormal situation. Represents the total number of test cases.

[0139] S602: Based on the test execution record, compare the difference between the real-time test result and the user behavior path prediction, identify the risk points and vulnerabilities in the test through the difference, analyze the negative impact of the risk points and vulnerabilities on the stability and security of the software, and obtain the execution process of the risk and vulnerability analysis document as follows;

[0140] S602: Based on the test execution record, compare the difference between the real-time test results and the user behavior path prediction, and calculate the actual test results And the prediction results The difference between , identify the risk points and vulnerabilities in the test, and form a risk and vulnerability analysis document by analyzing the negative impact of risk points and vulnerabilities on the stability and security of the software. The formula used is as follows:

[0141] ;

[0142] in, stands for Risk and Vulnerability Analysis Document, Representative The difference between the test case and the predicted result, Represents the risk level caused by the difference, Represents the total number of test cases.

[0143] S603: Using the risk and vulnerability analysis document, evaluate the coverage of test cases and the impact of risk points, extract key test points, match risk analysis results, define risk levels, analyze test result differences, formulate risk response strategies, and obtain the execution process of test coverage and risk assessment results as follows;

[0144] S603: Use risk and vulnerability analysis documents to evaluate the coverage of test cases and the impact of risk points, and extract key test points , matching risk analysis results , define the risk level , analyze the test results differences , develop risk response strategies , get the test coverage and risk assessment results, using the following formula:

[0145] ;

[0146] in, Represents test coverage and risk assessment results, Representative Key test points: Represents the risk analysis results, Represents the risk level, Represents the difference in test results, represents the risk response strategy, Represents the total number of key test points.

[0147] The above are only preferred embodiments of the present invention and are not intended to limit the present invention in other forms. Any technician familiar with the profession may use the technical contents disclosed above to change or modify them into equivalent embodiments with equivalent changes and apply them to other fields. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. An automated testing method based on behavior-driven testing, characterized in that: The following steps are involved: Based on user behavior records, including capturing operation time and click counts, the behavior is decomposed into sequences, the user's behavior feature description is extracted, and a user behavior feature dataset is generated; Extracting behavior patterns from the user behavior feature data set, identifying key operating states of the software, mapping behavior data with key operating states, creating a mapping table, and generating a state and observation data association table; Analyze the state and observation data association table, calculate the conversion frequency between each state, describe the dynamic relationship between user behavior and software operation state, and generate a hidden state transfer and observation probability model; The steps of the hidden state transfer and observation probability model are specifically as follows: Based on the state and observation data association table, count the number of occurrences of each state, calculate the number of transitions between multiple states, and obtain a state transition frequency table by dividing the total number of occurrences by the total number of transitions; Based on the state and observation data association table, the number of occurrences of each behavior in multiple states is counted, the probability of occurrence of each behavior in multiple states is obtained by proportion calculation, and the behavior probability distribution table is obtained by integrating the probability information; Using the state transition frequency table and behavior probability distribution table, a hidden Markov model is used to describe the dynamic relationship between user behavior and software operation state. By associating behavior probability and state transition, the interaction pattern between behavior and state is displayed, and a hidden state transfer and observation probability model is obtained; Based on the hidden state transfer and observation probability model, analyze the user's behavior sequence in the future time period, identify the potential behavior path in the future time period, and generate a predicted user behavior path model; According to the predicted user behavior path model, identify risk points, refine test scenarios, formulate test indicators, design test cases, optimize test processes, and generate adjusted test case sets; The steps of the adjusted test case set are specifically as follows: Based on the predicted user behavior path model, analyze the key risk factors of each behavior node one by one, identify potential risk points associated with user behavior, create test scenarios according to the risk points, set test indicators for each scenario, and obtain a risk point test scenario set; Based on the risk point test scenario set, design test cases for multiple scenarios, specify input conditions, expected results and exception handling procedures for each case, verify the coverage of the test case, and obtain a preliminary draft of the test case; Based on the draft test case, apply the decision tree algorithm, execute the test and evaluate the effectiveness of the case, adjust the test case parameters and process according to the test feedback, optimize the execution efficiency and accuracy of the test, and obtain the adjusted test case set; Use the adjusted test case set to perform automated testing, compare the test results with user behavior differences, identify potential risk points and vulnerabilities, and generate test coverage and risk assessment results.

2. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: The user behavior feature data set includes operation time, number of clicks, duration, and occurrence frequency. The state and observation data association table includes behavior pattern, operation state, and behavior-state mapping relationship. The hidden state transfer and observation probability model includes a state transition frequency matrix and a behavior data probability distribution matrix. The predicted user behavior path model includes future behavior sequences and potential behavior paths. The adjusted test case set includes a risk point identification list, test scenario definition, test indicator set, and test case group. The test coverage and risk assessment results include risk point segmentation, software stability impact analysis results, and software security impact analysis results.

3. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: Based on user behavior records, capture operation time and click counts, decompose the behavior into sequences, extract user behavior feature descriptions, and generate user behavior feature data sets in the following steps: Based on user behavior records, monitor user interactions in the software, and record the exact timestamp and number of clicks of each operation in real time, including the time of launching applications, browsing functions, and exiting activities. By integrating timestamps and clicks, an operation record log is constructed; Using the data in the operation record log, identify the start and end time of user behavior, measure the duration and interaction intensity of independent activities, and obtain operation sequence analysis data through the duration of events and interaction frequency; Analyze patterns in the operation sequence analysis data, identify operation frequency, operation duration, and typical behavior patterns of users, and generate a user behavior feature data set by aggregating the identified information.

4. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: The steps of extracting behavior patterns from the user behavior feature data set, identifying the key operation status of the software, mapping the behavior data with the key operation status, creating a mapping table, and generating a status and observation data association table are as follows: Filter key data from the user behavior feature data set, remove noise points, eliminate outliers beyond a predetermined range, fill in missing data, normalize key data and missing data and unify data formats to obtain a user behavior processing data set; Based on the user behavior processing data set, statistical analysis is performed on the data, the behavior frequencies of differentiated users are calculated, time series analysis is performed on the behavior frequencies, recurring behavior patterns are identified, similar behaviors are clustered, and a user behavior pattern mapping table is constructed; The user behavior pattern mapping table is used to analyze the correspondence between user behavior and software operation status, establish a mapping link with the software operation status for each behavior, determine the correspondence between behavior and status, and construct a status and observation data association table.

5. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: The formula of the hidden Markov model is as follows: Among them, a′ ij is the probability of transitioning from state i to state j after improvement, ξ t (i, j) represents the probability of being in state i at time t and transitioning to state j at time t+1, γ t (i) represents the probability of being in state i at time t, w t is the weight coefficient at time t, λ is the smoothing parameter, p k (i, j) is the additional transition probability from state i to state j extracted from the knowledge source, K is the number of additional knowledge sources, and T is the total number of time steps.

6. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: Based on the hidden state transfer and observation probability model, the steps of analyzing the user's behavior sequence in the future time period, identifying the potential behavior path in the future time period, and generating a model for predicting the user's behavior path are as follows: Based on the hidden state transfer and observation probability model, collect the user's historical behavior sequence, perform statistical calculations on the conversion probability between each behavior and the previous and next states, predict the user's behavior sequence in the future time period, and obtain the user's future behavior sequence table; Based on the user's future behavior sequence list, analyze the time interval and continuity between behaviors, evaluate the mutual influence of multiple behaviors, identify continuous behavior patterns and potential change paths, and form a potential behavior path map; The potential behavior path diagram is used to analyze the user's behavior changes in the future time period, determine the details of the behavior process and state transitions, evaluate the user's behavior trends and paths in the future time period, and obtain a predicted user behavior path model.

7. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: The formula of the decision tree algorithm is as follows: Among them, H(T) represents the entropy of the target variable, p i is the probability of category i appearing in the data set, α i is the correction coefficient of category i, w i is the weight of category i.

8. The automated testing method based on behavior-driven testing according to claim 1, characterized in that: The specific steps of using the adjusted test case set to perform automated testing, comparing the test results with user behavior differences, identifying potential risk points and vulnerabilities, and generating test coverage and risk assessment results are as follows: Based on the optimized test case set, the test case set is loaded into the test environment, each test case is run one by one, and the input data, processing process, output result and abnormal situation of the test case are recorded to obtain a test execution record; Based on the test execution record, the difference between the real-time test results and the user behavior path prediction is compared, the risk points and vulnerabilities in the test are identified through the differences, the negative impact of the risk points and vulnerabilities on the stability and security of the software is analyzed, and the risk and vulnerability analysis document is obtained; Utilize the risk and vulnerability analysis document to evaluate the coverage of test cases and the impact of risk points, extract key test points, match risk analysis results, define risk levels, analyze test result differences, develop risk response strategies, and obtain test coverage and risk assessment results.

Citation Information

Patent Citations

  • Method and device for generating scene test case

    CN110245080A

  • Test method and system, computer system and medium

    CN113760713A