Efficient software testing method and system based on UML (Unified Modeling Language) activity diagram

Through the software testing method based on UML activity diagram, the problems of high cost and complexity in railway signaling software testing are solved, and an efficient, comprehensive and flexible testing process is realized.

CN119336639APending Publication Date: 2025-01-21BEIJING ZHONGCHAO WEIYE INFORMATION SECURITY TECH CO +1

Patent Information

Application Number
CN202411420496.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The prior art has problems with high labor and time costs in railway signal software testing, and the test complexity is high, making it difficult to simplify the testing process and improve efficiency while ensuring quality.

Method used

Adopt an efficient software testing method based on UML activity diagrams. By obtaining test requirements, feature extraction system sub-requirements, generate UML activity diagrams, convert them into directed graphs, divide the structure and generate test paths through depth-first traversal algorithm, and use genetic algorithms to optimize testing. path set.

Benefits of technology

It achieves comprehensiveness and pertinence of testing, reduces the time of manually designing test cases, improves testing efficiency, reduces the probability of missed errors, and improves the flexibility and reliability of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336639A_ABST
    Figure CN119336639A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient software testing method and system based on a UML (Unified Modeling Language) activity diagram, and relates to the technical field of software testing. Feature extraction is performed on a to-be-modeled system testing demand to obtain system sub-demands; the method comprises the following steps: sequentially sorting based on system sub-requirements, generating corresponding activity elements to generate a system activity graph model, converting an activity graph into a directed graph through a conversion rule, traversing the directed graph by adopting a search algorithm of a graph theory to generate test paths, and finally optimizing each test path by adopting a genetic algorithm to generate a test path set. And testing the to-be-modeled system through the test path set. According to the invention, through feature extraction of the test demand and the sub-demand, the comprehensiveness and pertinence of the test are ensured, the risk of missing key functions or scenes is reduced, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and more particularly to an efficient software testing method and system based on UML activity diagram. Background Art

[0002] The existing railway monitoring and operation warning system is an important equipment to ensure the safety of railway operation. The system performs real-time status monitoring, data recording, statistical analysis and fault alarm for railway basic signal equipment (such as turnouts, signal machines, track circuits, etc.) and transportation control systems (such as CTC, interlocking, train control, etc.). The product was implemented under the administrative licensing system in the early stage and was later included in the scope of CRCC certification. Therefore, for each function of the product, it is necessary to conduct complete and reliable tests under laboratory conditions.

[0003] At present, in order to ensure the reliability and security of signal control system software products, it is necessary to conduct a series of tests on the software in the development process in accordance with the design specifications and standards. It is usually required to simulate a large number of complex scenarios and configure a large amount of engineering data in the testing of railway signal software. When the railway communication signal software is tested using traditional manual testing methods, the workload of the test executors is very large, and the manpower and time costs are very high. Software testing stipulates different test objectives and types of problems to be discovered according to different stages. For testing at the software attribute level, not only is the workload large, but the number of regressions is also large. How to reduce the complexity of testing, simplify the testing process, improve testing efficiency, and effectively use testing resources and environment while ensuring the quality of testing, and discover software defects as early as possible has always been an urgent problem to be solved in the industry. Summary of the invention

[0004] In view of this, the present invention provides an efficient software testing method and system based on UML activity diagram to solve the problems existing in the background technology.

[0005] In order to achieve the above object, the present invention adopts the following technical solution:

[0006] An efficient software testing method based on UML activity diagram, including:

[0007] Acquire the test requirements of the system to be modeled; extract features of the test sub-requirements in the test requirements to obtain corresponding system sub-requirements; for each of the system sub-requirements under the same scenario category, sort them in sequence based on the system sub-requirements and generate corresponding activity elements; connect each of the activity elements under the same scenario category in sequence to generate a corresponding UML activity diagram;

[0008] Based on directed graph conversion rules, the UML activity diagram is converted into a directed graph, and the structure thereof is divided into a branch structure, a concurrent structure, and a loop structure. The branch structure and the concurrent structure are traversed by a depth-first traversal algorithm to generate branch paths and concurrent paths, the loop structure is set with a loop count to generate a loop path, and the processed branch paths, concurrent paths, and loop paths are merged to form various test paths;

