Software testing method and system based on digital fingerprint

By adopting a digital fingerprint-based method in software testing, the problems of inaccurate test coverage evaluation, low defect detection efficiency and insufficient testing efficiency in the prior art are solved, and more efficient and accurate software test coverage evaluation and test result analysis are achieved.

CN119759796BActive Publication Date: 2025-05-02ZHEJIANG SHUXIN NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510265307.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-05-02
Estimated Expiration
2045-03-07

AI Technical Summary

Technical Problem

Existing software testing methods are difficult to accurately evaluate test coverage, difficult to effectively detect potential defects in software, and are inefficient, especially when faced with large and complex software systems.

Method used

The software testing method based on digital fingerprint is adopted. The system is statically analyzed through the interface collector, interface collector and database interface collector, and fingerprint data of the interface, interface and database are obtained. The system operation status is monitored during the test execution, the operation process information is recorded, and the hashing operation is performed to generate the test process fingerprint data, and the test coverage report is compared to generate.

Benefits of technology

Improves the accuracy of test coverage, improves testing efficiency, simplifies test result analysis, and the generated reports are clear and intuitive, making it easier for developers and testers to quickly understand the test situation and make improvements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759796B_ABST
    Figure CN119759796B_ABST
Patent Text Reader

Abstract

The present invention provides a software testing method and system based on digital fingerprint, which relates to the field of software testing technology, including generating interface fingerprints, interface fingerprints and database fingerprints respectively by statically analyzing the system interface source code, program source code and database interface. During the test process, the operating status of the tested system is monitored, the interface operation, interface call and database interaction information are recorded, and the corresponding test process fingerprint is generated. Finally, the test process fingerprint is compared with the pre-generated fingerprint to generate a test coverage report. The present invention can improve the test coverage, effectively reduce the test cost and improve the software quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to software testing technology, and in particular to a software testing method and system based on digital fingerprint. Background Art

[0002] Software testing is a crucial part of the software development process, used to evaluate the quality, reliability, and stability of software. As the scale and complexity of software systems continue to increase, traditional software testing methods face many challenges, such as insufficient test coverage, low test efficiency, and difficulty in effectively evaluating test integrity. To address these issues, researchers have been exploring new software testing methods and technologies.

[0003] Existing software testing methods mainly include black box testing, white box testing and gray box testing. Black box testing focuses on the functions and performance of the software, while white box testing focuses on the internal structure and logic of the software. Gray box testing combines the advantages of black box testing and white box testing, but still has some limitations.

[0004] The prior art has the following defects and deficiencies:

[0005] 1. Traditional test coverage evaluation methods are difficult to accurately reflect the completeness of the test. For example, even if the test case covers all code lines, it cannot guarantee that all possible execution paths are tested.

[0006] 2. Existing testing methods are difficult to effectively detect potential defects in software. For example, some hidden defects may only be triggered under specific input conditions, and traditional testing methods are difficult to cover all possible input combinations.

[0007] 3. Existing testing methods are inefficient, especially when facing large and complex software systems. The design and execution of test cases require a lot of time and resources, and the analysis and evaluation of test results are also cumbersome. Summary of the invention

[0008] The embodiments of the present invention provide a software testing method and system based on digital fingerprint, which can solve the problems in the prior art.

[0009] A first aspect of an embodiment of the present invention provides a software testing method based on digital fingerprint, comprising:

[0010] An interface collector is used to perform static analysis on the system interface source code to obtain interface interaction action information and interface element information, and a SHA-256 hash operation is performed on the interface interaction action information and interface element information to obtain interface fingerprint data; an interface collector is used to perform static analysis on the operation program source code to obtain interface definition information, input data information and return value information, and a SHA-256 hash operation is performed on the interface definition information, input data information and return value information to obtain interface fingerprint data; a database interface collector is used to perform static analysis on the database interface to obtain database interface input information and database interface return information, and a SHA-256 hash operation is performed on the database interface input information and database interface return information to obtain database fingerprint data;

[0011] During the test execution process, a test collector is used to monitor the running status of the system under test, and the interface operation process information, the interface call process information and the database interaction process information are recorded respectively. SHA-256 hash operations are performed on the interface operation process information, the interface call process information and the database interaction process information respectively to obtain test process interface fingerprint data, test process interface fingerprint data and test process database fingerprint data, and the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are written into the test process fingerprint database;

[0012] The test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are respectively compared with the interface fingerprint data, the interface fingerprint data and the database fingerprint data to generate a test coverage report.

[0013] The interface fingerprint data obtained by performing SHA-256 hash operation on the interface interaction action information and the interface element information includes:

[0014] Acquire interface interaction action information, the interface interaction action information includes an interface element identifier, an interaction action type, an interaction action parameter set, and an interaction action timing relationship, and construct the interface interaction action information as a first feature vector; acquire interface element information, the interface element information includes an element identifier, an element type, an element attribute set, and an element hierarchical relationship, and construct the interface element information as a second feature vector;

[0015] Performing data cleaning on the first feature vector and the second feature vector, wherein the data cleaning includes removing redundant attributes, standardizing attribute value formats and unifying encoding methods, to obtain a preprocessed first feature vector and a preprocessed second feature vector; merging the preprocessed first feature vector and the preprocessed second feature vector to construct a unified feature vector;

[0016] Calculating the length of the unified feature vector, determining a padding length according to the length of the unified feature vector, performing message padding on the unified feature vector, wherein the padding length satisfies that the length of the message after padding is equal to 0 modulo 512; dividing the padded message into a plurality of 512-bit data blocks, and performing message expansion on each of the data blocks to obtain 64 32-bit words;

[0017] An initial hash value is set, and a compression function is used to perform 64 rounds of operations on the 64 32-bit words, and the intermediate hash value is updated to obtain interface behavior feature fingerprint data; the information entropy of the interface behavior feature fingerprint data is calculated to verify the irreversibility of the interface behavior feature fingerprint data; the Hamming distance between the interface behavior feature fingerprint data generated by different inputs is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

[0018] The interface fingerprint data obtained by performing SHA-256 hash operation on the interface definition information, input data information and return value information includes:

[0019] Acquire interface definition information, the interface definition information including interface name, interface namespace, parameter set, return value type and interface modifier set, construct a parameter feature vector according to the parameter set, the parameter feature vector including parameter type identifier, type weight, parameter constraint condition and constraint weight;

[0020] Obtain input data information, the input data information includes a data type vector, a data scale vector and a data constraint vector, and calculate boundary eigenvalues ​​according to the data type. For numerical type data, linear transformation is used to calculate boundary eigenvalues. For character type data, length is used to calculate boundary eigenvalues. For composite type data, size is used to calculate boundary eigenvalues.

[0021] Obtaining return value information, the return value information including return value type, return value status and exception information set, and calculating a status mapping value according to the return value status and a preset status weight;

[0022] The parameter feature vector, the boundary feature value and the state mapping value are serially integrated to construct a comprehensive feature vector; the mean vector and the standard deviation vector of the comprehensive feature vector are calculated, and the comprehensive feature vector is standardized by using the mean vector and the standard deviation vector to obtain a standardized feature vector; the standardized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0;

[0023] An initial hash value is set, the padded message is divided into 512-bit blocks, and each message block is iteratively calculated to obtain interface behavior feature fingerprint data; multiple groups of similar input data are selected to generate multiple interface behavior feature fingerprint data, and the Hamming distance between the multiple interface behavior feature fingerprint data is calculated, and the fingerprint stability index is calculated according to the Hamming distance; based on the length of the interface behavior feature fingerprint data and the size of the sample space, the fingerprint conflict probability is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

