A Method, Device and Storage Medium for Prioritizing Test Cases of a Train Autonomous Operation System
Through severity state machine modeling and reachable graph calculation, the problem of lack of priority for the test cases of train autonomous operation systems is solved, and priority testing of high severity modules is realized, and the testing process and project management are optimized to ensure safety and progress.
Patent Information
- Application Number
- CN202411646544.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The existing test cases of autonomous train system test cases lack priority attributes, which leads to the test process relying on testers' experience, high subjectivity, long test cycles, especially the defect repair and regression test time of high-severity modules, which affects project progress and safety.
Based on the finite state machine theory, using the severity state machine modeling method, and severity-reachable graph calculates the priority of test cases, a priority sorting method for test cases for autonomous running systems of trains is proposed to cover the system function logic and severity changes, and guide the priority testing of high severity modules.
It realizes the comprehensiveness and priority attributes of the train's autonomous operation system test, reduces the subjectivity of the test's dependence on experience, and can detect high-rigorous module problems in the early stage of the test, optimize project management, ensure that the project proceeds smoothly as planned, and enhance team confidence.
Smart Images

Figure CN119621551B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of train autonomous operation system testing, and particularly relates to a method, device and storage medium for prioritizing test cases of a train autonomous operation system. Background Art
[0002] The train autonomous operation system has the characteristics of simple structure, intelligent reliability, economical operation and maintenance, and operation safety. It is an important development trend of train control technology and a new generation of train operation control system that is the focus of global rail transit research.
[0003] As a new train control system, the train autonomous operation system is a typical safety-critical system. System defects may cause major safety accidents or even casualties. Therefore, it needs to undergo strict and comprehensive testing before being put into operation to ensure that the system's functional and safety requirements meet the technical specifications. The functional logic and safety requirements of the train autonomous operation system are complex, and the system consists of modules with different severity levels. Usually, high-severity modules often involve complex logic, interaction with external systems, core business processes, etc., and are more likely to have serious defects. The higher the safety level of the module, the higher the cost such as the time required for repair. Currently, the test cases of the train autonomous operation system do not have the attribute of priority. During the testing process, the execution order of test cases is mainly arranged by testers based on experience or randomly, which largely depends on the intuition of testers, with relatively large subjectivity and randomness. The number of test cases for the train autonomous operation system is huge, and the testing cycle is relatively long. Especially for high-severity modules in the system, the time for defect repair and regression testing is usually long. Conducting tests according to the severity levels of different system modules helps to discover potential key and high-risk problems in the system at the initial stage of testing, so as to have more time and resources for repair and ensure the smooth progress of the project as planned. During the project management and decision-making process, understanding the status and test results of high-severity modules can help project managers better predict project risks, optimize resource allocation and development activities, formulate countermeasures and adjust the project plan. At the same time, during the project development process, team members may be worried about the project quality and progress. By preferentially testing and repairing problems in high-severity modules, the confidence and morale of team members can be enhanced, promoting the smooth progress of the project. Organizing testing activities according to the severity levels of different modules helps to improve and optimize the management of the train autonomous operation system life cycle, and has certain significance for the testing of the train autonomous operation system.
[0004] Therefore, it is necessary to design a method for prioritizing test cases for the train autonomous operation system testing problem, which can generate test cases with a priority order based on the severity levels of the train autonomous operation system. Summary of the Invention
[0005] In view of this, one of the objectives of the present invention is to provide a method for prioritizing test cases of a train autonomous operation system. One of the objectives of the present invention is based on the finite state machine theory, and uses a test modeling method of a severity state machine to describe the functional logic and severity level of the system; an algorithm for converting the severity state machine into a severity reachability graph to calculate the priority of test cases is proposed to achieve the goal of guiding the priority testing of high-severity functional modules.
[0006] One of the objectives of the present invention is achieved through the following technical solutions:
[0007] The method for prioritizing test cases of the train autonomous operation system includes the following steps:
[0008] Step S1: According to the business functions of the train autonomous operation system, analyze the modeling requirements of the system, and extract the state set S tacs , signal set G tacs and the transition relationship between states;
[0009] Step S2: Analyze the influence degree after the failure of each state in S tacs , and determine the severity level of each state in S tacs ;
[0010] Step S3: Combine the business functions of the train autonomous operation system, state set S tacs , signal set G tacs , the transition relationship between states and the severity level of each state, and use the severity state machine modeling method to formally describe the requirements of the train autonomous operation system, and establish a severity state machine test model M1 including the functional logic and severity level of the train autonomous operation system;
[0011] Step S4: Convert the train autonomous operation system test model M1 into a severity reachability graph model M2. The severity reachability graph is a quadruple SRG = (D, I, L, R), where: D is the set of reachable identifiers, I is the set of finite input symbols, L: D × I → D is the reachable identifier transfer function, and R: D → N is the reachable identifier severity allocation function, mapping the configuration of the severity state machine to the reachable identifier of the severity reachability graph, and mapping the severity of the severity state machine configuration to the severity of the corresponding reachable identifier in the severity reachability graph;
[0012] Step S5: Determine the test start reachable identifier d0 and the end reachable identifier d f ;
[0013] Step S6: Calculate the main path set P p and the edge pair set E p , and for any main path, d0 is not an intermediate node; calculate the complete coverage main path set Pp and the set of edge pairs E p The test case set Tc:
[0014] Furthermore, calculate the paths that can reach d starting from d0 along the migrations in the severity reachability graph f and completely cover the set of main paths P p The set of paths is denoted as the test case set Tcp; determine whether the test case set Tcp completely covers the set of edge pairs E p ; if Tcp completely covers the set of edge pairs E p , the test cases of the train autonomous operation system Tc = Tcp; if Tcp does not completely cover the set of edge pairs E p , for the set of edge pairs E p in E that have not been covered pu , calculate the paths that can reach d starting from d0 along the migrations in the severity reachability graph f and completely cover the set of edge pairs E pu The set of paths is denoted as the test case set Tce, and the test cases of the train autonomous operation system Tc = Tcp ∪ Tce.
[0015] Step S7: Identify the reachable identifiers included in each test case and calculate the severity sequence of each test case;
[0016] Furthermore, the severity sequence is a permutation of the severities of all reachable identifiers included in the test case from largest to smallest. For the test case tc, its severity sequence is denoted as PS tc ;#PS tc represents the sequence PS tc The length of, PS tc (i) represents the severity value at the i-th position of the severity sequence PS tc ;
[0017] Step S8: According to the severity sequence of the test cases, use the exponentially weighted moving average to calculate the priority of the test cases:
[0018] Furthermore, for the severity sequence PS tc of the test case tc where: β ∈ [0, 1], β represents the weighting coefficient, y i represents the priority at the i-th position of the severity sequence PS tc ;
[0019] Step S9: Sort the test cases in descending order according to the priority of the test cases to form a sorted test case set. The higher the priority of the test case, the higher the safety of the train autonomous operation system covered by the test case, and the more urgently it needs to be tested.
[0020] Further, in step S3, the severity state machine is defined as follows:
[0021] The severity state machine has basic elements of state S, signal G, and transition E. The states include three types: simple state (BASIC), OR state (OR), and AND state (AND); the initial state category is denoted as KIND, including initial state (INIT) and normal state (NORMAL); the AND (and), OR (or), and NOT (not) relationships between signals form a signal expression, denoted as G E ; the constant indicating that the signal always occurs is denoted as TRUE; the transition includes source state src, signal expression ge triggering the transition, signal a generated during the transition, and target state tar;
[0022] The state hierarchy TREE of the severity state machine includes bottom state back, finite state hierarchy function c, finite state type function u, finite state initial category function w, and state severity function v; c maps from a state to its direct sub - states, u defines the type of each state, w defines whether the state is an initial state, and v assigns a severity level to the state.
[0023] Further, step S4 specifically includes the following processes:
[0024] (1) Create an empty configuration set CQ, an empty reachable identification set D, and an empty input symbol set I;
[0025] (2) Extract the initial configuration, denoted as cf0;
[0026] (3) Insert cf0 into CQ, CQ = CQ ∪ {cf0};
[0027] (4) If CQ ≠ EMPTY, go to step (5); otherwise, go to step (16);
[0028] (5) Select a configuration cf i , and delete it from CQ, CQ = CQ\{cf i};
[0029] (6) If there exists a reachable identification D i corresponding to cf i in D, extract the reachable identification D i , and go to step (9); otherwise, go to step (7);
[0030] (7) Create a reachable identification D i corresponding to the configuration cf i , D = D ∪ {D i};
[0031] (8) Calculate cf i of the severity level r i , and R(D i ) = r i ;
[0032] (9) Obtain all possible reachable configuration sets starting from cf i , denoted as CF;
[0033] (10) If CF ≠ EMPTY, go to step (11); otherwise, go to step (4);
[0034] (11) Select a configuration cf j from CF, CQ = CQ ∪ {cf j}, and delete it from CF, CF = CF\{cf j};
[0035] (12) If cf j already has a corresponding reachable identifier D j in D, obtain the reachable identifier D j , go to step (15); otherwise, go to step (13);
[0036] (13) Create a reachable identifier D j corresponding to the configuration cf j , D = D ∪ {D j};
[0037] (14) Calculate the severity level r j of cf j , and R(D j ) = r j ;
[0038] (15) Obtain the condition t and the corresponding transfer symbol i for cf i to transfer to cf j , I = I ∪ {i}, L(D i , t) → D j , go to step (10);
[0039] (16) Output the severity reachability graph SRG = (D, I, L, R).
[0040] Furthermore, step S6 specifically includes the following processes:
[0041] (1) Create an empty test case set TC;
[0042] (2) Obtain the main path set P p ;
[0043] (3) If P p≠EMPTY, go to step (4); otherwise, go to step (7);
[0044] (4) Select a main path p from P p and delete p from P p , P p = P p \{p};
[0045] (5) Generate a test case t that covers the main path p according to the starting reachable identifier d0 and the ending reachable identifier d f ;
[0046] (6) Insert t into TC, TC = TC ∪ {t}. Go to step (3);
[0047] (7) Obtain the edge pair set E p ;
[0048] (8) If E p ≠EMPTY, go to step (9); otherwise, go to step (13);
[0049] (9) Select an edge pair ep from E p and delete it from E p , E p = E p \{ep};
[0050] (10) If there is at least one test case in TC that covers ep, go to step (8); otherwise, go to step (11);
[0051] (11) Generate a test case t that covers the edge pair ep according to the starting reachable identifier d0 and the ending reachable identifier d f ;
[0052] (12) Insert t into TC, TC = TC ∪ {t}, and go to step (8);
[0053] (13) Output the TC set.
[0054] The second object of the present invention is to provide a computer device, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor. When the processor executes the computer program, the method described above is implemented.
[0055] The third object of the present invention is to provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described above is implemented.
[0056] The beneficial effects of the present invention are:
[0057] (1) The present invention proposes a test modeling method for a severity state machine, which adds a severity attribute on the basis of traditional modeling methods, incorporates the severity characteristics of different functional modules of the train autonomous operation system into the test model, and simultaneously covers the functional logic and severity changes of the system, providing a new model basis for the test of the train autonomous operation system.
[0058] (2) The test case priority sorting method for the train autonomous operation system proposed by the present invention covers the whole process from test modeling to test case generation and sorting of the train autonomous operation system. It proposes a method to transform the severity state machine into a severity reachable graph, which can traverse the test paths of the train autonomous operation system. While ensuring the comprehensiveness of the test of the train autonomous operation system, it adds an attribute of priority to the test cases, which can guide the execution order of the test cases and avoid the problems of large subjectivity and randomness in the execution order of the current test cases that rely on the experience of testers.
[0059] (3) The method provided by the present invention can discover potential problems in high-severity functional modules of the train autonomous operation system at the initial stage of testing, especially those involving complex logics, interactions with external systems, and core business processes and other functional modules. Thus, there is more time and resources to repair defects, reducing the risks caused by the discovery of serious defects only in the late stage of testing, which helps to improve and optimize the management of the life cycle of the train autonomous operation system and ensure the smooth progress of the project as planned.
[0060] (4) The method provided by the present invention helps project managers better predict project risks, formulate countermeasures, and adjust project plans through quantitative indicators. By preferentially testing and repairing problems in high-severity functional modules through the method provided by the present invention, it can enhance the confidence of team members and promote the smooth progress of the project.
[0061] (5) The method provided by the present invention can significantly advance the timing of discovering defects in high-severity functional modules of the system when the system functional logic and safety requirements are complex and the system safety level composition is complicated, and is particularly suitable for large-scale, complex safety-critical systems with large differences in safety requirements.
[0062] Other advantages, objectives, and features of the present invention will be described to some extent in the subsequent specification, and to some extent, will be obvious to those skilled in the art based on the study of the following text, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the following specification and the foregoing claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the drawings, where:
[0064] Figure 1 is the process schematic diagram of the present invention;
[0065] Figure 2 is the definition of the Z specification language for the severity state machine of the present invention;
[0066] Figure 3 is the process schematic diagram for converting the severity state machine of the present invention into a severity reachability graph;
[0067] Figure 4 is the process schematic diagram for generating test cases of the present invention;
[0068] Figure 5 is the severity level classification and definition of Example 1;
[0069] Figure 6 is the severity state machine test model of Example 1;
[0070] Figure 7 is the severity reachability graph model of Example 1;
[0071] Figure 8 is the main path set of Example 1;
[0072] Figure 9 is the edge pair set of Example 1;
[0073] Figure 10 is the main path and edge pairs covered by the test cases of Example 1;
[0074] Figure 11 is the priority of the test cases of Example 1;
[0075] Figure 12 is the severity state machine test model of Example 2;
[0076] Figure 13 is the severity reachability graph model of Example 2;
[0077] Figure 14 is the main path set of Example 2;
[0078] Figure 15 is the edge pair set of Example 2;
[0079] Figure 16 is the main path and edge pairs covered by the test cases generated for the main path coverage of Example 2;
[0080] Figure 17 is the edge pair set covered by the test cases generated for the edge pair coverage of Example 2;
[0081] Figure 18 is the priority of the test cases of Example 2. Detailed Implementation Modes
[0082] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the preferred embodiments are only for illustrating the present invention, rather than limiting the protection scope of the present invention.
[0083] Embodiment 1
[0084] As Figure 1 shown, this embodiment specifically includes the following steps:
[0085] Step S1: According to the business functions of the train autonomous operation system, analyze the modeling requirements of the system, and extract the state set S tacs , signal set G tacs and the transition relationships between states. In this embodiment, the state set S tacs = {s1, s2, s3, s4, s5, s6, s7, s8, s9, s 10 , s 11 , s 12 , s 13 , s 14}, a total of 14 states; the signal set G tacs = {g1, g2, g3, g4, g5, g6, g7, g8, g9, g 10 , g 11 , g 12}, a total of 12 signals;
[0086] Step S2: Analyze the influence degree after the failure of each state in S tacs , and determine the severity level of each state in S tacs . In this embodiment, the failure mode and effects analysis FMEA method is adopted. The severity includes four levels: level I (mild), level II (critical), level III (fatal), and level IV (catastrophic), which are divided into 8 levels from 1 to 8 in sequence. The severity division is as Figure 5 shown. In this embodiment, for states s1, s2, s3, s4, s5, s6, s7, s8, s9, s 10 , s 11 , s 12 , s 13 , s 14 the severity levels are 8, 7, 4, 5, 7, 2, 3, 4, 2, 5, 2, 4, 6, 7 respectively;
[0087] Step S3: Combine the business functions of the train autonomous operation system, state set S tacs , signal set G tacs, the transition relationship between states and the severity levels of each state, using the severity state machine modeling method to formally describe the requirements of the train autonomous operation system, and establishing a severity state machine test model M1 that includes the functional logic and severity levels of the train autonomous operation system.
[0088] The severity state machine has basic elements of state S, signal G, and transition E. States include three types: simple state (BASIC), OR state, and AND state; the initial state category is denoted as KIND, including initial state (INIT) and normal state (NORMAL); the AND, OR, and NOT relationships between signals form a signal expression, denoted as G E ; the constant indicating that a signal always occurs is denoted as TRUE; a transition includes a source state src, a signal expression ge that triggers the transition, a signal a generated during the transition, and a target state tar.
[0089] The state hierarchy TREE of the severity state machine includes a bottom state back, a finite state hierarchy function c, a finite state type function u, a finite state initial category function w, and a state severity function v; c maps a state to its direct sub-state, u defines the type of each state, w defines whether a state is an initial state, and v assigns a severity level to the state. As Figure 2 shown, using the Z specification language, the state hierarchy of the severity state machine satisfies the following constraints:
[0090] (1) c assigns sub-states to states starting from the bottom state back. back is the only state without a parent state, satisfying: dom c \
[0091] ∪ (ran c) = {back};
[0092] (2) back is an OR state, satisfying: u(back) = OR;
[0093] (3) Any non-back state has exactly one direct parent state, satisfying:
[0094]
[0095] (4) c assigns sub-states to states, but cannot form a cyclic path, satisfying:
[0096]
[0097] (5) Only BASIC states have no sub-states, satisfying:
[0098] (6) Multiple concurrent OR states form an AND state, satisfying:
[0099]
[0100] (7) An OR state consists of states and transitions at the same level, containing and only containing one initial state, satisfying:
[0101]
[0102] (8) v assigns severity to states. The severity of an OR state and an AND state is the maximum severity among all its contained sub-states, satisfying:
[0103]
[0104] A severity state machine consists of a state hierarchy tree and a set of transitions, satisfying the following constraints:
[0105] (1) For any transition t, the source state and target state of t can be AND or BASIC states, satisfying: t·(tree.u(t1.src) = AND ∨ tree.u(t1.src) = BASIC) ∧ (tree.u(t1.tar) = AND ∨ tree.u(t1.tar) = BASIC);
[0106] (2) For any transition t, the source state and target state of t cannot be back states, satisfying:
[0107] (3) Transitions are not allowed to cross levels, satisfying:
[0108] (4) The direct sub-states of an OR state have and only have one INIT state, and the INIT state is at least the source state of one transition and not the target state of any transition, satisfying:
[0109] The maximum set of states that a severity state machine can be in simultaneously is called a configuration, denoted as conf. The set of initial states constitutes the initial configuration. At any given time, a severity state machine has only one active configuration. The severity of a configuration is the maximum severity of all states in the configuration. Given a severity state machine and any configuration cf, the following rules are followed:
[0110] (1) The configuration cf contains the bottom state back, that is, for the state hierarchy tree, the configuration cf satisfies: tree.back ∈ cf;
[0111] (2) If cf contains a non-back state st, then cf contains the parent state of st, satisfying:
[0112] (3) If cf contains an OR state st, then cf contains a certain direct sub-state of st, satisfying:
[0113] (4) If cf contains an AND state st, cf contains each direct OR sub-state of st, satisfying:
[0114] (5) cf only contains all states that satisfy rules (1), (2), (3), and (4).
[0115] For any configuration, it should at least contain the back state and a BASIC state.
[0116] The severity state machine test model M1 of this embodiment is as Figure 6 shown. M1 adds the state s0 on the basis of S tacs , which is the back state. M1 includes 10 BASIC states, 18 migrations, and 12 signals, and describes the change of system severity by assigning severity levels to states. For example, after the state s2 transfers to the state s1, the severity increases from 7 to 8. The severity function satisfies ran v = {1, 2, 3, 4, 5, 6, 7, 8}, the initial state is {s0, s2, s3, s4, s5, s6, s9 s 11}), c(s3) = {s 6, s 7, s8}, u(s1) = BASIC, u(s2) = AND, u(s3) = OR, v(s1) = 8, v(s3) = max(v(s6), v(s7), v(s8)) = 4, w(s6) = INIT, w(s7) = NORMAL. The initial configuration of M1 is (s0, s2, s3, s4, s5, s6, s9 s 11 ). If the signal g4 occurs, the state s6 transfers to the state s7, and M1 transfers from the initial configuration to the configuration (s0, s2, s3, s4, s5, s7, s9 s 11 ).
[0117] Step S4: Convert the train autonomous operation system test model M1 into a severity reachability graph model M2. The severity reachability graph is a quadruple SRG = (D, I, L, R), where: D is the set of reachable markings, I is the finite set of input symbols, L: D × I → D is the reachability marking transition function, and R: D → N is the severity assignment function for reachable markings. Map the configurations of the severity state machine to the reachable markings of the severity reachability graph, and map the severity of the configurations of the severity state machine to the severity of the corresponding reachable markings in the severity reachability graph. As Figure 3 shown, the method for converting the severity state machine into a severity reachability graph includes the following process:
[0118] (1) Create an empty configuration set CQ, an empty set of reachable markings D, and an empty set of input symbols I;
[0119] (2) Extract the initial configuration, denoted as cf0;
[0120] (3) Insert cf0 into CQ, CQ = CQ ∪ {cf0};
[0121] (4) If CQ ≠ EMPTY, go to step (5); otherwise, go to step (16);
[0122] (5) Select a configuration cf i from CQ and delete it from CQ, CQ = CQ\{cf i};
[0123] (6) If there exists a reachable marking D i corresponding to cf i in D, extract the reachable marking D i , and go to step (9); otherwise, go to step (7);
[0124] (7) Create a reachable marking D i corresponding to the configuration cf i , D = D ∪ {D i};
[0125] (8) Calculate the severity level r i of cf i , and R(D i ) = r i ;
[0126] (9) Obtain the set of all possible reachable configurations CF starting from cf i ;
[0127] (10) If CF ≠ EMPTY, go to step (11); otherwise, go to step (4);
[0128] (11) Select a configuration cf j, CQ = CQ ∪ {cf j}, and delete it from CF, CF = CF \ {cf j};
[0129] (12) If there already exists a corresponding reachable identifier D j in D for cf j , obtain the reachable identifier D j , and go to step (15); otherwise, go to step (13);
[0130] (13) Create the reachable identifier D j corresponding to the pattern cf j , D = D ∪ {D j};
[0131] (14) Calculate the severity level r j of cf j , and R(D j ) = r j ;
[0132] (15) Obtain the condition t for cf i to transfer to cf j and the corresponding transfer symbol i, I = I ∪ {i}, L(D i , t) → D j , and go to step (10);
[0133] (16) Output the severity reachability graph SRG = (D, I, L, R).
[0134] In this embodiment, the severity state machine test model M1 is transformed into the severity reachability graph model M2 as Figure 7 shown. For convenience of description, labels are added to each transfer in M2 for marking. The severity reachability graph model M2 includes 7 reachable identifiers, corresponding to the 7 patterns of M1 respectively. For convenience of description, the reachable identifier only includes the BASIC states in the pattern. For example, the reachable identifier (s8, s 10 , s 14 ) corresponds to the pattern (s0, s2, s3, s4, s5, s8, s 10 , s 14 ) of M1, and the severity is the maximum value of the severities of the states s0, s2, s3, s4, s5, s8, s 10 , s 14 , which is 7.
[0135] Step S5: Determine the test start reachable identifier d0 and the end reachable identifier d f of the severity reachability graph model M2. In this embodiment, the reachable identifier (s6, s9, s 11 ) is selected as the test start reachable identifier d0, (s6, s9, s11 ) is to terminate the reachable identifier d f .
[0136] Step S6: Calculate the main path set P of M2 p and the edge pair set E p , and for any main path, d0 is not an intermediate node; calculate the path set that can reach d starting from d0 along the migrations in the severity reachability graph f and completely covers the main path set P p , denoted as the test case set Tcp; determine whether the test case set Tcp completely covers the edge pair set E p , if Tcp completely covers the edge pair set E p , the train autonomous operation system test case Tc = Tcp; if Tcp does not completely cover the edge pair set E p , for the edge pair set E p in E that has not been covered pu , calculate the path set that can reach d starting from d0 along the migrations in the severity reachability graph f and completely covers the edge pair set E pu , denoted as the test case set Tce, the train autonomous operation system test case Tc = Tcp ∪ Tce. As Figure 4 shown, the specific calculation process is as follows:
[0137] (1) Create an empty test case set TC;
[0138] (2) Obtain the main path set P p ;
[0139] (3) If P p ≠EMPTY, go to step (4); otherwise, go to step (7);
[0140] (4) Select a main path p from P p , delete p from P p , P p = P p \{p};
[0141] (5) Generate a test case t that covers the main path p according to the starting reachable identifier d0 and the terminating reachable identifier d f ;
[0142] (6) Insert t into TC, TC = TC ∪ {t}. Go to step (3);
[0143] (7) Obtain the edge pair set E p ;
[0144] (8) If E p ≠EMPTY, go to step (9); otherwise, go to step (13);
[0145] (9) Select an edge pair ep from E p and delete it from E p ; E p = E p \{ep};
[0146] (10) If there is at least one test case in TC that covers ep, go to step (8); otherwise, go to step (11);
[0147] (11) Generate a test case t that covers the edge pair ep according to the starting reachable identifier d0 and the ending reachable identifier d f ;
[0148] (12) Insert t into TC, TC = TC ∪ {t}, and go to step (8);
[0149] (13) Output the TC set.
[0150] In this embodiment, the main path set P of M2 p As Figure 8 shown, it includes 14 main paths Pp1–Pp14. Generate test cases for each main path, and calculate the path set that can reach (s6, s9, s 11 ) along the transitions in the severity reachability graph from (s6, s9, s 11 ) and covers the main path set P p . A total of 13 test cases are generated.
[0151] The edge pair set E of M2 p As Figure 9 shown, it includes 19 edge pairs Ep1–Ep19. The 13 test cases generated when covering the main paths can already fully cover the edge pair set E p , and there is no need to generate new test cases for edge pair coverage. The 13 test cases and the main paths and edge pairs covered by each test case are as Figure 10 shown. For description purposes, the test cases are described in terms of transitions.
[0152] Step S7: Identify the reachable identifiers included in each test case, and calculate the severity sequence of each test case. The severity sequence is a permutation of the severities of all reachable identifiers included in the test case from largest to smallest. For the test case tc, its severity sequence is denoted as PS tc ;#PS tc represents the length of the sequence PS tc , and PS tc (i) represents the severity value at the i-th position of the severity sequence PS tc . For example, the test case Tc1 = {t1, t4, t7, t11 ,t 16 ,t 17}, the severities of each state of the test case are: 2, 3, 4, 5, 7, 8, 2, and the severity sequence is: 8, 7, 5, 4, 3, 2, 2. Test case Tc2 = {t1, t4, t7, t 11 ,t 14}, the severities of each state of the test case are: 2, 3, 4, 5, 7, 2, and the severity sequence is: 7, 5, 4, 3, 2, 2.
[0153] Step S8: According to the severity sequence of the test case, use the exponentially weighted moving average to calculate the priority of the test case. For the severity sequence PS of the test case tc tc , the priority of tc is denoted as A(tc), and where: β ∈ [0, 1], β represents the weighting coefficient, y i represents the priority at the i-th position of the severity sequence PS tc of the test case.
[0154] In this embodiment, β = 0.9. Taking Tc1 as an example, y1 = 8, y2 = 0.9×8 + (1 – 0.9)×7 = 7.90, y3 = 0.9×7.9 + (1 – 0.9)×5 = 7.61. Similarly, y4 = 7.25, y5 = 6.82, y6 = 6.34, y7 = 5.91. The priority of tc1 is: A(Tc1) = (y1 + y2 + y3 + y4 + y5 + y6 + y7) / 7 = 7.12.
[0155] Step S9: Sort the test cases in descending order according to the priority of the test cases to form a sorted test case set. The higher the priority of the test case, the higher the safety of the test case covering the train autonomous operation system, and the more urgently it needs to be tested. The priorities of test cases Tc1 - Tc13 are as Figure 11 shown, and the test priorities are Tc1, Tc2, Tc4, Tc3, Tc13, Tc5, Tc6, Tc9, Tc12, Tc7, Tc8, Tc10, Tc11 in sequence. According to the method proposed by the present invention, it is possible to ensure that the function modules with high severity are preferentially tested.
[0156] Embodiment 2
[0157] The difference between this embodiment and Embodiment 1 is that the severity state machine test model M1 of the function logic and severity characteristics of the train autonomous operation system is as Figure 12 shown. Convert the train autonomous operation system test model M1 into a severity reachability graph model M2 as Figure 13 shown.
[0158] Select the reachable marking (s2, s5) of M2 as the starting reachable marking d0 for testing, and (s4, s6) as the ending reachable marking d f .
[0159] For any main path and edge pair, d0 is not an intermediate node among them, and the set of main paths P of M2 p As Figure 14 shown, it includes 5 main paths Pp1–Pp5 in total. Generate test cases for each main path, and a total of 5 test cases are generated.
[0160] The set of edge pairs E of M2 p As Figure 15 shown, it includes 12 edge pairs Ep1–Ep12 in total. When covering the main paths, the main paths and edge pairs covered by the 5 generated test cases are as Figure 16 shown. For the sake of description, the test cases are described in the form of migrations. The 5 test cases fail to completely cover the set of edge pairs E p , and the uncovered set of edge pairs E pu = {Ep6, Ep8, Ep11}.
[0161] Generate test cases for Ep6, Ep8, and Ep11 respectively, calculate the set of paths that can reach (s4, s6) from (s2, s5) along the migrations in the severity reachability graph and cover the edge pairs Ep6, Ep8, and Ep11. A total of 3 test cases are generated, and the edge pairs covered by each test case are as Figure 17 shown. Combining with the test cases covering the main paths, there are 8 test cases in total in this embodiment.
[0162] Calculate the priorities of the test cases. According to the priorities of the test cases, sort the test cases from high to low in turn to form a sorted set of test cases. In this embodiment, β = 0.95, and the priorities of the test cases Tc1 - Tc8 are as Figure 18 shown. The test priorities from high to low are Tc6, Tc8, Tc1, Tc5, Tc4, Tc7, Tc2, and Tc3 in turn. According to the method proposed by the present invention, it can ensure that the functional modules with high severity are preferentially tested.
[0163] It should be recognized that embodiments of the present invention can be implemented or carried out by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The methods can be implemented in a computer program using standard programming techniques - including a non-transitory computer-readable storage medium configured with the computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner - according to the methods and drawings described in the specific embodiments. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system. However, if desired, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. Additionally, for this purpose the program is capable of running on a programmed application-specific integrated circuit.
[0164] Furthermore, the operations of the processes described herein can be executed in any suitable order, unless otherwise indicated herein or otherwise clearly contradicted by the context. The processes described herein (or variations and / or combinations thereof) can be executed under the control of one or more computer systems configured with executable instructions, and can be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) collectively executed on one or more processors, by hardware, or by a combination thereof. The computer programs include a plurality of instructions executable by one or more processors.
[0165] Further, the methods can be implemented in any type of computing platform operably connected, including but not limited to personal computers, minicomputers, mainframes, workstations, network or distributed computing environments, separate or integrated computer platforms, or in communication with charged particle tools or other imaging devices, etc. Aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into the computing platform, such as a hard disk, optical read and / or write storage medium, RAM, ROM, etc., such that it can be read by a programmable computer and can be used to configure and operate the computer to execute the processes described herein when the storage medium or device is read by the computer. Additionally, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media include instructions or programs that implement the above-described steps in conjunction with a microprocessor or other data processor, the inventions described herein include these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the purpose and scope of the present technical solution, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A method for prioritizing test cases of a train autonomous operation system, characterized in that: The method includes the following steps: Step S1: Analyze the modeling requirements of the system according to the business functions of the train autonomous operation system, and extract the state set S of the system tacs , signal set G tacs and the transition relationship between states; Step S2: Analyze S tacs to determine the impact level after each state in S fails, and determine the severity level of each state in S tacs ; Step S3: Combine the business functions of the train autonomous operation system, the state set S tacs , the signal set G tacs , the transfer relationship between states and the severity level of each state, and use the severity state machine modeling method to describe the requirements of the train autonomous operation system, and establish a severity state machine test model M1 that includes the functional logic and severity level of the train autonomous operation system; Step S4: Convert the train autonomous operation system test model M1 into a severity reachability graph model M2. The severity reachability graph is a quadruple SRG = (D, I, L, R), where: D is the set of reachable markings, I is the set of finite input symbols, L: D × I → D is the reachable marking transition function, and R: D → N is the reachable marking severity assignment function. Map the configuration of the severity state machine to the reachable markings of the severity reachability graph, and map the severity of the configuration of the severity state machine to the severity of the corresponding reachable markings in the severity reachability graph; Step S5: Determine the test start reachable identification d0 and the termination reachable identification d of the severity reachable graph model M2 f ; Step S6: Calculate the set P of the main paths of M2 p and the set E of edge pairs p , and for any main path, d0 is not an intermediate node; calculate the test case set Tc that completely covers the set P of main paths p and the set E of edge pairs p ; Step S7: Identify the reachable markings included in each test case, and calculate the severity sequence of each test case; Step S8: According to the severity sequence of the test cases, use the exponentially weighted moving average to calculate the priority of the test cases; Step S9: Sort the test cases in descending order according to the priority of the test cases to form a sorted test case set.
2. The method for prioritizing test cases of a train autonomous operation system according to claim 1, wherein: In step S3, the severity state machine is defined as follows: The severity state machine has the basic elements of state S, signal G, and transition E. The states include three types: simple state (BASIC), OR state (OR), and AND state (AND). The initial state category is denoted as KIND, including the initial state (INIT) and the normal state (NORMAL). The AND (and), OR (or), and NOT (not) relationships between signals form a signal expression, denoted as G E ; The constant indicating that the signal always occurs is denoted as TRUE. The transition includes the source state src, the signal expression ge that triggers the transition, the signal a generated during the transition, and the target state tar; The state hierarchy TREE of the severity state machine includes the bottom state back, the finite state hierarchy function c, the finite state type function u, the finite state initial category function w, and the state severity function v; c maps a state to its direct sub-state, u defines the type of each state, w defines whether the state is an initial state, and v assigns a severity level to the state.
3. A method for prioritizing test cases of a train autonomous operation system according to claim 1 or 2, characterized in that: The specific steps of step S4 include the following process: (1) Create an empty configuration set CQ, an empty reachable marking set D, and an empty input symbol set I; (2) Extract the initial configuration, denoted as cf0; (3) Insert cf0 into CQ, CQ = CQ ∪ {cf0}; (4) If CQ ≠ EMPTY, go to step (5); otherwise, go to step (16); (5) Select the pattern cf from CQ i , and delete it from CQ, CQ = CQ\{cf i}; (6) If cf exists in D i The corresponding reachable marking D i , extract the reachable marking D i , go to step (9); otherwise, go to step (7); (7) Create pattern cf i The corresponding reachable mark D i , D = D ∪ {D i}; (8) Calculate cf i severity level r of i , and R(D i ) = r i ; (9) Obtain all possible reachable configuration sets starting from cf i and denote them as CF; (10) If CF ≠ EMPTY, go to step (11); otherwise, go to step (4); (11) Select pattern cf from CF j , CQ = CQ ∪ {cf j}, and delete it from CF, CF = CF \ {cf j}; (12) If cf j already has a corresponding reachable identifier D in D j , obtain the reachable identifier D j , go to step (15); otherwise, go to step (13); (13) Create pattern cf j The corresponding reachable mark D j , D = D ∪ {D j}; (14) Calculate cf j severity level r of j , and R(D j ) = r j ; (15) Obtain cf i Transfer to cf j The condition t and the corresponding transfer symbol i, I = I ∪ {i}, L(D i , t) → D j , go to step (10); (16) Output the severity reachability graph SRG = (D, I, L, R).
4. A method for prioritizing test cases of a train autonomous operation system according to claim 1 or 2, characterized in that: In step S6, the method for calculating the test case set Tc is as follows: Calculate the path set that can reach d starting from d0 along the migrations in the severity reachability graph f and completely cover the main path set P p The path set is denoted as the test case set Tcp; Determine whether the test case set Tcp completely covers the edge pair set E p If Tcp completely covers the edge pair set E p the train autonomous operation system test case Tc = Tcp; If Tcp does not completely cover the edge pair set E p for the edge pair set E p in E that has not been covered pu calculate the path set that can reach d starting from d0 along the migrations in the severity reachability graph f and completely cover the edge pair set E pu The path set is denoted as the test case set Tce, and the train autonomous operation system test case Tc = Tcp ∪ Tce.
5. A method for prioritizing test cases of a train autonomous operation system according to claim 4, characterized in that: The specific steps of step S6 include the following process: (1) Create an empty test case set TC; (2) Obtain the set of main paths P p ; (3) If P p ≠ EMPTY, go to step (4); otherwise, go to step (7); (4) Select a main path p from P p Delete p from P p P p = P p \{p}; (5) Generate a test case t that covers the main path p based on the starting reachable identifier d0 and the ending reachable identifier d f ; (6) Insert t into TC, TC = TC ∪ {t}, and go to the above step (3); (7) Obtain the set of edge pairs E p ; (8) If E p ≠EMPTY, go to step (9); otherwise, go to the following step (13); Select an edge pair ep from E p and delete it from E p ; E p = E p \{ep}; (10) If there is at least one test case in TC that covers ep, go to step (8); otherwise, go to step (11); (11) Generate a test case t for covering the edge pair ep based on the starting reachable identifier d0 and the ending reachable identifier d f ; (12) Insert t into TC, TC = TC ∪ {t}, and go to step (8); (13) Output the TC set.
6. A method for prioritizing test cases of a train autonomous operation system according to claim 1, characterized in that: In the step S7, the severity sequence is an arrangement of the severities of all reachable markings included in the test case from the largest to the smallest. For the test case tc, its severity sequence is denoted as PS tc ;#PS tc denotes the length of the sequence PS tc PS tc (i) denotes the severity value at the i-th position of the severity sequence PS tc 7. A method for prioritizing test cases of a train autonomous operation system according to claim 1, characterized in that: In the step S8, the priority calculation method of the test case is as follows: for the severity sequence PS of the test case tc tc , the priority of tc is denoted as A(tc), and where: β ∈ [0, 1] β represents a weighting coefficient, y i represents the severity sequence PS tc the priority at the i-th position.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: When the processor executes the computer program, it implements the method according to any one of claims 1-7.
9. A computer-readable storage medium storing a computer program thereon, characterized in that: When the computer program is executed by the processor, it implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
SoftAPFD evaluation method for test case optimization
CN118069512A
Train autonomous operation control system test case generation method and device and storage medium
CN118394638A