[0009] The test paths are optimized by a genetic algorithm to generate a test path set, and the system to be modeled is tested by the test path set.

[0010] Preferably, the obtaining of the corresponding system sub-requirements specifically includes: extracting features of each of the test sub-requirements according to preset rules; the system sub-requirements have unique identifiers, names and text patterns, and the system sub-requirements are expressed using regular expressions.

[0011] Preferably, the system sub-requirements include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

[0012] Preferably, the generating of the corresponding UML activity diagram specifically includes: for each of the activity elements under the same scenario category, sorting the system sub-requirements corresponding to the activity elements in the sequence under the scenario category; the activity elements are used to characterize the functions of the system to be constructed; and using control flow to sequentially connect each of the activity elements under the same scenario category to generate the UML activity diagram.

[0013] Preferably, generating a branch path specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; when encountering each decision node, preferentially selecting the transfer edge with a monitoring value of true to continue traversing downward, while recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; according to the recorded conditional expression and monitoring value, a branch path is generated for the key variables on a single decision node in turn; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

[0014] An efficient software testing system based on UML activity diagram, comprising:

[0015] The activity diagram generation module obtains the test requirements of the system to be modeled; extracts features of the test sub-requirements in the test requirements to obtain the corresponding system sub-requirements; sorts the system sub-requirements under the same scenario category based on the system sub-requirements and generates corresponding activity elements; connects the activity elements under the same scenario category in order to generate the corresponding UML activity diagram;

[0016] A test path generation module, based on directed graph conversion rules, converts the UML activity diagram into a directed graph, divides the structure therein into a branch structure, a concurrent structure, and a loop structure, and traverses the branch structure and the concurrent structure through a depth-first traversal algorithm to generate branch paths and concurrent paths, sets the number of loops for the loop structure to generate a loop path, and merges the processed branch paths, concurrent paths, and loop paths to form various test paths;

[0017] The test module optimizes the test paths through a genetic algorithm to generate a test path set, and tests the system to be modeled through the test path set.

[0018] Preferably, obtaining the corresponding system sub-requirements in the activity diagram generation module specifically includes: extracting features of each of the test sub-requirements according to preset rules; the system sub-requirements have unique identifiers, names and text patterns, and the system sub-requirements are expressed using regular expressions.

[0019] Preferably, the system sub-requirements in the activity diagram generation module include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

[0020] Preferably, the generation of the corresponding UML activity diagram in the activity diagram generation module specifically includes: for each of the activity elements under the same scenario category, sorting the system sub-requirements corresponding to the activity elements in the scenario category in the order of the activity elements; the activity elements are used to characterize the functions of the system to be built; and using control flow to connect each of the activity elements under the same scenario category in sequence to generate the UML activity diagram.

[0021] Preferably, the generation of branch paths in the test path generation module specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; preferentially selecting the transfer edge with a monitoring value of true to continue traversing downward each time a decision node is encountered, and recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; generating branch paths for key variables on a single decision node in turn according to the recorded conditional expression and monitoring value; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

[0022] Through the above technical solutions, it can be known that compared with the prior art, the present invention discloses an efficient software testing method and system based on UML activity diagrams, which ensures the comprehensiveness and pertinence of the test and reduces the risk of missing key functions or scenarios by extracting the features of test requirements and sub-requirements; presents system functions and processes through UML activity diagrams, and automatically generates various test paths based on the conversion and depth-first traversal of directed graphs, which saves the time of manually designing test cases and improves test efficiency; ensures that the test covers different types of program logic and reduces the probability of missing errors by dividing and traversing branch structures, concurrent structures and loop structures; sets the number of loops for loop structures, and can adjust the test strategy according to specific scenarios to improve the flexibility of the test; generates and optimizes paths based on algorithms, reduces the subjective factors in manual test design, and makes the test process more objective and reliable; optimizes the generated test paths using genetic algorithms, which can effectively improve the test efficiency and coverage, and ensure that the test process is more accurate and effective. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be introduced in a branched manner below. Obviously, the drawings in the following description are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0024] Figure 1 A flow chart of the method provided by the present invention;

[0025] Figure 2 A schematic diagram of the structure provided by the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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.