[0024] The database fingerprint data obtained by performing SHA-256 hash operation on the database interface input information and the database interface return information includes:

[0025] Obtaining database interface input information, the database interface input information including an SQL statement type, an operation object set, a condition set, and a parameter set, and constructing a parameterized feature vector according to the parameter set and a preset parameter weight; calculating query complexity according to the SQL statement type, the operation object set, and the condition set, and constructing an association matrix based on the operation object set, the association matrix representing the degree of association between the operation objects;

[0026] Obtaining database interface return information, the database interface return information including the number of records, field set, value range distribution and statistical characteristics, and calculating the mean vector, standard deviation vector, kurtosis and skewness according to the value range distribution; collecting database execution status information, the database execution status information including execution time, memory usage and performance indicators, and normalizing the performance indicators according to a preset performance benchmark;

[0027] The parameterized feature vector, the query complexity, the association matrix, the mean vector, the standard deviation vector, the kurtosis, the skewness and the normalized performance index are serially integrated to construct a comprehensive feature vector; the feature mean and the feature standard deviation of the comprehensive feature vector are calculated, and the comprehensive feature vector is normalized using the feature mean and the feature standard deviation to obtain a normalized feature vector;

[0028] The normalized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0; the padded message is divided into blocks, and each message block is iteratively calculated to obtain digital fingerprint data of the database interaction behavior.

[0029] Comparing the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively, and generating a test coverage report includes:

[0030] Calculating interface fingerprint similarity based on test process interface fingerprint data and reference interface fingerprint data, wherein the interface fingerprint similarity is calculated by the ratio of Hamming distance to fingerprint length; constructing an interface element weight set, and calculating interface element coverage according to the interface element weight set and an interface element coverage indicator function, wherein the interface element coverage indicator function is used to identify whether an interface element is covered by the test;

[0031] Obtain interface call path information, establish an interface call path coverage matrix, wherein each element in the interface call path coverage matrix represents the coverage status of the corresponding path; obtain a set of possible interface parameter values ​​and a set of test coverage values, calculate the coverage of each parameter, and calculate the interface parameter space coverage based on the coverage of all parameters; obtain a set of SQL statement types and SQL statement type weights, and calculate the SQL statement type coverage based on the number of coverage times and the expected number of coverage times; obtain database operation depth information, and calculate the database operation depth index based on the operation depth and coverage mark;

[0032] Set the interface coverage weight coefficient, the interface coverage weight coefficient and the database coverage weight coefficient, perform weighted fusion on the interface coverage, the interface coverage and the database coverage to obtain the comprehensive coverage; calculate the coverage gradient of each dimension coverage, and adaptively adjust the weight coefficient according to the coverage gradient and the preset learning rate; calculate the variance of each dimension coverage and the average coverage, and calculate the coverage balance based on the variance;

[0033] Acquire test time and resource consumption information, calculate test efficiency indicators according to the comprehensive coverage, the test time and the resource consumption; generate a dimensional analysis report based on the coverage of each dimension and the coverage balance; collect timing coverage data, construct a timing coverage sequence, and generate a trend analysis report; set module weights and importance coefficients, calculate the risk index according to the uncovered rate, the module weights and the importance coefficients, and generate a risk assessment report; integrate the dimensional analysis report, the trend analysis report and the risk assessment report to form a comprehensive test coverage report.

[0034] The method further comprises:

[0035] Obtaining a module complexity index, a module dependency index, and a module test coverage index of a software system, and constructing a module feature vector based on the module complexity index, the module dependency index, and the module test coverage index, wherein the module feature vector is used to characterize the characteristics of each module in the software system;

[0036] Obtain the interface set of each module in the software system, calculate the interface call set between any two modules, calculate the dependency strength between modules according to the intersection and union ratio of the interface call set and the interface set of each module, and generate a dependency edge set; for each module in the software system, obtain its code cyclomatic complexity, business criticality and defect density information, perform weighted combination of the code cyclomatic complexity, the business criticality and the defect density information to obtain the node importance, and use the node importance as the node weight; for each dependent edge in the dependent edge set, obtain its edge influence factor set and the corresponding factor weight set, and calculate the edge weight according to the weighted average of the edge influence factor set and the factor weight set; combine the module node corresponding to the module feature vector, the dependent edge set, the node weight and the edge weight to construct a risk propagation graph model;

[0037] Identify all risk propagation paths in the risk propagation graph model, and calculate the path weight of each propagation path according to the edge weights of each edge on the path; obtain the risk value of each node in each propagation path, and calculate the path risk value of a single path in combination with the position weight of the node in the path; construct a local risk matrix based on the path risk values ​​of all propagation paths, and calculate the global risk propagation value in combination with the propagation attenuation coefficient and the propagation probability; collect risk data in time series to construct a time series risk sequence, and calculate the risk change rate of adjacent sampling points, which is used to characterize the risk evolution trend;

[0038] Perform statistical analysis on the time series risk sequence, calculate its mean, standard deviation, skewness and kurtosis, and construct a risk evolution pattern feature vector, which is used to characterize the risk change pattern; construct a risk warning threshold with adaptive characteristics based on the mean and standard deviation of the time series risk sequence, and the risk warning threshold is dynamically adjusted according to the time series risk distribution; set a high risk threshold and a low risk threshold, and divide the risk level according to the relationship between the current risk value and the high risk threshold and the low risk threshold; generate risk warning information according to the risk warning adaptive threshold and the risk level division result, and the risk warning information includes risk level, risk degree and risk evolution trend.

[0039] A second aspect of an embodiment of the present invention provides a software testing system based on digital fingerprints, comprising:

[0040] The first unit is used to use an interface collector to perform static analysis on the system interface source code, obtain interface interaction action information and interface element information, and perform SHA-256 hash operation on the interface interaction action information and interface element information to obtain interface fingerprint data; use an interface collector to perform static analysis on the operation program source code, obtain interface definition information, input data information and return value information, and perform SHA-256 hash operation on the interface definition information, input data information and return value information to obtain interface fingerprint data; use a database interface collector to perform static analysis on the database interface, obtain database interface input information and database interface return information, and perform SHA-256 hash operation on the database interface input information and database interface return information to obtain database fingerprint data;

[0041] The second unit is used to monitor the running status of the system under test by using a test collector during the test execution process, record the interface operation process information, the interface call process information and the database interaction process information respectively, perform SHA-256 hash operation on the interface operation process information, the interface call process information and the database interaction process information respectively, obtain the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data, and write the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data into the test process fingerprint database;

[0042] The third unit is used to compare the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively to generate a test coverage report.

[0043] A third aspect of the embodiments of the present invention

[0044] An electronic device is provided, comprising:

[0045] processor;

[0046] a memory for storing processor-executable instructions;

[0047] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0048] According to a fourth aspect of the embodiments of the present invention,

[0049] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0050] The beneficial effects of this application are as follows:

[0051] 1. Improve test coverage: By comprehensively collecting and comparing the fingerprints of the interface, interface, and database, you can more accurately evaluate the test coverage and discover potential untested code paths, thereby improving the integrity and effectiveness of software testing.

[0052] 2. Improve test efficiency: Automatically collect and compare fingerprint data, reduce the workload of manual testing, shorten the test cycle, and improve test efficiency.

