A large model-based industrial application software code testing method

By constructing a function call topology graph and generating code semantic feature vectors, the core business modules of industrial application software are automatically identified and tested, solving the problems of unreasonable resource allocation and low efficiency in existing technologies, and achieving efficient automated testing.

CN122173400APending Publication Date: 2026-06-09BEIJING XINLUHANG TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XINLUHANG TECHNOLOGY CO LTD
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies lack objective and quantitative data support when identifying the core business modules of industrial application software, leading to unreasonable resource allocation. Furthermore, traditional methods are inefficient and error-prone when dealing with large-scale software, and are difficult to cover complex calling scenarios.

Method used

By parsing the source files of industrial application software, constructing a function call topology graph and mapping it to a high-dimensional numerical coordinate system, generating code semantic feature vectors, calculating node importance scores, automatically identifying core business function sets and generating key execution paths, reverse deriving path triggering constraints, and automatically generating regression test case data.

Benefits of technology

It enables automated and intelligent testing of industrial application software, ensuring that testing resources are precisely allocated to the most valuable and highest-risk functional links, thereby improving testing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173400A_ABST
    Figure CN122173400A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of APP development, in particular to an industrial application software code testing method based on a large model, which comprises the following steps: receiving an industrial application software source file, parsing function definition statements and interface calling instructions in the file, extracting logical connection relationships between various business modules, constructing a function calling topological graph reflecting code unit directivity, and mapping code character sequences of each node in the function calling topological graph to a high-dimensional numerical coordinate system through a large model. In the application, conditional branching and parameter type reverse deduction are performed on a key path, constraint conditions are solved, and regression test case data capable of triggering a specific business scenario are automatically generated. In this way, the selection of a test focus, the discovery of a key path and the generation process of test data are automated and intelligentized, so that test resources can be accurately invested in function links with the highest value and the highest risk in software, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of APP development technology, and in particular to a method for testing industrial application software code based on a large model. Background Technology

[0002] The shortcomings of existing technologies lie in the fact that conventional application software development and testing processes rely on the business experience and subjective judgment of developers or testers when identifying core business modules. This approach lacks objective, quantifiable data support, leading to biases in the assessment of system importance. Resources may be allocated to modules with complex functions but low business value, while neglecting core nodes with simple logic but crucial call chains. Furthermore, traditional methods for tracing critical business execution paths typically require manual code reading or reliance on outdated documentation. When dealing with large-scale, continuously iterating industrial software, this approach is inefficient, error-prone, and fails to cover complex call scenarios spanning multiple modules. Therefore, improvements are needed. Summary of the Invention