[0027] The embodiment of the present invention discloses an efficient software testing method based on UML activity diagram, such as Figure 1 As shown, including:

[0028] Obtain the test requirements of the system to be modeled; extract features of the test sub-requirements in the test requirements to obtain the corresponding system sub-requirements; sort the system sub-requirements under the same scenario category based on the system sub-requirements and generate corresponding activity elements; connect the activity elements under the same scenario category in order to generate the corresponding UML activity diagram;

[0029] Based on the directed graph conversion rules, the UML activity diagram is converted into a directed graph, and the structure is divided into branch structure, concurrent structure, and loop structure. The branch structure and concurrent structure are traversed by the depth-first traversal algorithm to generate branch paths and concurrent paths. The number of loops is set for the loop structure to generate a loop path. The processed branch paths, concurrent paths, and loop paths are merged to form various test paths.

[0030] Each test path is optimized by genetic algorithm to generate a test path set, and the system to be modeled is tested by the test path set.

[0031] In a specific embodiment, obtaining the corresponding system sub-requirement specifically includes: extracting features of each test sub-requirement according to preset rules; the system sub-requirement has a unique identifier, name and text pattern, and the system sub-requirement is expressed using a regular expression.

[0032] In a specific embodiment, feature extraction can adopt the method of keyword information recognition. For example, when the keyword information extracted from the product testing task book is "receive", the behavior action category of the system sub-requirement corresponding to the original sub-requirement is identified as a startup action; when the keyword information extracted from the product testing task book is "execute", the behavior action category of the system sub-requirement corresponding to the original sub-requirement is identified as an execution task action; when the keyword information extracted from the product testing task book is "output", the behavior action category of the system sub-requirement corresponding to the original sub-requirement is identified as an output result action.

[0033] In a specific embodiment, the system sub-requirements include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

[0034] In a specific embodiment, the scenario category of the demand project is set according to the actual test scenario of the system to be tested, for example: the scenario of status monitoring of equipment such as tracks, signals, and power supplies; the scenario of dynamically adjusting the operation tasks according to the train operation status and the operation plan; the scenario of sudden fire, etc. The behavior action category includes the start action, the task execution action, and the output result action; the system indicator is the quantification of the system performance, for example: monitoring range, warning speed, test results, etc.; the transmission content includes the transmission mode and the transmission object; the transmission mode includes uploading and downloading; the transmission object includes signals, data, and commands, etc.

[0035] For each system sub-requirement under the same scenario category, the system sub-requirements are sequentially sorted and corresponding activity elements are generated based on the system sub-requirements; and the steps of sequentially connecting each activity element under the same scenario category include:

[0036] For each system sub-requirement under the same scenario category, the order of the start action, the task execution action and the output result action is sequentially sorted; for each system sub-requirement in the same behavior action category, the system sub-requirements are sequentially sorted according to the transmission mode and transmission object of each system sub-requirement according to the preset sorting rules; the transmission mode includes uploading and downloading, and the transmission object includes signals, data and commands; the preset sorting rules include: the priority of the transmission mode is higher than the priority of the transmission object, the priority of uploading is higher than the priority of downloading, the priority of the signal is higher than the priority of the data, and the priority of the data is higher than the priority of the command;

[0037] After extracting features from each test sub-requirement to obtain a system sub-requirement corresponding to the test sub-requirement, for each system sub-requirement under the same scenario category, the system sub-requirements are sequentially sorted based on the system sub-requirements and corresponding activity elements are generated, and before sequentially connecting the activity elements under the same scenario category, the method further includes:

[0038] For each system sub-requirement under the same scenario category, determine whether there are at least two system sub-requirements with exactly the same behavior action category and system indicators; if so, remove the redundant system sub-requirements with exactly the same behavior action category and system indicators, and only retain any one of the system sub-requirements; for each system sub-requirement under the same scenario category, determine whether there are at least two system sub-requirements with exactly the same behavior action category and time information; if so, remove the system sub-requirements with the transmission mode of downlink, and retain the system sub-requirements with the transmission mode of uplink.