[0053] 3. Facilitate test result analysis: The generated test coverage report is clear and intuitive, which helps developers and testers to quickly understand the test status, accurately locate problems, and make targeted improvements. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A flowchart of a software testing method based on digital fingerprint according to an embodiment of the present invention;

[0055] Figure 2 The figure is a schematic diagram of the structure of a software testing system based on digital fingerprint according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0058] Figure 1 FIG. 1 is a flow chart of a software testing method based on digital fingerprint according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0059] S101. Use an interface collector to perform static analysis on the system interface source code, obtain interface interaction action information and interface element information, and perform SHA-256 hash operation on the interface interaction action information and interface element information to obtain interface fingerprint data; use an interface collector to perform static analysis on the operation program source code, obtain interface definition information, input data information and return value information, and perform SHA-256 hash operation on the interface definition information, input data information and return value information to obtain interface fingerprint data; use a database interface collector to perform static analysis on the database interface, obtain database interface input information and database interface return information, and perform SHA-256 hash operation on the database interface input information and database interface return information to obtain database fingerprint data;

[0060] S102. During the test execution process, a test collector is used to monitor the running status of the system under test, and the interface operation process information, the interface call process information and the database interaction process information are recorded respectively. The interface operation process information, the interface call process information and the database interaction process information are respectively subjected to SHA-256 hash operation to obtain the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data, and the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are written into the test process fingerprint database;

[0061] S103. Compare the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively to generate a test coverage report.

[0062] In an optional implementation, performing a SHA-256 hash operation on the interface interaction action information and the interface element information to obtain the interface fingerprint data includes:

[0063] Acquire interface interaction action information, the interface interaction action information includes an interface element identifier, an interaction action type, an interaction action parameter set, and an interaction action timing relationship, and construct the interface interaction action information as a first feature vector; acquire interface element information, the interface element information includes an element identifier, an element type, an element attribute set, and an element hierarchical relationship, and construct the interface element information as a second feature vector;

[0064] Performing data cleaning on the first feature vector and the second feature vector, wherein the data cleaning includes removing redundant attributes, standardizing attribute value formats and unifying encoding methods, to obtain a preprocessed first feature vector and a preprocessed second feature vector; merging the preprocessed first feature vector and the preprocessed second feature vector to construct a unified feature vector;

[0065] Calculating the length of the unified feature vector, determining a padding length according to the length of the unified feature vector, performing message padding on the unified feature vector, wherein the padding length satisfies that the length of the message after padding is equal to 0 modulo 512; dividing the padded message into a plurality of 512-bit data blocks, and performing message expansion on each of the data blocks to obtain 64 32-bit words;

[0066] An initial hash value is set, and a compression function is used to perform 64 rounds of operations on the 64 32-bit words, and the intermediate hash value is updated to obtain interface behavior feature fingerprint data; the information entropy of the interface behavior feature fingerprint data is calculated to verify the irreversibility of the interface behavior feature fingerprint data; the Hamming distance between the interface behavior feature fingerprint data generated by different inputs is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

[0067] The invention discloses an interface behavior characteristic fingerprint extraction method, which is used to generate an interface behavior characteristic fingerprint which is irreversible and unique.

[0068] First, obtain the interface interaction action information. This includes recording the user's operations on the interface, such as clicking a button, sliding the screen, entering text, etc. Each interaction action contains an interface element identifier (such as a button ID), an interaction action type (such as click, slide), an interaction action parameter set (such as the coordinates of the click), and a temporal relationship between the interaction actions (such as clicking button A first, then clicking button B). This information will be organized into a first feature vector. For example, if the user clicks a button with an ID of "button1", the corresponding interaction action information can be expressed as: {"elementId":"button1", "actionType":"click", "parameters":{"x":100, "y":200}, "timestamp":1678886400}.

[0069] At the same time, get the interface element information. This includes the identifiers, types, attribute sets, and hierarchical relationships of all elements on the interface. For example, the element information of a button can be expressed as: {"elementId":"button1", "elementType":"button", "attributes":{"text":"Submit", "width":100, "height":50}, "hierarchy":"form / div / button"}. This information will be organized into a second feature vector.

[0070] Next, the first feature vector and the second feature vector are cleaned. This includes removing redundant attributes (such as attributes that are not related to the interface behavior), standardizing the attribute value format (such as unifying the date format to YYYY-MM-DD), and unifying the encoding method (such as using UTF-8 encoding). For example, if the width and height of "button1" are not important for identifying the interface behavior, these two attributes can be removed. The cleaned information constitutes the preprocessed first feature vector and the second feature vector respectively.

[0071] Then, the preprocessed first feature vector and the second feature vector are merged to construct a unified feature vector. For example, the interactive action information of the user clicking "button1" and the element information of "button1" are merged into a unified feature vector.

[0072] After that, the length of the unified feature vector is calculated, and the padding length is determined according to the length, and the unified feature vector is padded with a message to ensure that the padded message length is an integer multiple of 512. The padding method can use a standard padding algorithm, such as adding a "1" bit at the end of the message, then adding several "0" bits, and finally adding the binary representation of the message length.

[0073] The padded message is divided into multiple 512-bit data blocks. Each data block will be expanded into 64 32-bit words. The expansion method can use the standard message expansion algorithm.

[0074] Set the initial hash value. Use the initial hash value specified by the SHA-256 algorithm.

[0075] The compression function is used to perform 64 rounds of operations on the 64 32-bit words of each data block to update the intermediate hash value. The compression function uses the logical functions and constants specified by the SHA-256 algorithm.

[0076] After 64 rounds of calculation, the final hash value is obtained, which is the interface behavior feature fingerprint data.

[0077] Calculate the information entropy of the interface behavior feature fingerprint data to verify its irreversibility. The higher the information entropy, the more random the data is and the stronger the irreversibility is.

[0078] Calculate the Hamming distance between the interface behavior feature fingerprint data generated by different inputs to verify its uniqueness. The larger the Hamming distance, the greater the difference between the two fingerprint data and the stronger the uniqueness.

[0079] This application can achieve:

[0080] First, security is enhanced. By performing hash operations on interface behavior information, an irreversible feature fingerprint is generated, which effectively prevents the interface behavior data from being tampered with and forged, thereby improving system security.

[0081] Second, it improves recognition accuracy. This method comprehensively considers the interface interaction action information and interface element information, constructs a more comprehensive feature vector, can more accurately identify different interface behaviors, and reduces the false recognition rate.

[0082] Third, data processing is simplified. By converting interface behavior information into fixed-length feature fingerprints, subsequent data processing and storage are simplified, improving system efficiency.

[0083] In an optional implementation, performing a SHA-256 hash operation on the interface definition information, input data information, and return value information to obtain interface fingerprint data includes:

[0084] Acquire interface definition information, the interface definition information including interface name, interface namespace, parameter set, return value type and interface modifier set, construct a parameter feature vector according to the parameter set, the parameter feature vector including parameter type identifier, type weight, parameter constraint condition and constraint weight;

[0085] Obtain input data information, the input data information includes a data type vector, a data scale vector and a data constraint vector, and calculate boundary eigenvalues ​​according to the data type. For numerical type data, linear transformation is used to calculate boundary eigenvalues. For character type data, length is used to calculate boundary eigenvalues. For composite type data, size is used to calculate boundary eigenvalues.

[0086] Obtaining return value information, the return value information including return value type, return value status and exception information set, and calculating a status mapping value according to the return value status and a preset status weight;