[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for testing industrial application software code based on a large model.

[0004] To achieve the above objectives, the present invention adopts the following technical solution: a method for testing industrial application software code based on a large model, comprising the following steps: Receive source files of industrial application software, parse the function definition statements and interface call instructions inside the files, extract the logical connection relationships between various business modules, construct a function call topology graph that reflects the directionality of code units, and map the code character sequences of each node in the function call topology graph to a high-dimensional numerical coordinate system through a large model to generate code semantic feature vectors. Based on the function call topology graph, the number of edges pointed to by each node and the weight value of the source node are counted, the importance score of the generated function node is calculated, the distance between the semantic feature vectors of the code is calculated, and a vector space similarity matrix is ​​generated. Based on the importance score of the function node, the nodes are sorted in descending order of numerical value, and the nodes in the top interval are selected as high-priority test objects to generate a core business function set. The vector space similarity matrix is ​​traversed using the core business function set as an index to filter and generate key business execution paths. The conditional branch statements and parameter type definitions in the critical business execution path are analyzed, and the variable value range and logical judgment conditions that can activate the path are deduced in reverse. Path triggering constraints are generated, and the intersection and union operations of the numerical ranges in the path triggering constraints are performed to solve for the parameter combinations that satisfy the constraints and generate regression test case data.

[0005] Preferably, the steps for obtaining the code semantic feature vector are as follows: Receive source files of industrial application software, locate the start and end line numbers of function definition statements line by line, extract the function name identifier and parameter list character sequence, locate the call point line number of interface call instructions line by line, extract the called interface name identifier and actual parameter expansion character sequence, and generate a set of function definition statements and a set of interface call instructions. Based on the set of function definition statements and the set of interface call instructions, match the called interface name identifier in the set of interface call instructions with the function name identifier in the set of function definition statements, record the call point line number and the start and end line numbers of the called function for each matching relationship, count the cross-function jump direction and cross-module jump direction within each business module, form the logical connection relationship between each business module and generate a function call topology diagram; Based on the function call topology graph, the node code character sequence is extracted according to the start and end line numbers of the called function corresponding to the node. Character standardization and segmentation are performed on the node code character sequence. High-dimensional numerical coordinates are output through the large model. The distribution of dimensional values ​​is statistically analyzed according to the coordinate dimensions and dimensional normalization is performed. If the absolute value of the skewness of the dimensional value distribution exceeds the preset skewness threshold, the dimensional recalibration loop is triggered and the coordinate results are updated to obtain the code semantic feature vector.

[0006] Preferably, the steps for obtaining the importance score of the function node are as follows: Based on the function call topology graph, the number of incoming edges pointed to by each node is counted, the code semantic feature vector corresponding to the source node is read for each incoming edge and the vector magnitude is calculated, the importance transfer ratio is constructed according to the direction of the incoming edge and iteratively updated, the node semantic information and topology pointing relationship are fused, and the importance score of the function node is calculated.

[0007] Preferably, the steps for obtaining the vector space similarity matrix are as follows: Based on the importance score of the function node, the semantic feature vector of the code module is read one by one, and the distance between the code modules is calculated. Based on the distance, a distance index relationship is constructed by combining code modules in pairs. The distance is written into the corresponding row and column positions, and the matrix cells are filled according to the module index order to maintain a one-to-one correspondence between the matrix rows and columns and the code modules, thereby generating a vector space similarity matrix.

[0008] Preferably, the steps for obtaining the core business function set are as follows: Extract the importance score of each function node, sort them in descending order according to the importance score, record the ordinal number of each function node after sorting, extract the function nodes whose ordinal numbers fall into the top interval, mark the function nodes in the top interval as high-priority test objects, and generate a sequence of high-priority test object nodes. Read the function identifier of each function node in the sequence of high-priority test object nodes, remove duplicates according to the function identifier while keeping the ordinal number order unchanged, write it into the core index table and lock the index range of the core index table to form the core business function set.

[0009] Preferably, the steps for obtaining the key business execution path are as follows: Locate the row index of the vector space similarity matrix according to each function identifier in the core business function set, traverse the distance row by row and compare it with a preset threshold, extract the associated node identifiers whose distance exceeds the preset threshold, verify the call relationship of the associated nodes according to the directed edge order of the function call topology graph, and concatenate the associated node identifiers with the function identifiers in the core business function set according to the call order to obtain the key business execution path.

[0010] Preferably, the step of obtaining the path triggering constraint is as follows: The key business execution path is parsed, the conditional branch statement text in the path is read one by one, the position of the conditional operator is located and the lvalue expression and rvalue expression are split, the comparison constant and comparison variable identifier are extracted, the parameter type definition statement in the path is read one by one, the parameter name identifier and parameter type identifier are extracted, and the conditional branch statement parsing result and parameter type definition parsing result are generated. Based on the parsing results of the conditional branch statements and the parameter type definition, the parameter name identifier is associated with the comparison variable identifier. The range of variable values ​​that can satisfy the comparison relationship is deduced in reverse for each conditional branch statement. The boundary format of the variable value range is verified by the parameter type identifier and mismatched boundaries are eliminated. Multiple variable value ranges corresponding to the same parameter name identifier are merged to generate path triggering constraints.

[0011] Preferably, the steps for obtaining the regression test case data are as follows: Based on the path-triggered constraints, all variable value ranges are aggregated by parameter name identifier. The intersection of the variable value ranges is used to obtain the strongly constrained value range, and the union of the variable value ranges is used to obtain the weakly constrained value range. Parameter combinations are enumerated first according to the strongly constrained value range, and missing parameters are filled in for the weakly constrained value range. The parameter name identifier and parameter value are written according to the standard input interface format of the industrial APP to generate regression test case data.

[0012] Compared with the prior art, the advantages and positive effects of the present invention are as follows: This invention extracts function definitions and interface calls from the source files of industrial application software, constructs a function call topology graph reflecting the directionality of code units, and maps the code character sequences of nodes in the graph to a high-dimensional numerical coordinate system using a large model, achieving numerical encoding conversion of code text features. This processing method can delve into the semantic level of the code and establish a quantitative understanding of the code's functional intent. Based on this, iterative calculations are performed by integrating the node pointing relationships in the topology graph with the semantic vector magnitude of the nodes to generate function node scores that take into account both structural importance and semantic complexity. This ensures that the identified core functional units not only occupy pivotal positions in the call chain but also carry rich business logic. Subsequently, by calculating the Euclidean distance between the semantic feature vectors of the code and using the node importance score to nonlinearly modulate this distance, the functional correlation between different code modules can be quantified more accurately, especially amplifying the semantic differences between key modules. Core functions are selected based on importance scores, and closely related nodes are discovered by combining the vector space distance matrix, which can automatically assemble and generate a complete execution path that runs through the core business. Finally, the critical path is deduced in reverse, including conditional branches and parameter types, and constraints are solved to automatically generate regression test cases that can trigger specific business scenarios. This automates and automates the selection of test focus, the discovery of critical paths, and the generation of test data, ensuring that test resources are precisely allocated to the most valuable and highest-risk functional links in the software, thus improving testing efficiency. Attached Figure Description

[0013] Figure 1 This is a schematic diagram of the steps of the present invention. Detailed Implementation

[0014] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0015] Please see Figure 1 This invention provides a technical solution: a method for testing industrial application software code based on a large model, comprising the following steps: Receive source files of industrial application software, parse the function definition statements and interface call instructions inside the files, extract the logical connection relationships between various business modules, construct a function call topology graph that reflects the directionality of code units, and map the code character sequences of each node in the function call topology graph to a high-dimensional numerical coordinate system through a large model to generate code semantic feature vectors. Based on the function call topology graph, count the number of edges that each node points to and the weight value of the source node, calculate the importance score of the generated function node, calculate the distance between the semantic feature vectors of the code, and generate a vector space similarity matrix. Based on the importance score of the function node, the nodes are sorted in descending order of numerical value. The nodes in the top interval are selected as high-priority test objects to generate a core business function set. The vector space similarity matrix is ​​traversed with the core business function set as the index to filter and generate key business execution paths. The system analyzes the conditional branch statements and parameter type definitions in the critical business execution path, reverse-engineers the variable value range and logical judgment conditions that can activate the path, generates path triggering constraints, performs intersection and union operations on the numerical ranges in the path triggering constraints, solves for parameter combinations that satisfy the constraints, and generates regression test case data.