[0039] In a specific embodiment, generating a corresponding UML activity diagram specifically includes: for each activity element under the same scenario category, sorting the activity elements according to the order of the system sub-requirements corresponding to the activity elements under the scenario category; the activity elements are used to represent the functions of the system to be built; and using the control flow to sequentially connect the activity elements under the same scenario category to generate a UML activity diagram.

[0040] In a specific embodiment, the activity diagram modeling rules are as follows:

[0041] (1) The activity diagram should be a strongly connected directed graph, where each node is connected to every other node;

[0042] (2) Branch nodes and merge nodes should appear in pairs;

[0043] (3) An activity diagram should have only one termination node, but multiple flow termination nodes can exist;

[0044] (4) Each node in the activity diagram can be named according to the conversion rules to facilitate the generation of a visual test path.

[0045] In a specific embodiment, generating a branch path specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; each time a decision node is encountered, preferentially selecting a transfer edge with a monitoring value of true to continue traversing downward, while recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; based on the recorded conditional expression and monitoring value, a branch path is generated for the key variables on a single decision node in turn; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

[0046] In a specific embodiment, the concurrent structure traversal generates a concurrent path including the concurrent path being composed of a plurality of path branches, the branch node marking the starting point of the branch; each concurrent branch is covered by traversing the path, and finally the plurality of concurrent branches are combined;

[0047] The key variable data generation on a single decision node is as follows:

[0048] Key variable data generation refers to the generation of key variable values ​​in the conditional expression on the decision node; the general form of the conditional expression is: E1 op E2; where E1 is the key variable, E2 is a numeric value or Boolean value, op is a mathematical comparison symbol, op∈{<, ≤, >, ≥, ==}; the key variable data generation process is divided into the following cases according to the conditional expression on the decision node and the branch to be covered:

[0049] op is < or <=. To cover the true branch of the decision node, the value of the key variable E1 is less than E2 when generating simulation data;

[0050] op is < or <=. To cover the false branch of the decision node, the value of the key variable E1 is greater than E2 when generating simulation data;

[0051] op is > or >=. To cover the true branch of the decision node, the value of the key variable E1 is greater than E2 when generating simulation data;

[0052] op is > or >=. To cover the false branch of the decision node, the value of the key variable E1 is less than E2 when generating simulation data;

[0053] op is ==. If you want to cover the true branch of the decision node, the value of the key variable E1 is the same as E2 when generating simulation data;

[0054] op is ==. To cover the false branch of the decision node, E2 is a value. When generating simulation data, the value of the key variable E1 must not be equal to E2.

[0055] op is ==. If you want to cover the false branch of the decision node, E2 is a Boolean value. When generating simulation data, the Boolean value of the key variable E1 must be opposite to E.

[0056] In a specific embodiment, the genetic algorithm adopts the GA (Genetic Algorithm) algorithm, and calculates the ratio of the chromosome reachable path length to the chromosome length through the fitness function fifitness, and adds individuals satisfying fifitness=1 to the target population, so that on the basis of satisfying the path coverage, the reachability of the target individual (referring to path reachability) is guaranteed at the same time.

[0057] fitness(i)=LenAcc(i) / LenPops(i);

[0058] Where i is the individual number in the elite population; LenAcc(i) is the path length from the starting node to the last reachable node of the returned individual i; LenPops(i) is the total length (chromosome) of the returned individual i.

[0059] Control the number of target individuals to achieve GA multi-objective optimization. Use {number of iterations, number of individuals in the target population} as the termination condition of the LightGBM algorithm. When the fitness value of the target individual is 1 and the number of individuals in the target population reaches the total number of reachable paths in the ADG graph (ADGPathSum), the algorithm has generated all reachable paths, and the iteration can be stopped and the target population can be output. Adding the above multi-objective constraints overcomes the drawback of traditional GA relying on a single termination condition (number of iterations), improves the accuracy of the target population, and avoids the computational consumption caused by redundant iterations.

[0060] The elite population is deduplicated to avoid premature GA. In the genetic process, the union of the parent population and the offspring population is removed after duplicate individuals are removed, and the next generation population is selected by sorting according to the fitness function value. For example, if the parent population has p1 individuals and the offspring population has p2 individuals, p1+p2 are deduplicated and then sorted to determine the next generation.