[0087] The parameter feature vector, the boundary feature value and the state mapping value are serially integrated to construct a comprehensive feature vector; the mean vector and the standard deviation vector of the comprehensive feature vector are calculated, and the comprehensive feature vector is standardized by using the mean vector and the standard deviation vector to obtain a standardized feature vector; the standardized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0;

[0088] An initial hash value is set, the padded message is divided into 512-bit blocks, and each message block is iteratively calculated to obtain interface behavior feature fingerprint data; multiple groups of similar input data are selected to generate multiple interface behavior feature fingerprint data, and the Hamming distance between the multiple interface behavior feature fingerprint data is calculated, and the fingerprint stability index is calculated according to the Hamming distance; based on the length of the interface behavior feature fingerprint data and the size of the sample space, the fingerprint conflict probability is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

[0089] Get the interface definition information and build the parameter feature vector. First, get the definition information of the target interface, which includes the interface name, the namespace where the interface is located, the interface parameter set (including parameter name, parameter type), the return value type, and the interface modifier set (such as public, static, etc.). Then, build the parameter feature vector based on the interface parameter set. The parameter feature vector contains the following information: the type identifier of each parameter (for example, int is represented by 1, float is represented by 2, string is represented by 3, etc.), type weight (for example, the basic type weight is 1, and the custom type weight is 2), parameter constraints (for example, whether the parameter is empty, the parameter value range, etc.), and constraint weight (for example, the non-empty constraint weight is 1, and the value range constraint weight is 2). For example, an interface has two parameters, the first parameter is age of int type, non-empty, and the second parameter is name of string type, without constraints. The parameter feature vector can be expressed as: [1, 1, 1, 1, 3, 1, 0,0], where [1, 1, 1, 1] represents the type identifier, type weight, constraint condition and constraint weight of age, and [3, 1, 0, 0] represents the type identifier, type weight, constraint condition and constraint weight of name.

[0090] Get the input data information and calculate the boundary eigenvalues. Get the input data information when the interface is actually called, which includes the data type vector (the actual type of each input parameter), the data scale vector (such as the size of the numeric type, the length of the string type, the number of elements of the array type), and the data constraint vector (such as whether the actual input data meets the constraints in the interface definition). Then, calculate the boundary eigenvalues ​​according to the data type. For numeric type data, use linear transformation to calculate the boundary eigenvalues. For example, map the minimum value of the input data to 0, the maximum value to 1, and other values ​​linearly map proportionally. For character type data, use length to calculate the boundary eigenvalue, such as the length of the string. For composite type data, use size to calculate the boundary eigenvalue, such as the number of elements in the array, the number of attributes of the object, etc. For example, an interface has two parameters, the input data of age is [18, 20, 22], and the input data of name is ["Alice", "Bob", "Charlie"], then the boundary feature value can be expressed as: [0, 1, 3, 5, 7], where [0, 1] is the boundary feature value of age, and [3, 5, 7] is the boundary feature value of name, corresponding to the lengths of the three input strings respectively.

[0091] Get the return value information and calculate the state mapping value. Get the return value information after the interface call, including the return value type, return value status (such as success, failure, exception, etc.) and exception information set (such as exception type, exception message). Then, calculate the state mapping value based on the return value status and the preset state weight. For example, the success state mapping value is 1, the failure state mapping value is 0, and different exception states are mapped to different negative values. For example, the return value type of an interface is int, and the return value status of the three calls is success, failure, and exception, respectively. The state mapping value can be expressed as: [1, 0, -1].

[0092] Construct a comprehensive feature vector and perform standardization. Construct a comprehensive feature vector by connecting the parameter feature vector, boundary feature value, and state mapping value in series. For example, connect the parameter feature vector [1, 1, 1, 1, 3,1, 0, 0], boundary feature value [0, 1, 3, 5, 7], and state mapping value [1, 0, -1] in the above example in series to obtain a comprehensive feature vector: [1, 1, 1, 1, 3, 1, 0, 0, 0, 1, 3, 5, 7, 1, 0, -1]. Then, calculate the mean vector and standard deviation vector of the comprehensive feature vector. Use the mean vector and standard deviation vector to standardize the comprehensive feature vector to obtain a standardized feature vector. The standardization method is to subtract the mean from each eigenvalue and divide it by the standard deviation.

[0093] Calculate the interface behavior feature fingerprint data. Serialize the standardized feature vector into a binary sequence. Calculate the length of the binary sequence, and determine the padding length based on the length, so that the length of the padded message modulo 512 is equal to 448. The padding method is to add a 1 at the end of the sequence, and then add several 0s. Set the initial hash value. Divide the padded message into 512-bit blocks, iteratively calculate each message block, and finally obtain 256-bit interface behavior feature fingerprint data.

[0094] Calculate fingerprint stability and conflict probability. Select multiple groups of similar input data to generate multiple interface behavior feature fingerprint data. Calculate the Hamming distance between these fingerprint data. Calculate the fingerprint stability index based on the Hamming distance. For example, the average Hamming distance, maximum Hamming distance, etc. can be calculated. Based on the length of the interface behavior feature fingerprint data (256 bits) and the size of the sample space (number of interface calls), calculate the fingerprint conflict probability and verify the uniqueness of the interface behavior feature fingerprint data. The conflict probability can be estimated using the birthday paradox formula.

[0095] This application can achieve:

[0096] Improve interface security: By extracting features and calculating fingerprints of interface behaviors, abnormal interface calls can be effectively identified and potential security risks can be discovered in a timely manner, thereby improving interface security.

[0097] Improve the accuracy of interface stability assessment: By calculating the fingerprint stability index, the stability of the interface can be evaluated more accurately, providing a reference for interface optimization and improvement.

[0098] Reduce the probability of interface fingerprint conflict: By analyzing the fingerprint length and sample space size, the probability of fingerprint conflict can be effectively reduced, the uniqueness of the interface behavior feature fingerprint can be ensured, and the accuracy of interface identification can be improved.

[0099] In an optional implementation, performing a SHA-256 hash operation on the database interface input information and the database interface return information to obtain database fingerprint data includes:

[0100] Obtaining database interface input information, the database interface input information including an SQL statement type, an operation object set, a condition set, and a parameter set, and constructing a parameterized feature vector according to the parameter set and a preset parameter weight; calculating query complexity according to the SQL statement type, the operation object set, and the condition set, and constructing an association matrix based on the operation object set, the association matrix representing the degree of association between the operation objects;

[0101] Obtaining database interface return information, the database interface return information including the number of records, field set, value range distribution and statistical characteristics, and calculating the mean vector, standard deviation vector, kurtosis and skewness according to the value range distribution; collecting database execution status information, the database execution status information including execution time, memory usage and performance indicators, and normalizing the performance indicators according to a preset performance benchmark;

[0102] The parameterized feature vector, the query complexity, the association matrix, the mean vector, the standard deviation vector, the kurtosis, the skewness and the normalized performance index are serially integrated to construct a comprehensive feature vector; the feature mean and the feature standard deviation of the comprehensive feature vector are calculated, and the comprehensive feature vector is normalized using the feature mean and the feature standard deviation to obtain a normalized feature vector;

[0103] The normalized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0; the padded message is divided into blocks, and each message block is iteratively calculated to obtain digital fingerprint data of the database interaction behavior.

[0104] A database interaction behavior fingerprint extraction method is used to generate a digital fingerprint of database interaction behavior for database security auditing and anomaly detection.