[0016] The steps for obtaining the semantic feature vector of the code are as follows: Receive source files of industrial application software, locate the start and end line numbers of function definition statements line by line, extract the function name identifier and parameter list character sequence, locate the call point line number of interface call instructions line by line, extract the called interface name identifier and actual parameter expansion character sequence, and generate a set of function definition statements and a set of interface call instructions. Based on the set of function definition statements and the set of interface call instructions, match the called interface name identifier in the set of interface call instructions with the function name identifier in the set of function definition statements, record the call point line number and the start and end line numbers of the called function for each matching relationship, count the cross-function jump direction and cross-module jump direction within each business module, form the logical connection relationship between each business module and generate a function call topology graph; Based on the function call topology graph, the node code character sequence is extracted according to the start and end line numbers of the called function corresponding to the node. Character standardization and segmentation are performed on the node code character sequence. High-dimensional numerical coordinates are output through the large model. The distribution of dimensional values ​​is statistically analyzed according to the coordinate dimensions and dimensional normalization is performed. If the absolute value of the skewness of the dimensional value distribution exceeds the preset skewness threshold, the dimensional recalibration loop is triggered and the coordinate results are updated to obtain the code semantic feature vector.

[0017] Specifically, based on the received industrial application software source file, the source file content is loaded one by one using a character stream reading method. A stack structure is created to record the code level depth. The text characters in the file are scanned line by line. When a keyword representing a function definition, such as void, int, or def, is scanned, the current line number is immediately marked as the function's starting line number, and a left curly brace is pushed onto the stack. The scanning continues downward until the corresponding right curly brace is matched and the stack is empty. At this point, the current line number is marked as the function's ending line number. During this process, regular expressions are used to match function name identifiers. The rule is set to start with a letter or underscore followed by any combination of letters and numbers. At the same time, the string within the brackets is parsed, and the parameter list character sequence is identified by comma separation. The extracted function name, starting and ending line numbers, and parameter list are stored in a temporary storage area. Then, the scanning pointer is reset and the scan is repeated. The process involves traversing the file, searching for function call patterns in all non-comment lines (identifying structures where an identifier is immediately followed by a left parenthesis), excluding lines already identified as function definitions, recording the line number where the call occurred as the call point line number, extracting the identifier before the parentheses as the called interface name, and extracting all characters inside the parentheses as the argument expansion character sequence. For nested calls, a recursive descent parsing method is used to parse the innermost call instruction first, expanding outwards layer by layer until the outermost call. All identified call information is stored in a list in the order of appearance. For cross-file calls, the reference declaration statements at the beginning of the file are parsed, and a mapping index between the external file name and the namespace within the current file is established to ensure that the extracted called interface name contains the complete namespace path. Finally, all parsed data is summarized to generate a set of function definition statements and a set of interface call instructions.

[0018] Based on the set of function definition statements and the set of interface call instructions, each element in the set of interface call instructions is traversed to extract the name identifier of the called interface. A full search and exact string matching are performed in the set of function definition statements. If a function with the same name exists, the number and data types of the character sequences in the expanded actual parameter list and the formal parameter list are compared to calculate the matching confidence. The function definition with the highest confidence is selected as the target function. The start and end line numbers of the target function in the original file are located. The call point line number in the interface call instruction is used as the source point, and the start line number of the matched target function is used as the end point to construct a directed connection edge. Simultaneously, the file path identifiers of the source point and the end point are read and compared to determine if they are the same. If they are different, it is marked as a cross-module jump; if they are the same, it is marked as a cross-function jump within the module. The process involves several steps: First, it counts the total number of cross-module jumps initiated and received by each business module, calculates the coupling degree between modules, instantiates all matched source and destination functions as nodes in a graph structure, and instantiates determined jump relationships as directed edges in the graph structure. Each directed edge is assigned an initial weight value of 1. If two nodes have multiple call relationships, the weight value is accumulated based on the original weight value. For example, if function A calls function B 3 times, the weight of the edge pointing from A to B is updated to 3. Then, it iterates through all established connections, checks for isolated nodes (function nodes without any incoming or outgoing edges), marks them as dead code nodes, and removes them from the graph structure. Finally, it organizes the remaining nodes and edge relationships to form the logical connection relationships between business modules and generates a function call topology graph.