[0061] The coverage criteria of test cases are implemented from the code logic. The coverage criteria of test cases adopt decision coverage and path coverage, and the above criteria are implemented from the code logic level to ensure that the test path generated by the algorithm is a reachable path. Specifically: ① The loop structure is disassembled by matrix splicing to achieve decision coverage of branch / loop structure. ② By improving the fitness function, when the number of individuals with fitness=1 reaches the total number, all paths in the directed graph are covered.

[0062] The LightGBM model is integrated to avoid GA non-convergence. Among them, LightGBM makes binary predictions based on five characteristic values: number of iterations, node coverage, target path coverage, generation ratio from the last discovery of new individuals, average fitness of the population, and maximum fitness value. As the basis for adjusting GA parameters, the average value of the prediction results every 20 generations is taken to dynamically adjust the population size, crossover operator, mutation operator, and selection pressure to speed up the convergence of GA. Specifically: a predicted value approaching 0 indicates a good genetic state, and the selection pressure should be appropriately increased and the search space should be reduced. Otherwise, it means that GA is premature or converges too slowly. The search space should be appropriately expanded and the selection pressure should be reduced, and the crossover strategy should be changed at the same time.

[0063] An efficient software testing system based on UML activity diagram, such as Figure 2 As shown, including:

[0064] Activity diagram generation module, obtains the test requirements of the system to be modeled; extracts features of the test sub-requirements in the test requirements to obtain the corresponding system sub-requirements; sorts the system sub-requirements under the same scenario category based on the system sub-requirements and generates corresponding activity elements; connects the activity elements under the same scenario category in order to generate the corresponding UML activity diagram;

[0065] The test path generation module converts the UML activity diagram into a directed graph based on the directed graph conversion rules, divides the structure into branch structure, concurrent structure, and loop structure, and traverses the branch structure and concurrent structure through the depth-first traversal algorithm to generate branch paths and concurrent paths, sets the number of loops for the loop structure to generate loop paths, and merges the processed branch paths, concurrent paths, and loop paths to form various test paths;

[0066] The test module optimizes each test path through a genetic algorithm, generates a test path set, and tests the system to be modeled through the test path set.

[0067] In a specific embodiment, obtaining the corresponding system sub-requirements in the activity diagram generation module specifically includes: extracting features of each test sub-requirement through preset rules; the system sub-requirements have unique identifiers, names and text patterns, and the system sub-requirements are expressed using regular expressions.

[0068] In a specific embodiment, the system sub-requirements in the activity diagram generation module include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

[0069] In a specific embodiment, generating a corresponding UML activity diagram in an activity diagram generation module specifically includes: for each activity element under the same scenario category, sorting the activity elements according to the order of the system sub-requirements corresponding to the activity elements under the scenario category; the activity elements are used to represent the functions of the system to be built; and using the control flow to connect the activity elements under the same scenario category in sequence to generate a UML activity diagram.

[0070] In a specific embodiment, generating a branch path in a test path generation module specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; each time a decision node is encountered, preferentially selecting a transfer edge with a monitoring value of true to continue traversing downward, while recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; based on the recorded conditional expression and monitoring value, a branch path is generated for the key variables on a single decision node in turn; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

[0071] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description of the comparison branch and the relevant parts can be referred to the method part.

[0072] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An efficient software testing method based on UML activity diagram, characterized in that: include: Obtain the test requirements of the system to be modeled; Extract features of the test sub-requirements in the test requirements to obtain corresponding system sub-requirements; sort the system sub-requirements under the same scenario category based on the system sub-requirements and generate corresponding activity elements; connect the activity elements under the same scenario category in order to generate a corresponding UML activity diagram; Based on directed graph conversion rules, the UML activity diagram is converted into a directed graph, and the structure thereof is divided into a branch structure, a concurrent structure, and a loop structure. The branch structure and the concurrent structure are traversed by a depth-first traversal algorithm to generate branch paths and concurrent paths, the loop structure is set with a loop count to generate a loop path, and the processed branch paths, concurrent paths, and loop paths are merged to form various test paths; The test paths are optimized by a genetic algorithm to generate a test path set, and the system to be modeled is tested by the test path set.