[0105] First, obtain the database interface input information. This includes capturing the type of SQL statement executed (such as SELECT, INSERT, UPDATE, DELETE), identifying the set of operation objects (such as the table name and column name involved), extracting the condition set (such as the condition expression in the WHERE clause), and obtaining the parameter set (such as the parameter value in the SQL statement). For example, for the SQL statement `SELECT * FROM users WHERE age>? AND city = ?`, the SQL statement type is SELECT, the operation object set is {users, age, city}, the condition set is {age>?, city = ?}, and the parameter set is {?, ?}. Assume that the parameter value is {25, "Some Where"}. According to the parameter set and the preset parameter weight, for example, each parameter is assigned a weight of 1, and a parameterized feature vector is constructed. In this example, it is a vector consisting of two elements [25, 1] ​​and ["Some Where", 1]. According to the SQL statement type, the operation object set, and the condition set, the query complexity is calculated. For example, a value can be calculated based on factors such as the number of tables and columns involved and the complexity of the condition expression. Assume that the calculation result is 3. Based on the set of operation objects, an association matrix is ​​constructed, which represents the degree of association between the operation objects. For example, if the age and city columns in the users table often appear together in queries, their corresponding element values ​​in the association matrix will be higher. Suppose the association matrix is ​​[[1, 0.8, 0.5],[0.8, 1, 0.2],[0.5, 0.2, 1]].

[0106] Next, obtain the information returned by the database interface. This includes obtaining the number of records returned, such as 100; identifying the field set, such as {id, name, age, city}; analyzing the value range distribution, such as the value range of the age column is distributed between 18 and 60, and the value range of the city column is distributed among several city names; calculating statistical features, such as mean, variance, etc. Calculate the mean vector based on the value range distribution, such as the mean of the age column is 35, and the mean of the city column cannot be calculated; calculate the standard deviation vector, such as the standard deviation of the age column is 10; calculate the kurtosis and skewness, such as the kurtosis of the age column is 0.5 and the skewness is -0.2. Collect database execution status information, including execution time, such as 10ms; memory usage, such as 2MB; performance indicators, such as CPU utilization, disk IO, etc. Normalize the performance indicators according to the preset performance benchmark, such as normalizing the CPU utilization from the range of 0-100% to between 0-1, assuming that the normalized CPU utilization is 0.8.

[0107] Then, the parameterized feature vector, query complexity, correlation matrix, mean vector, standard deviation vector, kurtosis, skewness and normalized performance indicators are serially integrated to construct a comprehensive feature vector. For example: [25, 1, "SomeWhere", 1, 3, [[1, 0.8, 0.5],[0.8, 1, 0.2],[0.5, 0.2, 1]], 35, 10, 0.5, -0.2,0.8]. Calculate the feature mean and feature standard deviation of the comprehensive feature vector, for example, the mean is 10 and the standard deviation is 5. Use the feature mean and feature standard deviation to normalize the comprehensive feature vector to obtain a normalized feature vector, for example, normalize 25 to (25-10) / 5=3.

[0108] Finally, the normalized feature vector is serialized into a binary sequence. The length of the binary sequence is calculated, for example, 128 bits. The padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0. For example, 512 - 128 = 384 bits need to be padded. The padded message is divided into blocks, and each message block is iteratively calculated. The SHA-256 hash algorithm is used to obtain the digital fingerprint data of the database interaction behavior, such as "e7e3c80b120c1df7052c598236798a56e3e2659d27d808e7885759996714b040".

[0109] This application can achieve:

[0110] 1. Improve database security auditing capabilities: By extracting database interaction behavior fingerprints, abnormal database operations, such as SQL injection attacks and data leaks, can be effectively identified, thereby improving the efficiency and accuracy of database security auditing.

[0111] 2. Enhance database anomaly detection capabilities: Database interaction behavior fingerprints can be used as the basis for anomaly detection, timely discover abnormal behaviors in the database, and take corresponding measures to deal with them, thereby ensuring the stability and security of the database.

[0112] 3. Simplify database behavior analysis: By converting complex database interaction behaviors into digital fingerprints, the process of database behavior analysis can be simplified, the difficulty of analysis can be reduced, and the efficiency of analysis can be improved.

[0113] In an optional implementation, the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are respectively compared with the interface fingerprint data, the interface fingerprint data and the database fingerprint data to generate a test coverage report, including:

[0114] Calculating interface fingerprint similarity based on test process interface fingerprint data and reference interface fingerprint data, wherein the interface fingerprint similarity is calculated by the ratio of Hamming distance to fingerprint length; constructing an interface element weight set, and calculating interface element coverage according to the interface element weight set and an interface element coverage indicator function, wherein the interface element coverage indicator function is used to identify whether an interface element is covered by the test;

[0115] Obtain interface call path information, establish an interface call path coverage matrix, wherein each element in the interface call path coverage matrix represents the coverage status of the corresponding path; obtain a set of possible interface parameter values ​​and a set of test coverage values, calculate the coverage of each parameter, and calculate the interface parameter space coverage based on the coverage of all parameters; obtain a set of SQL statement types and SQL statement type weights, and calculate the SQL statement type coverage based on the number of coverage times and the expected number of coverage times; obtain database operation depth information, and calculate the database operation depth index based on the operation depth and coverage mark;

[0116] Set the interface coverage weight coefficient, the interface coverage weight coefficient and the database coverage weight coefficient, perform weighted fusion on the interface coverage, the interface coverage and the database coverage to obtain the comprehensive coverage; calculate the coverage gradient of each dimension coverage, and adaptively adjust the weight coefficient according to the coverage gradient and the preset learning rate; calculate the variance of each dimension coverage and the average coverage, and calculate the coverage balance based on the variance;

[0117] Acquire test time and resource consumption information, calculate test efficiency indicators according to the comprehensive coverage, the test time and the resource consumption; generate a dimensional analysis report based on the coverage of each dimension and the coverage balance; collect timing coverage data, construct a timing coverage sequence, and generate a trend analysis report; set module weights and importance coefficients, calculate the risk index according to the uncovered rate, the module weights and the importance coefficients, and generate a risk assessment report; integrate the dimensional analysis report, the trend analysis report and the risk assessment report to form a comprehensive test coverage report.

[0118] A software test coverage evaluation method and system are used to comprehensively evaluate the effectiveness and completeness of software testing. The method generates a multi-dimensional coverage report by analyzing the test coverage of the three dimensions of interface, interface and database, and combining factors such as time and resource consumption, to assist developers in accurately identifying test risks and improving software quality.

[0119] First, during the test, the interface element operation, interface call information and database operation information are recorded in real time to form the test process fingerprint data. At the same time, the complete interface element information, interface definition and database structure information of the software system are collected or automatically generated in advance as the benchmark data. For example, the interface element information includes element type, ID, name, location, etc.; the interface information includes interface name, parameter type, parameter value range, etc.; the database information includes table name, field name, data type, etc.