[0019] Based on the function call topology graph, the start and end line numbers of the called function recorded in each node are read. All code text within the specified line number range is located and extracted from the source file. Comment lines, blank lines, and pure formatting characters are removed. The remaining code character sequence is standardized by uniformly replacing all variable names with placeholders (VAR) and all string constants with placeholders (STR), while preserving keywords, operators, and control flow statement structures. The standardized code is segmented using the byte-pair encoding (BPE) algorithm to generate a token sequence. A pre-trained language model based on the Transformer architecture is constructed. This model contains a 12-layer encoder structure, each consisting of a multi-head self-attention mechanism and a feedforward neural network. The number of attention heads is set to 12, and the hidden layer dimension is 768. The aforementioned token sequence is input to the model input layer, and semantic embedding vectors are superimposed through positional encoding. In the multi-head self-attention mechanism, the query vector is calculated. Key vector Sum value vector The interaction between them is expressed by the formula: ,in, Represents the query matrix. Represents the key matrix. Represents a value matrix, This represents the dimension of the key vector, which is 64 in this case. The normalized exponential function is used to capture long-range dependencies in the code context. After deep feature extraction through 12 layers of encoders, the 768-dimensional vector corresponding to the CLS special markers output from the last layer is extracted as the original high-dimensional numerical coordinates. The numerical distribution of this vector in the 768 dimensions is calculated, the values ​​in each dimension are statistically analyzed, and the skewness coefficient of the vector dimension is calculated using the following formula: ,in, Indicates the skewness coefficient. This represents the total number of vector dimensions, which is 768 in this case. Indicates the first The values ​​of each dimension This represents the average value of all dimensions. A preset skewness threshold of 1.5 is set. If the absolute value of the calculated skewness coefficient is greater than 1.5, the vector distribution is considered to have severe data skewness, triggering a dimension recalibration loop. This loop performs a logarithmic transformation on each dimension of the vector to smooth the distribution. The transformation formula is... ,in, Represents the transformed th Each dimension value For symbolic functions, Given the natural logarithm function, repeat the above steps of skewness calculation and transformation until the absolute value of the skewness coefficient is less than or equal to 1.5 or the maximum number of iterations is reached (5). Perform L2 norm normalization on the final vector to scale the vector magnitude to 1, thus obtaining the code semantic feature vector.

[0020] The steps to obtain the importance score of a function node are as follows: Based on the function call topology graph, the number of incoming edges pointed to by each node is counted. For each incoming edge, the code semantic feature vector corresponding to the source node is read and the vector magnitude is calculated. The importance transfer ratio is constructed according to the direction of the incoming edges and iteratively updated. The node semantic information and the topology pointing relationship are fused to calculate the function node importance score. The calculation formula is as follows: ; in, Indicates the first After the first iteration Function node importance score for each function node Indicates the first During the first iteration Function node importance score for each function node The first function in the function call topology graph represents the... The nth function node points to the nth The number of edges in each function node. Indicates the first The nth function node points to the nth The number of edges in each function node. Indicates the first The code semantic feature vector corresponding to each function node Represents the semantic feature vector of the code The vector magnitude is obtained by taking the square root of the sum of the squares of each component. Indicates the first The code semantic feature vector corresponding to each function node This represents the total number of function nodes in the function call topology graph. This indicates the iteration number of the importance value.

[0021] Specifically, the formula for calculating the importance score of function nodes incorporates the magnitude of the code semantic feature vector. As a physical quantity for measuring the complexity or information density of code logic, function nodes with more complex logic and heavier semantics can obtain higher allocation weights when receiving importance transmission, thereby quickly converging to the core business node. parameter This parameter represents the total number of function nodes in the function call topology graph. The steps to obtain this parameter are: traverse the completed function call topology graph data structure in memory, and count the number of unique function objects stored in the node list of the graph using a counter. For example, when parsing the source code of an industrial PLC control software, if a total of 20 function nodes are identified, including the main control loop, IO read / write, and alarm handling, then... ; parameter The first function in the function call topology graph represents the... The nth function node points to the nth The number of edges in the nth function node is obtained by locating the nth function node. For each function node object, read the outgoing edge data from its adjacency list and count the indexes pointing to the target index. The number of edges, for example, function nodes. The (main control loop) explicitly calls function nodes in different branches of the code. (Complex algorithm calculation) A total of 2 calculations were performed, and the statistics were obtained. ; parameter Indicates the first The nth function node points to the nth The number of edges in each function node, and how it is obtained is the same as... Consistency, used for computing nodes The sum of the denominators of the weights assigned to all neighboring nodes, for example, the node Besides pointing In addition to (2 times), it also points to the node. (Simple state reset) once, then the corresponding ; parameter Indicates the first The code semantic feature vector corresponding to the nth function node is obtained by taking the nth function node as the first function node. The source code character sequence of a function is input into a pre-trained large code model (such as CodeBERT). The original semantic embedding vectors of the model's output layer, which have not undergone L2 normalization, are extracted to preserve code length and complexity features. For example, for logically complex "algorithm calculation" functions... The model outputs a 4-dimensional feature vector as follows: (Larger numerical values ​​indicate more significant characteristics); parameter Represents the semantic feature vector of the code The vector magnitude is obtained by taking the square root of the sum of the squares of each component. The steps to obtain this parameter are: read the vector... For each dimension value, calculate its square value and sum them up. Finally, take the square root of the sum. The formula is: ; parameter Indicates the first The code semantic feature vector corresponding to each function node is obtained and calculated in the same way as... Same, for example, nodes The code is very concise, and its feature vector is Then its modulus is calculated as The difference in modulus here (2.0 vs 0.2) reflects the difference in semantic complexity; parameter Indicates the first During the first iteration The function node importance score for each function node in the initial round. At that time, this parameter is set to a uniform distribution, that is... ,For example hour, ; Calculations based on parameters: Set the current scene as a computing node Distribute importance to its child nodes, node Pointing to node (2 times, module length 2.0) and nodes (1 time, module length 0.2), and , First, calculate the denominator (node). (total weighted out-degree) Sum_denominator ; ; ; Then calculate the nodes. Passed to the node Scale factor (visible nodes) (Due to its advantages in modulus length and number of sides, it receives the majority of the weight) Ratio_i ; Last computed node In the Round contribution to nodes Rating increment: Contribution ; node In the next iteration, it achieved an importance score contribution of 0.0476, which is much higher than that of ordinary nodes. This indicates that the algorithm successfully identified key business logic by utilizing code semantic features (module length). As the iteration progresses, the scores of nodes with high module length and high frequency of calls will continue to accumulate and increase.