2. According to claim 1, an efficient software testing method based on UML activity diagram is characterized in that: The obtaining of the corresponding system sub-requirements specifically includes: extracting features of each of the test sub-requirements according to preset rules; the system sub-requirements have unique identifiers, names and text patterns, and the system sub-requirements are expressed using regular expressions.

3. The efficient software testing method based on UML activity diagram according to claim 2 is characterized in that: The system sub-requirements include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

4. The efficient software testing method based on UML activity diagram according to claim 1, characterized in that: The generating of the corresponding UML activity diagram specifically includes: for each of the activity elements under the same scenario category, sorting the system sub-requirements corresponding to the activity elements in the sequence under the scenario category; the activity elements are used to characterize the functions of the system to be constructed; and using the control flow to sequentially connect each of the activity elements under the same scenario category to generate the UML activity diagram.

5. The efficient software testing method based on UML activity diagram according to claim 1, characterized in that: Generating a branch path specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; when encountering each decision node, preferentially selecting the transfer edge with a monitoring value of true to continue traversing downward, while recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; according to the recorded conditional expression and monitoring value, a branch path is generated for the key variables on a single decision node in turn; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

6. An efficient software testing system based on UML activity diagram, applying an efficient software testing method based on UML activity diagram according to any one of claims 1 to 5, characterized in that: include: Activity diagram generation module to obtain the test requirements of the system to be modeled; Extract features of the test sub-requirements in the test requirements to obtain corresponding system sub-requirements; sort the system sub-requirements under the same scenario category based on the system sub-requirements and generate corresponding activity elements; connect the activity elements under the same scenario category in order to generate a corresponding UML activity diagram; A test path generation module, based on directed graph conversion rules, converts the UML activity diagram into a directed graph, divides the structure therein into a branch structure, a concurrent structure, and a loop structure, and traverses the branch structure and the concurrent structure through a depth-first traversal algorithm to generate branch paths and concurrent paths, sets the number of loops for the loop structure to generate a loop path, and merges the processed branch paths, concurrent paths, and loop paths to form various test paths; The test module optimizes the test paths through a genetic algorithm to generate a test path set, and tests the system to be modeled through the test path set.

7. The efficient software testing system based on UML activity diagram according to claim 6, characterized in that: Acquiring the corresponding system sub-requirements in the activity diagram generation module specifically includes: extracting features of each of the test sub-requirements according to preset rules; the system sub-requirements have unique identifiers, names and text patterns, and the system sub-requirements are expressed using regular expressions.

8. The efficient software testing system based on UML activity diagram according to claim 7, characterized in that: The system sub-requirements in the activity diagram generation module include the following requirement items: scenario category, behavior action category, transmission content, time information and system indicators.

9. The efficient software testing system based on UML activity diagram according to claim 6, characterized in that: The generating of the corresponding UML activity diagram in the activity diagram generating module specifically includes: for each of the activity elements under the same scenario category, sorting the system sub-requirements corresponding to the activity elements in the sequence under the scenario category; the activity elements are used to represent the functions of the system to be constructed; and using the control flow to sequentially connect each of the activity elements under the same scenario category to generate the UML activity diagram.

10. The efficient software testing system based on UML activity diagram according to claim 6, characterized in that: The generation of branch paths in the test path generation module specifically includes: starting from the initial node of the branch structure, deeply traversing the graph downward; when encountering each decision node, preferentially selecting the transfer edge with a monitoring value of true to continue traversing downward, and recording the conditional expression on the decision node and the monitoring value on the transfer edge; when the end point of the branch structure is encountered, it indicates that the path of the current branch structure ends; according to the recorded conditional expression and monitoring value, a branch path is generated for the key variables on a single decision node in turn; backtracking the branch structure, selecting another false branch that has not been covered at each decision node in turn, continuing to deeply traverse downward and recording the conditional expression and monitoring value on the decision node, until all branches of the branch structure are traversed and the branch path is generated.

Citation Information

Patent Citations

  • Device and method for automatically testing software based on UML (unified modeling language) graphs

    CN102053912A

  • Train operation control system safety critical software test case generating method

    CN106814730A

  • Simulating parameter data automatic generating method based on activity map paths

    CN108629124A

Cited By

  • Automobile part data life cycle safety test system

    CN120781366A

  • Automobile parts data life cycle security test system

    CN120781366B