[0120] Then, the test process fingerprint data is compared and analyzed with the benchmark data to calculate the coverage of each dimension. The calculation of interface coverage includes two aspects: interface element similarity and interface element coverage. Interface element similarity is calculated by comparing the difference between the interface elements accessed during the test process and the benchmark interface elements. The greater the difference, the lower the similarity. Interface element coverage is the ratio of the number of interface elements covered during the test to the total number of benchmark interface elements. Interface coverage also includes two aspects: interface call path coverage and interface parameter space coverage. Interface call path coverage is the ratio of the interface paths actually called during the test to all possible paths. Interface parameter space coverage is the ratio of the parameter value combinations covered during the test to all possible value combinations. Database coverage includes three aspects: SQL statement type coverage, database operation depth index and data record coverage. SQL statement type coverage is the coverage of various SQL statement types (such as SELECT, INSERT, UPDATE, DELETE) executed during the test. Database operation depth index evaluates the depth of database operations during the test, for example, whether complex operations such as multi-table association query and stored procedure call are covered. Data record coverage is the ratio of the number of data records accessed during the test to the total number of records in the database.

[0121] Next, set the weight coefficients for interface coverage, interface coverage, and database coverage, and perform weighted summation of the coverage of the three dimensions to obtain comprehensive coverage. The weight coefficient can be adjusted according to the characteristics of the software system and the test objectives. For example, for software systems with complex user interfaces, a higher weight can be given to interface coverage. At the same time, calculate the difference between the coverage of each dimension and the average coverage. The larger the difference, the lower the coverage balance, indicating that the distribution of test resources in different dimensions is uneven.

[0122] Subsequently, based on the calculated indicators, a dimension analysis report, a trend analysis report, and a risk assessment report are generated, and the three reports are integrated to form a comprehensive test coverage report. The dimension analysis report shows the coverage of each dimension in detail, including specific covered elements, paths, statements, and other information. The trend analysis report shows the trend of coverage over time, helping developers understand the progress and efficiency of testing. The risk assessment report calculates the risk index based on uncovered modules, weights, and importance coefficients, helping developers identify potential risk points and guiding the subsequent testing work. For example, assuming that a module has a high uncovered rate, and the weight and importance coefficient of the module are also high, the risk index of the module will be high and needs to be paid special attention.

[0123] Case: Assume a simple web application, including four interfaces: login, registration, product list, and product details, two interfaces (login interface and product list acquisition interface), and a database table (user information table). Through testing, the following data is collected: interface coverage is 80%, interface coverage is 60%, and database coverage is 90%. The weight coefficients of the interface, interface, and database are set to 0.4, 0.3, and 0.3 respectively. The comprehensive coverage is 0.4 * 80% + 0.3 * 60% + 0.3 * 90% = 77%.

[0124] This application can more comprehensively evaluate the effectiveness and completeness of software testing by comprehensively considering the three dimensions of interface, interface, and database as well as factors such as time and resource consumption, avoiding the one-sidedness caused by single-dimensional evaluation. It can calculate the risk index of each module, help developers accurately identify potential risk points, guide the optimization and improvement of testing work, and improve testing efficiency. By providing a multi-dimensional coverage report, it helps developers better understand the coverage of software testing, so that they can conduct more targeted testing and ultimately improve software quality.

[0125] In an optional implementation, the method further includes:

[0126] Obtaining a module complexity index, a module dependency index, and a module test coverage index of a software system, and constructing a module feature vector based on the module complexity index, the module dependency index, and the module test coverage index, wherein the module feature vector is used to characterize the characteristics of each module in the software system;

[0127] Obtain the interface set of each module in the software system, calculate the interface call set between any two modules, calculate the dependency strength between modules according to the intersection and union ratio of the interface call set and the interface set of each module, and generate a dependency edge set; for each module in the software system, obtain its code cyclomatic complexity, business criticality and defect density information, perform weighted combination of the code cyclomatic complexity, the business criticality and the defect density information to obtain the node importance, and use the node importance as the node weight; for each dependent edge in the dependent edge set, obtain its edge influence factor set and the corresponding factor weight set, and calculate the edge weight according to the weighted average of the edge influence factor set and the factor weight set; combine the module node corresponding to the module feature vector, the dependent edge set, the node weight and the edge weight to construct a risk propagation graph model;

[0128] Identify all risk propagation paths in the risk propagation graph model, and calculate the path weight of each propagation path according to the edge weights of each edge on the path; obtain the risk value of each node in each propagation path, and calculate the path risk value of a single path in combination with the position weight of the node in the path; construct a local risk matrix based on the path risk values ​​of all propagation paths, and calculate the global risk propagation value in combination with the propagation attenuation coefficient and the propagation probability; collect risk data in time series to construct a time series risk sequence, and calculate the risk change rate of adjacent sampling points, which is used to characterize the risk evolution trend;

[0129] Perform statistical analysis on the time series risk sequence, calculate its mean, standard deviation, skewness and kurtosis, and construct a risk evolution pattern feature vector, which is used to characterize the risk change pattern; construct a risk warning threshold with adaptive characteristics based on the mean and standard deviation of the time series risk sequence, and the risk warning threshold is dynamically adjusted according to the time series risk distribution; set a high risk threshold and a low risk threshold, and divide the risk level according to the relationship between the current risk value and the high risk threshold and the low risk threshold; generate risk warning information according to the risk warning adaptive threshold and the risk level division result, and the risk warning information includes risk level, risk degree and risk evolution trend.

[0130] The software system risk assessment and early warning method includes the following steps:

[0131] First, obtain the module information of the software system. This includes the module complexity indicators (such as the number of lines of code, cyclomatic complexity), dependency indicators (such as incoming and outgoing coupling), and test coverage indicators (such as line coverage, branch coverage). Suppose a software system has three modules A, B, and C. Module A has 500 lines of code, a cyclomatic complexity of 20, an incoming coupling of 3, an outgoing coupling of 2, and a line coverage of 80%. Module B has 800 lines of code, a cyclomatic complexity of 30, an incoming coupling of 5, an outgoing coupling of 4, and a line coverage of 70%. Module C has 1000 lines of code, a cyclomatic complexity of 40, an incoming coupling of 2, an outgoing coupling of 3, and a line coverage of 90%. Combine these indicators into a module feature vector, for example, the feature vector of module A is [500, 20, 3, 2, 80%].

[0132] Next, analyze the dependencies between modules. Obtain the interface sets of all modules in the software system, for example, the interface set of module A is {a1, a2}, the interface set of module B is {b1, b2, b3}, and the interface set of module C is {c1, c2}. Calculate the interface call set between any two modules, for example, the interface set of module A calling module B is {b1, b2}, and the interface set of module B calling module C is {c1}. Calculate the dependency strength between modules based on the ratio of the intersection and union of the interface call set and the module interface set. For example, the dependency strength of module A on module B is 2 / 3 = 66.7%, and the dependency strength of module B on module C is 1 / 3 = 33.3%. Represent these dependencies as dependency edge sets, for example, {(A, B, 66.7%), (B, C,33.3%)}.

[0133] Then, determine the weights of modules and dependency edges. For each module, obtain its code cyclomatic complexity, business criticality (e.g., high, medium, low), and defect density (e.g., number of defects per thousand lines of code). Assume that module A has a business criticality of "high" and a defect density of 2; module B has a business criticality of "medium" and a defect density of 3; and module C has a business criticality of "low" and a defect density of 1. Weighted combination of this information obtains the node importance as the node weight. For example, assuming that the weight coefficients are 0.5, 0.3, and 0.2, respectively, the node weight of module A is 0.5 * 20 + 0.3 * 2 + 0.2 * 2 = 11. For each dependency edge, obtain its edge impact factor set, such as call frequency, data volume, etc., and the corresponding factor weight set. The edge weight is calculated based on the weighted average of the edge impact factor set and the factor weight set. For example, assuming that the call frequency of edge (A, B) is 100 times / day, the data volume is 1GB / day, and the corresponding weights are 0.7 and 0.3 respectively, then the edge weight is 0.7 * 100 + 0.3 * 1 = 70.3.