[0022] The steps to obtain the vector space similarity matrix are as follows: Based on the importance score of function nodes, the semantic feature vectors of the code modules are read one by one, and the distance between code modules is calculated using the following formula: ; in, Indicates the first The code module and the first The distance between code modules Indicates the first The importance score of the function nodes corresponding to each code module. Indicates the first The importance score of the function nodes corresponding to each code module. Indicates the first The code semantic feature vector of the code module is in the first... Component values ​​in each dimension Indicates the first The code semantic feature vector of the code module is in the first... Component values ​​in each dimension This represents the number of dimensions in the code semantic feature vector. Indicates the code module number, Indicates the code module number, Indicates the vector dimension index; Based on the distance, a distance index relationship is constructed by pairwise combination of code modules. The distance is written into the corresponding row and column positions, and the matrix cells are filled according to the module index order to maintain a one-to-one correspondence between the matrix rows and columns and the code modules, thereby generating a vector space similarity matrix.

[0023] Specifically, in the distance calculation formula, by introducing the importance score of function nodes into the distance calculation, the dimension of business status is superimposed on the basis of semantic similarity calculation. That is, the "logical distance" between two nodes with higher importance will be amplified by the logarithmic term, so that the differences between core business nodes can be more sensitively controlled in subsequent clustering or path selection. parameter This parameter represents the number of dimensions in the code semantic feature vector. The steps to obtain this parameter are: read the hidden layer dimension parameters from the large model configuration file, and set... ; parameter and The code module number indicates the two objective function nodes involved in the distance calculation, for example... Representing high-importance nodes , Representative low importance nodes ; parameter Indicates the first The importance score of function nodes corresponding to each code module is obtained by reading the final score result after multiple rounds of iterative convergence. For example, after convergence, the core nodes... The ratings accumulated to ; parameter Indicates the first The importance score of function nodes corresponding to each code module is obtained by following these steps, for example, for edge nodes. The scores converged to ; parameter Indicates the first The code semantic feature vector of the code module is in the first... The component values ​​in each dimension are obtained by directly calling the obtained node values. eigenvectors ,but ; parameter Indicates the first The code semantic feature vector of the code module is in the first... The component values ​​in each dimension, the steps to obtain this parameter are as follows: call the obtained node... eigenvectors ,but ; Calculations based on parameters: First, calculate the Euclidean distance between the two vectors (reflecting purely semantic differences): Diff_sq_sum ; Euclidean_dist ; Then, the importance-weighted coefficient (reflecting the impact of business position) is calculated: Weight_factor ; Calculated ; Finally, calculate the weighted distance: ; No. The code module and the first The weighted distance between the code modules is 0.54, a value that combines the significant differences in their semantic meaning (Euclidean distance 1.8) with the moderating effect of their respective importance scores (0.3 and 0.05), due to the logarithmic coefficient being less than 1 (because...). The value is usually small), which actually reduces the pure semantic distance to a certain extent. However, if the two nodes are extremely important (e.g., (and exceeding 1.72), the coefficient will be greater than 1, thus amplifying the distance and achieving dynamic adjustment.

[0024] Based on the distance, allocate a contiguous floating-point data buffer in the memory heap to store the similarity matrix of the vector space with dimension N by N. Define a bidirectional hash table to bind the unique identifier of each code module (such as the fully qualified name of the function including the namespace) to the row and column indices of the matrix, ensuring that the index value idx uniquely corresponds between 0 and N-1. Start a nested loop program, with the outer loop control variable row iterating from 0 to N-1, and the inner loop control variable col iterating from 0 to N-1. In each loop iteration, call the distance value between code module row and code module col calculated in the previous steps. Perform boundary check logic. If row equals col, directly assign the value 0.0 to the diagonal element Matrix[row][col]. If row does not equal col, then the calculated value will be... The values ​​are assigned to Matrix[row][col]. Utilizing the symmetry of the distance matrix, the same value is assigned to Matrix[col][row] to reduce computation by half. Before assignment, a data validation step is set to check if the distance value is not a non-numeric NaN or infinity Inf. If an outlier is found, it is replaced with a preset maximum penalty distance value (e.g., 1000.0). After filling all cells, the matrix is ​​traversed row by row, and the statistical characteristics (such as row mean) of each row's elements are calculated to verify the sparsity and numerical distribution of the matrix. Finally, the constructed matrix object is serialized and saved to the cache, maintaining a one-to-one correspondence between the matrix rows and columns and the code modules, generating a vector space similarity matrix.

[0025] The steps to obtain the core business function set are as follows: Extract the function node importance score corresponding to each function node, sort them in descending order according to the function node importance score, record the ordinal number of each function node after sorting, extract the function nodes whose ordinal numbers fall into the top interval, mark the function nodes in the top interval as high-priority test objects, and generate a sequence of high-priority test object nodes. Read the function identifier of each function node in the sequence of high-priority test object nodes, remove duplicates according to the function identifier while keeping the ordinal number order unchanged, write it into the core index table and lock the index range of the core index table to form the core business function set.

[0026] Specifically, the importance score of each function node is extracted. First, a temporary structure array is allocated in memory to store key-value pairs. The key is the unique identifier of the function node, and the value is the floating-point importance score of that node that finally converged in the previous iteration. The quicksort algorithm is then used to process this array. The element in the middle of the array is selected as the pivot value. Elements with scores greater than the pivot value are swapped to the left, and elements with scores less than the pivot value are swapped to the right. This process is recursively executed until the entire array is sorted in descending order of importance scores. The index position of each function node in the array after sorting is recorded as its ordinal number. For example, the ordinal number of the first element in the array is 1. Then, the criterion for truncating the top interval is determined. This criterion is obtained by calculating the percentage cutoff point of the total number of nodes. For example, if the core coverage rate is set to 20%, and the total number of nodes... Then the truncation threshold is calculated as follows: Function nodes with serial numbers between 1 and 10 are selected. To exclude long-tail nodes that rank highly but have low absolute scores, an absolute score threshold is introduced. This threshold is set to twice the average score of all nodes. For example, if the average score of all nodes is 0.02, the threshold is 0.04. If the score of the 10th node is lower than 0.04, the selection range is further narrowed. The nodes that finally meet the criteria are uniformly marked as "High_Priority" and a high-priority tag is added to the metadata. The detailed information objects of these nodes are read in sequence to construct an ordered list containing node ID, score, and original code reference, generating a sequence of high-priority test object nodes.

[0027] Read the function identifier of each function node in the high-priority test object node sequence, initialize a hash set (HashSet) to record the processed function IDs for fast deduplication verification, and create an empty dynamic list to store the final core index. Iterate through each element in the high-priority test object node sequence, extract its function identifier string, check if the identifier exists in the hash set, append the identifier to the dynamic list and insert it into the hash set if it doesn't exist, skip the current element if it already exists. This ensures that each core business function is indexed only once in subsequent processing. Maintaining the order of the serial numbers means strictly following the priority order established based on importance scores in the original sequence during deduplication. After traversal, obtain the starting and ending memory addresses of the dynamic list, calculate the total number of elements in the list, mark the memory area containing the list as read-only to prevent unauthorized write operations from modifying the definition of the core business logic, and record the starting index 0 and ending index Length-1. For example, if 8 core functions remain after deduplication, the index range is locked as [0, ...]. [7] The range information and the list header pointer are encapsulated into a core index descriptor, which serves as the entry handle for subsequent matrix queries, forming a core business function set.

[0028] The steps to obtain the critical business execution path are as follows: The similarity matrix of the vector space is located by the row index of each function identifier in the core business function set. The distance is traversed row by row and compared with a preset threshold. The identifiers of related nodes whose distance exceeds the preset threshold are extracted. The call relationship of related nodes is verified according to the directed edge order of the function call topology graph. The related node identifiers are concatenated with the function identifiers in the core business function set in the call order to obtain the key business execution path.

[0029] Specifically, the row index of the vector space similarity matrix is ​​located by the function identifier within the core business function set. The corresponding distance data row is quickly accessed using the matrix's row pointer array. The distance values ​​recorded in each row are traversed row by row to find the distance values ​​with all other nodes. A preset threshold parameter is read, which is set based on statistical characteristics of the distance distribution, such as calculating the average of all distance values ​​in the row. with standard deviation Set a judgment threshold This means filtering out nodes whose distance is less than the average level, or setting a fixed density threshold based on business experience, for example, in the normalized distance space [0, ... In [1], a threshold of 0.2 is set. The distance value currently traversed is compared with the threshold. The identifiers of associated nodes whose distance values ​​meet the judgment conditions are extracted. These nodes are temporarily stored in the candidate association list. Then, the function calls the topology graph data structure and verifies the call relationship of the associated nodes in the order of directed edges. It checks whether the core function node directly points to the candidate associated node as the source node, or whether the candidate associated node points to the core function node. That is, it verifies whether there is a real control flow path between the two. Pseudo-associated nodes that are close in distance in the vector space but have no direct call relationship in the actual code logic are eliminated. For example, if node A and node B are semantically similar but have no call edge, they are removed from the candidate list. For nodes that pass the verification, the core node identifier and the associated node identifier are concatenated into strings according to the call direction recorded in the topology graph (such as A calling B), separated by the connector "->". For example, "Func_Core->Func_Associated" is generated. All the generated concatenated strings are stored in the path set to obtain the key business execution path.

[0030] The steps to obtain path triggering constraints are as follows: The system analyzes the key business execution paths, reads the conditional branch statement texts in each path, locates the conditional operator positions and splits the lvalue expression and rvalue expression, extracts the comparison constant and comparison variable identifiers, reads the parameter type definition statements in each path, extracts the parameter name identifier and parameter type identifier, and generates the conditional branch statement parsing results and parameter type definition parsing results. Based on the parsing results of the conditional branch statements and the parameter type definition, the parameter name identifier is associated with the comparison variable identifier. The range of variable values ​​that can satisfy the comparison relationship is deduced in reverse for each conditional branch statement. The boundary format of the variable value range is verified by the parameter type identifier and mismatched boundaries are eliminated. Multiple variable value ranges corresponding to the same parameter name identifier are merged to generate path triggering constraints.

[0031] Specifically, parsing the critical business execution path first involves calling the Abstract Syntax Tree (AST) parser stored in memory to load the source code text of all function nodes contained in the critical business execution path. A depth-first traversal algorithm is then used to access each node in the AST, identifying control flow nodes labeled IfStatement, SwitchStatement, and WhileStatement. For each control flow node, the conditional expression within its parentheses is retrieved, and the expression parsing subroutine is called to break down the complex Boolean expression into the smallest unit of binary comparison expressions. For example, "A > 5 && B < 3" is broken down into "A > 5" and "B < 3". The system uses two independent constraint units (3") to locate the relational operators in each binary expression, including symbols such as greater than, less than, equal to, and not equal to. These operators then divide the expression into left-hand (L) and right-hand (R) values. Typically, the L is a variable identifier, and the R is a constant value or constant expression. The string name of the L is extracted as the comparison variable identifier, and the R is extracted as the comparison constant. If the R is a variable, constant propagation analysis is performed to obtain its static value. Then, the system enters the symbol table lookup phase, searching for the variable's definition and declaration statement in the scope chain based on the variable identifier. It reads the type modifiers used in the variable declaration, such as int, float, and unsigned char, and maps these type keywords to specific byte lengths and numerical encoding formats. Parameter name identifiers and parameter type identifiers are extracted. All extracted information is encapsulated into a structured metadata object. For class member variables or structure fields, the type definition of their parent object is recursively parsed to ensure the integrity of the type information. Finally, the system summarizes the logical judgment information from all path nodes, generating the conditional branch statement parsing results and parameter type definition parsing results.

[0032] Based on the parsing results of conditional branch statements and parameter type definitions, a mapping table from variable names to constraints is established. The metadata of each parsed conditional branch statement is traversed, and the comparison variable identifier is read. Using the definition-chaining technique in data flow analysis, the data source of the variable is traced backwards until the input parameter list of the function is matched. The comparison relationship of intermediate variables is transformed into a direct constraint of the input parameter. For example, if the intermediate variable t = p + 1 and t > 5 is required, then the parameter p > 4 is deduced in reverse. Based on the transformed comparison operators and comparison constants, the initial mathematical value range is constructed using interval rules. For example, "> 10" is transformed into the interval (10, +∞). Then, the type identifier corresponding to the parameter is read, and the physical storage boundary of the type in the computer architecture is queried. For example, the physical range of an unsigned 8-bit integer is [0, 255]. The intersection operation of the derived mathematical interval and the physical boundary interval is performed to eliminate numerical ranges that exceed the physical representation capability. For example, the above interval is corrected to (10, +∞).

[255] If the intersection result is an empty set, the path is marked as an unreachable path and a dead code warning is recorded. For different constraints where the same parameter name appears multiple times in the path, such as the path passing through two judgment points "p > 10" and "p < 20" in succession, the interval intersection calculation is performed to merge multiple scattered constraints into a compact effective value range (10, 20). If there is a compound condition with "OR" logic, the interval union operation is performed to complete the integration of logical constraints of all parameters and generate path triggering constraints.

[0033] The steps for obtaining regression test case data are as follows: Based on the path-triggered constraints, all variable value ranges are aggregated by parameter name identifier. The intersection of variable value ranges is used to obtain the strongly constrained value range, and the union of variable value ranges is used to obtain the weakly constrained value range. Parameter combinations are enumerated first according to the strongly constrained value range, and missing parameters are filled in for the weakly constrained value range. Parameter name identifiers and parameter values ​​are written according to the standard input interface format of industrial APP to generate regression test case data.

[0034] Specifically, based on the path triggering constraints, a test case generator object is created. All constraints are categorized and aggregated by parameter name identifier, identifying the set of core constraints that must be satisfied simultaneously. A strict mathematical intersection operation is performed on these constraint intervals to obtain the strong constraint value interval, which represents the "safe zone" of parameters capable of stably triggering the target path. Simultaneously, constraints corresponding to possible fault-tolerant branches or alternative logic in the path are identified, and a union operation is performed on these intervals to obtain the weak constraint value interval. This interval is used to guide boundary testing or exception testing. When generating specific values, boundary value analysis and random sampling are prioritized for the strong constraint value interval, selecting the lower boundary, upper boundary, median value, and boundary neighborhood value of the interval as test data. For example, if the interval is [10, ...

[20] Then, 10, 20, 15, 11, and 19 are selected as candidate values ​​to construct a parameter combination matrix. For some parameters in the matrix that are not assigned values ​​in the weakly constrained interval, default values ​​or random legal values ​​are used to complete them to ensure the integrity of the input vector. Finally, according to the JSON data exchange format or XML configuration file standard commonly used in industrial APPs, the parameter name identifier is used as the key and the generated parameter value is used as the value, and the data is serialized into a text string. For example, a key-value pair structure of {"temperature": 15, "pressure": 101.3} is generated, and necessary header metadata such as timestamps and version numbers are added to generate regression test case data.

[0035] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for testing industrial application software code based on a large model, characterized in that, Includes the following steps: Receive source files of industrial application software, parse the function definition statements and interface call instructions inside the files, extract the logical connection relationships between various business modules, construct a function call topology graph that reflects the directionality of code units, and map the code character sequences of each node in the function call topology graph to a high-dimensional numerical coordinate system through a large model to generate code semantic feature vectors. Based on the function call topology graph, the number of edges pointed to by each node and the weight value of the source node are counted, the importance score of the generated function node is calculated, the distance between the semantic feature vectors of the code is calculated, and a vector space similarity matrix is ​​generated. Based on the importance score of the function node, the nodes are sorted in descending order of numerical value, and the nodes in the top interval are selected as high-priority test objects to generate a core business function set. The vector space similarity matrix is ​​traversed using the core business function set as an index to filter and generate key business execution paths. The conditional branch statements and parameter type definitions in the critical business execution path are analyzed, and the variable value range and logical judgment conditions that can activate the path are deduced in reverse. Path triggering constraints are generated, and the intersection and union operations of the numerical ranges in the path triggering constraints are performed to solve for the parameter combinations that satisfy the constraints and generate regression test case data.

2. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the code semantic feature vector are as follows: Receive source files of industrial application software, locate the start and end line numbers of function definition statements line by line, extract the function name identifier and parameter list character sequence, locate the call point line number of interface call instructions line by line, extract the called interface name identifier and actual parameter expansion character sequence, and generate a set of function definition statements and a set of interface call instructions. Based on the set of function definition statements and the set of interface call instructions, match the called interface name identifier in the set of interface call instructions with the function name identifier in the set of function definition statements, record the call point line number and the start and end line numbers of the called function for each matching relationship, count the cross-function jump direction and cross-module jump direction within each business module, form the logical connection relationship between each business module and generate a function call topology diagram; Based on the function call topology graph, the node code character sequence is extracted according to the start and end line numbers of the called function corresponding to the node. Character standardization and segmentation are performed on the node code character sequence. High-dimensional numerical coordinates are output through the large model. The distribution of dimensional values ​​is statistically analyzed according to the coordinate dimensions and dimensional normalization is performed. If the absolute value of the skewness of the dimensional value distribution exceeds the preset skewness threshold, the dimensional recalibration loop is triggered and the coordinate results are updated to obtain the code semantic feature vector.

3. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the importance score of the function node are as follows: Based on the function call topology graph, the number of incoming edges pointed to by each node is counted, the code semantic feature vector corresponding to the source node is read for each incoming edge and the vector magnitude is calculated, the importance transfer ratio is constructed according to the direction of the incoming edge and iteratively updated, the node semantic information and topology pointing relationship are fused, and the importance score of the function node is calculated.

4. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the vector space similarity matrix are as follows: Based on the importance score of the function node, the semantic feature vector of the code module is read one by one, and the distance between the code modules is calculated. Based on the distance, a distance index relationship is constructed by combining code modules in pairs. The distance is written into the corresponding row and column positions, and the matrix cells are filled according to the module index order to maintain a one-to-one correspondence between the matrix rows and columns and the code modules, thereby generating a vector space similarity matrix.

5. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the core business function set are as follows: Extract the importance score of each function node, sort them in descending order according to the importance score, record the ordinal number of each function node after sorting, extract the function nodes whose ordinal numbers fall into the top interval, mark the function nodes in the top interval as high-priority test objects, and generate a sequence of high-priority test object nodes. Read the function identifier of each function node in the sequence of high-priority test object nodes, remove duplicates according to the function identifier while keeping the ordinal number order unchanged, write it into the core index table and lock the index range of the core index table to form the core business function set.

6. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the key business execution path are as follows: Locate the row index of the vector space similarity matrix according to each function identifier in the core business function set, traverse the distance row by row and compare it with a preset threshold, extract the associated node identifiers whose distance exceeds the preset threshold, verify the call relationship of the associated nodes according to the directed edge order of the function call topology graph, and concatenate the associated node identifiers with the function identifiers in the core business function set according to the call order to obtain the key business execution path.

7. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the path triggering constraint conditions are as follows: The key business execution path is parsed, the conditional branch statement text in the path is read one by one, the position of the conditional operator is located and the lvalue expression and rvalue expression are split, the comparison constant and comparison variable identifier are extracted, the parameter type definition statement in the path is read one by one, the parameter name identifier and parameter type identifier are extracted, and the conditional branch statement parsing result and parameter type definition parsing result are generated. Based on the parsing results of the conditional branch statements and the parameter type definition, the parameter name identifier is associated with the comparison variable identifier. The range of variable values ​​that can satisfy the comparison relationship is deduced in reverse for each conditional branch statement. The boundary format of the variable value range is verified by the parameter type identifier and mismatched boundaries are eliminated. Multiple variable value ranges corresponding to the same parameter name identifier are merged to generate path triggering constraints.

8. The method for testing industrial application software code based on a large model according to claim 1, characterized in that, The steps for obtaining the regression test case data are as follows: Based on the path-triggered constraints, all variable value ranges are aggregated by parameter name identifier. The intersection of the variable value ranges is used to obtain the strongly constrained value range, and the union of the variable value ranges is used to obtain the weakly constrained value range. Parameter combinations are enumerated first according to the strongly constrained value range, and missing parameters are filled in for the weakly constrained value range. The parameter name identifier and parameter value are written according to the standard input interface format of the industrial APP to generate regression test case data.