[0134] The module nodes, dependency edge sets, node weights and edge weights are combined to construct a risk propagation graph model.

[0135] Identify all risk propagation paths in the risk propagation graph model, and calculate the path weight and path risk value of each path. For example, the path weight of a path A->B->C is the product of the weight of edge (A, B) and the weight of edge (B, C). The path risk value is the weighted average of the risk values ​​of each node on the path, where the risk value of a node can be determined based on factors such as its code cyclomatic complexity, business criticality, and defect density, and the position weight is determined based on the position of the node in the path.

[0136] The local risk matrix is ​​constructed based on the path risk values ​​of all propagation paths. The global risk propagation value is calculated by combining the propagation attenuation coefficient and the propagation probability.

[0137] Collect risk data in time series to build a time series risk sequence, and calculate the risk change rate of adjacent sampling points. For example, assuming that the collected risk data sequence is [10, 12, 15, 13, 16], then the risk change rate sequence is [20%, 25%, -13.3%, 23.1%].

[0138] Perform statistical analysis on the time series risk sequence, calculate its mean, standard deviation, skewness and kurtosis, and construct the risk evolution pattern feature vector. Based on the mean and standard deviation of the time series risk sequence, construct a risk warning threshold with adaptive characteristics. Set high risk threshold and low risk threshold, and divide the risk level according to the relationship between the current risk value and the high risk threshold and the low risk threshold. Generate risk warning information based on the risk warning adaptive threshold and risk level division results, including risk level, risk degree and risk evolution trend.

[0139] This application can achieve:

[0140] 1. Improve the accuracy of risk assessment: By building a risk propagation graph model, the dependencies between modules and the risk propagation path are taken into account, which can more accurately assess the risks of the software system.

[0141] 2. Realize the timeliness of risk warning: By analyzing the time series risk sequence and building an adaptive risk warning threshold, risks can be discovered and warnings can be issued in a timely manner.

[0142] 3. Enhance the effectiveness of risk management: By providing information such as risk level, risk degree and risk evolution trend, it can help the development team better understand and manage the risks of the software system.

[0143] Figure 2 FIG. 1 is a schematic diagram of the structure of a software testing system based on digital fingerprint according to an embodiment of the present invention. Figure 2 As shown, the system comprises:

[0144] The first unit is used to use an interface collector to perform static analysis on the system interface source code, obtain interface interaction action information and interface element information, and perform SHA-256 hash operation on the interface interaction action information and interface element information to obtain interface fingerprint data; use an interface collector to perform static analysis on the operation program source code, obtain interface definition information, input data information and return value information, and perform SHA-256 hash operation on the interface definition information, input data information and return value information to obtain interface fingerprint data; use a database interface collector to perform static analysis on the database interface, obtain database interface input information and database interface return information, and perform SHA-256 hash operation on the database interface input information and database interface return information to obtain database fingerprint data;

[0145] The second unit is used to monitor the running status of the system under test by using a test collector during the test execution process, record the interface operation process information, the interface call process information and the database interaction process information respectively, perform SHA-256 hash operation on the interface operation process information, the interface call process information and the database interaction process information respectively, obtain the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data, and write the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data into the test process fingerprint database;

[0146] The third unit is used to compare the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively to generate a test coverage report.

[0147] According to a third aspect of the embodiments of the present invention,

[0148] An electronic device is provided, comprising:

[0149] processor;

[0150] a memory for storing processor-executable instructions;

[0151] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0152] According to a fourth aspect of the embodiments of the present invention,

[0153] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0154] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A software testing method based on digital fingerprint, characterized in that: include: An interface collector is used to perform static analysis on the system interface source code to obtain interface interaction action information and interface element information, and a SHA-256 hash operation is performed on the interface interaction action information and interface element information to obtain interface fingerprint data; an interface collector is used to perform static analysis on the operation program source code to obtain interface definition information, input data information and return value information, and a SHA-256 hash operation is performed on the interface definition information, input data information and return value information to obtain interface fingerprint data; A database interface collector is used to perform static analysis on the database interface, obtain database interface input information and database interface return information, and perform SHA-256 hash operation on the database interface input information and database interface return information to obtain database fingerprint data; During the test execution process, a test collector is used to monitor the running status of the system under test, and the interface operation process information, the interface call process information and the database interaction process information are recorded respectively. SHA-256 hash operations are performed on the interface operation process information, the interface call process information and the database interaction process information respectively to obtain test process interface fingerprint data, test process interface fingerprint data and test process database fingerprint data, and the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are written into the test process fingerprint database; The test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data are respectively compared with the interface fingerprint data, the interface fingerprint data and the database fingerprint data to generate a test coverage report.

2. The method according to claim 1, characterized in that The interface fingerprint data obtained by performing SHA-256 hash operation on the interface interaction action information and the interface element information includes: Acquire interface interaction action information, the interface interaction action information includes an interface element identifier, an interaction action type, an interaction action parameter set, and an interaction action timing relationship, and construct the interface interaction action information as a first feature vector; acquire interface element information, the interface element information includes an element identifier, an element type, an element attribute set, and an element hierarchical relationship, and construct the interface element information as a second feature vector; Performing data cleaning on the first feature vector and the second feature vector, wherein the data cleaning includes removing redundant attributes, standardizing attribute value formats and unifying encoding methods, to obtain a preprocessed first feature vector and a preprocessed second feature vector; merging the preprocessed first feature vector and the preprocessed second feature vector to construct a unified feature vector; Calculating the length of the unified feature vector, determining a padding length according to the length of the unified feature vector, performing message padding on the unified feature vector, wherein the padding length satisfies that the length of the message after padding is equal to 0 modulo 512; dividing the padded message into a plurality of 512-bit data blocks, and performing message expansion on each of the data blocks to obtain 64 32-bit words; An initial hash value is set, and a compression function is used to perform 64 rounds of operations on the 64 32-bit words, and the intermediate hash value is updated to obtain interface behavior feature fingerprint data; the information entropy of the interface behavior feature fingerprint data is calculated to verify the irreversibility of the interface behavior feature fingerprint data; the Hamming distance between the interface behavior feature fingerprint data generated by different inputs is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

3. The method according to claim 1, characterized in that The interface fingerprint data obtained by performing SHA-256 hash operation on the interface definition information, input data information and return value information includes: Acquire interface definition information, the interface definition information including interface name, interface namespace, parameter set, return value type and interface modifier set, construct a parameter feature vector according to the parameter set, the parameter feature vector including parameter type identifier, type weight, parameter constraint condition and constraint weight; Obtain input data information, the input data information includes a data type vector, a data scale vector and a data constraint vector, and calculate boundary eigenvalues ​​according to the data type. For numerical type data, linear transformation is used to calculate boundary eigenvalues. For character type data, length is used to calculate boundary eigenvalues. For composite type data, size is used to calculate boundary eigenvalues. Obtaining return value information, the return value information including return value type, return value status and exception information set, and calculating a status mapping value according to the return value status and a preset status weight; The parameter feature vector, the boundary feature value and the state mapping value are serially integrated to construct a comprehensive feature vector; the mean vector and the standard deviation vector of the comprehensive feature vector are calculated, and the comprehensive feature vector is standardized by using the mean vector and the standard deviation vector to obtain a standardized feature vector; the standardized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0; An initial hash value is set, the padded message is divided into 512-bit blocks, and each message block is iteratively calculated to obtain interface behavior feature fingerprint data; multiple groups of similar input data are selected to generate multiple interface behavior feature fingerprint data, and the Hamming distance between the multiple interface behavior feature fingerprint data is calculated, and the fingerprint stability index is calculated according to the Hamming distance; based on the length of the interface behavior feature fingerprint data and the size of the sample space, the fingerprint conflict probability is calculated to verify the uniqueness of the interface behavior feature fingerprint data.

4. The method according to claim 1, characterized in that: The database fingerprint data obtained by performing SHA-256 hash operation on the database interface input information and the database interface return information includes: Obtaining database interface input information, the database interface input information including an SQL statement type, an operation object set, a condition set, and a parameter set, and constructing a parameterized feature vector according to the parameter set and a preset parameter weight; calculating query complexity according to the SQL statement type, the operation object set, and the condition set, and constructing an association matrix based on the operation object set, the association matrix representing the degree of association between the operation objects; Obtaining database interface return information, the database interface return information including the number of records, field set, value range distribution and statistical characteristics, and calculating the mean vector, standard deviation vector, kurtosis and skewness according to the value range distribution; collecting database execution status information, the database execution status information including execution time, memory usage and performance indicators, and normalizing the performance indicators according to a preset performance benchmark; The parameterized feature vector, the query complexity, the association matrix, the mean vector, the standard deviation vector, the kurtosis, the skewness and the normalized performance index are serially integrated to construct a comprehensive feature vector; the feature mean and the feature standard deviation of the comprehensive feature vector are calculated, and the comprehensive feature vector is normalized using the feature mean and the feature standard deviation to obtain a normalized feature vector; The normalized feature vector is serialized into a binary sequence, the length of the binary sequence is calculated, and the padding length is determined according to the length of the binary sequence, so that the length of the padded message modulo 512 is equal to 0; the padded message is divided into blocks, and each message block is iteratively calculated to obtain digital fingerprint data of the database interaction behavior.

5. The method according to claim 1, characterized in that Comparing the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively, and generating a test coverage report includes: Calculating interface fingerprint similarity based on test process interface fingerprint data and reference interface fingerprint data, wherein the interface fingerprint similarity is calculated by the ratio of Hamming distance to fingerprint length; constructing an interface element weight set, and calculating interface element coverage according to the interface element weight set and an interface element coverage indicator function, wherein the interface element coverage indicator function is used to identify whether an interface element is covered by the test; Obtain interface call path information, establish an interface call path coverage matrix, wherein each element in the interface call path coverage matrix represents the coverage status of the corresponding path; obtain a set of possible interface parameter values ​​and a set of test coverage values, calculate the coverage of each parameter, and calculate the interface parameter space coverage based on the coverage of all parameters; obtain a set of SQL statement types and SQL statement type weights, and calculate the SQL statement type coverage based on the number of coverage times and the expected number of coverage times; obtain database operation depth information, and calculate the database operation depth index based on the operation depth and coverage mark; Set the interface coverage weight coefficient, the interface coverage weight coefficient and the database coverage weight coefficient, perform weighted fusion on the interface coverage, the interface coverage and the database coverage to obtain the comprehensive coverage; calculate the coverage gradient of each dimension coverage, and adaptively adjust the weight coefficient according to the coverage gradient and the preset learning rate; calculate the variance of each dimension coverage and the average coverage, and calculate the coverage balance based on the variance; Acquire test time and resource consumption information, calculate test efficiency indicators according to the comprehensive coverage, the test time and the resource consumption; generate a dimensional analysis report based on the coverage of each dimension and the coverage balance; collect timing coverage data, construct a timing coverage sequence, and generate a trend analysis report; set module weights and importance coefficients, calculate the risk index according to the uncovered rate, the module weights and the importance coefficients, and generate a risk assessment report; integrate the dimensional analysis report, the trend analysis report and the risk assessment report to form a comprehensive test coverage report.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining a module complexity index, a module dependency index, and a module test coverage index of a software system, and constructing a module feature vector based on the module complexity index, the module dependency index, and the module test coverage index, wherein the module feature vector is used to characterize the characteristics of each module in the software system; Obtain the interface set of each module in the software system, calculate the interface call set between any two modules, calculate the dependency strength between modules according to the intersection and union ratio of the interface call set and the interface set of each module, and generate a dependency edge set; for each module in the software system, obtain its code cyclomatic complexity, business criticality and defect density information, perform weighted combination of the code cyclomatic complexity, the business criticality and the defect density information to obtain the node importance, and use the node importance as the node weight; for each dependent edge in the dependent edge set, obtain its edge influence factor set and the corresponding factor weight set, and calculate the edge weight according to the weighted average of the edge influence factor set and the factor weight set; combine the module node corresponding to the module feature vector, the dependent edge set, the node weight and the edge weight to construct a risk propagation graph model; Identify all risk propagation paths in the risk propagation graph model, and calculate the path weight of each propagation path according to the edge weights of each edge on the path; obtain the risk value of each node in each propagation path, and calculate the path risk value of a single path in combination with the position weight of the node in the path; construct a local risk matrix based on the path risk values ​​of all propagation paths, and calculate the global risk propagation value in combination with the propagation attenuation coefficient and the propagation probability; collect risk data in time series to construct a time series risk sequence, and calculate the risk change rate of adjacent sampling points, which is used to characterize the risk evolution trend; Perform statistical analysis on the time series risk sequence, calculate its mean, standard deviation, skewness and kurtosis, and construct a risk evolution pattern feature vector, which is used to characterize the risk change pattern; construct a risk warning threshold with adaptive characteristics based on the mean and standard deviation of the time series risk sequence, and the risk warning threshold is dynamically adjusted according to the time series risk distribution; set a high risk threshold and a low risk threshold, and divide the risk level according to the relationship between the current risk value and the high risk threshold and the low risk threshold; generate risk warning information according to the risk warning adaptive threshold and the risk level division result, and the risk warning information includes risk level, risk degree and risk evolution trend.

7. A software testing system based on digital fingerprint, used to implement the method according to any one of claims 1 to 6, characterized in that: include: The first unit is used to use an interface collector to perform static analysis on the system interface source code, obtain interface interaction action information and interface element information, and perform SHA-256 hash operation on the interface interaction action information and interface element information to obtain interface fingerprint data; use an interface collector to perform static analysis on the operation program source code, obtain interface definition information, input data information and return value information, and perform SHA-256 hash operation on the interface definition information, input data information and return value information to obtain interface fingerprint data; A database interface collector is used to perform static analysis on the database interface, obtain database interface input information and database interface return information, and perform SHA-256 hash operation on the database interface input information and database interface return information to obtain database fingerprint data; The second unit is used to monitor the running status of the system under test by using a test collector during the test execution process, record the interface operation process information, the interface call process information and the database interaction process information respectively, perform SHA-256 hash operation on the interface operation process information, the interface call process information and the database interaction process information respectively, obtain the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data, and write the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data into the test process fingerprint database; The third unit is used to compare the test process interface fingerprint data, the test process interface fingerprint data and the test process database fingerprint data with the interface fingerprint data, the interface fingerprint data and the database fingerprint data respectively to generate a test coverage report.

8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Multi-dimensional equipment fingerprint generation method and system, equipment and medium

    CN117556403A

  • Page test method and device, electronic equipment and storage medium

    CN118245362A