Train autonomous operation system test case priority ranking method and device and storage medium
By converting the severity state machine of the train autonomous operation system into a severity reachable graph, the priority of test cases is calculated, and the problem of lack of priority of test cases in the prior art is solved, efficient test case sorting and priority testing are achieved, and testing efficiency and predictability of project management are improved.
Patent Information
- Application Number
- CN202411646544.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The test cases of existing train autonomous running systems lack priority attributes, which leads to a high level of experience and randomness of relying on testers during the test process, resulting in a long test cycle, especially the defect repair and regression testing time of high-strength modules.
The severity state machine theory is adopted, and the severity state machine is converted into a severity reachable graph, and the priority of the test case is calculated, thereby guiding the priority testing of high severity functional modules.
It realizes potential problems in the detection of high-rigorous modules in the early stage of testing, reduces the risk of serious defects being discovered in the late stage of testing, and improves the predictability of testing efficiency and project management.
Smart Images

Figure CN119621551A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of train autonomous operation system testing, and in particular to a method, device and storage medium for prioritizing test cases of a train autonomous operation system. Background Art
[0002] The autonomous train operation system has the characteristics of simple structure, intelligent and reliable, economical operation and maintenance, and safe operation. It is an important trend in the development of train control technology and a new generation of train operation control system that is currently 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, before it is put into operation, it needs to undergo rigorous and comprehensive testing to ensure that the system's functionality and safety requirements meet 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. Generally, 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 time and cost required for repair. At present, the test cases of the train autonomous operation system do not have priority attributes. During the test process, the execution order of the test cases is mainly arranged by the tester based on experience or randomness, which depends largely on the tester's intuition, and is relatively subjective and random. The number of test cases for the train autonomous operation system is huge, and the test cycle is long. Especially for the high-severity modules in the system, the time for defect repair and regression testing is usually long. Carrying out tests according to the severity levels of different modules in the system helps to discover potential critical and high-risk problems in the system at the early stage of testing, so that there is more time and resources for repair, ensuring that the project proceeds smoothly as planned. In the process of project management and decision-making, 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 project plans. At the same time, during the project development process, team members may have concerns about project quality and progress. By prioritizing the testing and repair of problems in high-severity modules, the confidence and morale of team members can be enhanced, and the smooth progress of the project can be promoted. Organizing test activities according to the severity levels of different modules helps to improve and optimize the management of the life cycle of the train autonomous operation system, which is of certain significance to the testing of the train autonomous operation system.
[0004] Therefore, it is necessary to design a method for the problem of prioritizing test cases for the train autonomous operation system, which can generate test cases with priority order based on the severity level of the train autonomous operation system. Summary of the invention
[0005] In view of this, one of the purposes of the present invention is to provide a method for prioritizing test cases for a train autonomous operation system. One of the purposes of the present invention is to describe the functional logic and severity level of the system by using a test modeling method of a severity state machine based on finite state machine theory; and to propose an algorithm for converting a severity state machine into a severity reachability graph to calculate the priority of test cases, so as to achieve the goal of guiding the priority testing of high severity functional modules.
[0006] One of the purposes of the present invention is achieved through the following technical solutions:
[0007] The method for prioritizing test cases of the train autonomous operation system comprises the following steps:
[0008] Step S1: According to the business functions of the train autonomous operation system, analyze the system modeling requirements and extract the system state set S tacs , signal set G tacs and the transition relationship between states;
[0009] Step S2: Analyze S tacs The impact degree after failure of each state in S tacs The severity level of each state in the
[0010] Step S3: Combine the business functions and state set S of the train autonomous operation system 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 that includes the functional logic of the train autonomous operation system and the severity level;
[0011] Step S4: converting the train autonomous operation system test model M1 into a severity reachability graph model M2, the severity reachability graph is a four-tuple SRG=(D,I,L,R), where: D is a reachable identifier set, I is a finite input symbol set, L:D×I→D is a reachable identifier transfer function, R:D→N is a reachable identifier severity allocation function, mapping the pattern of the severity state machine to the reachable identifier of the severity reachability graph, and mapping the severity of the severity state machine pattern to the severity of the corresponding reachable identifier in the severity reachability graph;
[0012] Step S5: Determine the test start reachability mark d0 and the end reachability mark d f ;
[0013] 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 complete coverage main path set Pp and the edge pair set E p The test case set Tc:
[0014] Furthermore, we calculate the number of migrations from d0 along the severity reachable graph that can reach d f And completely cover the main path set P p The path set is recorded 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 test case of the train autonomous operation system Tc = Tcp; if Tcp does not completely cover the edge pair set E p , for E p The set of edge pairs E that have not yet been covered pu , calculate the migration from d0 along the severity reachable graph to reach d f And completely covers the edge pair set E pu The path set is recorded as the test case set Tce, and the train autonomous operation system test case Tc = Tcp∪Tce.
[0015] Step S7: Identify the reachability identifiers contained in each test case and calculate the severity sequence of each test case;
[0016] Furthermore, the severity sequence is an arrangement of the severity of all reachable identifiers contained in the test case from large to small. For the test case tc, its severity sequence is recorded as PS tc ;#PS tc Represents sequence PS tc Length, PS tc (i) represents the severity sequence PS tc The severity value of the ith position;
[0017] Step S8: According to the severity sequence of the test cases, the priority of the test cases is calculated using an exponentially weighted moving average:
[0018] Furthermore, the severity sequence PS of the test case tc tc , the priority of tc is denoted by A(tc), and Among them: β∈[0,1], β represents the weighting coefficient, y i Represents the severity sequence PS tc Priority at the ith position;
[0019] Step S9: Sort the test cases in descending order according to their priorities 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 priority the test needs to be performed.
[0020] Furthermore, in step S3, the severity state machine is defined as follows:
[0021] 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 recorded as KIND, including the initial state (INIT) and the normal state (NORMAL). The and (and) relationship, or (or) relationship, and not (not) relationship between signals constitute the signal expression, recorded as G. E ; The constant that the signal always occurs is recorded 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;
[0022] 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 from a state to its direct child state, u defines the type of each state, w defines whether the state is the initial state, and v assigns a severity level to the state.
[0023] Further, the step S4 specifically includes the following process:
[0024] (1) Create an empty pattern set CQ, an empty reachable identifier set D, and an empty input symbol set I;
[0025] (2) Extract the initial pattern, 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 the pattern cf from CQ i , and delete it from CQ, CQ = CQ\{cf i};
[0029] (6) If there is cf in D i Corresponding reachability identifier D i , extract the reachable identifier D i , go to step (9); otherwise, go to step (7);
[0030] (7) Create a pattern cf i Corresponding reachability identifier D i , D=D∪{D i};
[0031] (8) Calculate cf i The severity level r i , and R(D i )=r i ;
[0032] (9) Get from cf i The set of all possible patterns to be reached is denoted as CF;
[0033] (10) If CF≠EMPTY, go to step (11); otherwise, go to step (4);
[0034] (11) Select the pattern cf from CF j , CQ=CQ∪{cf j}, and delete it from CF, CF=CF\{cf j};
[0035] (12) If cf j There is already a corresponding reachable identifier D in D j , get the reachable identifier D j , go to step (15); otherwise, go to step (13);
[0036] (13) Create a pattern cf j Corresponding reachability identifier D j , D=D∪{D j};
[0037] (14) Calculate cf j The severity level r j , and R(D j )=r j ;
[0038] (15) Get 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);
[0039] (16) Output severity reachability graph SRG = (D, I, L, R).
[0040] Further, the step S6 specifically includes the following process:
[0041] (1) Create an empty test case set TC;
[0042] (2) Obtaining the main path set P p ;
[0043] (3) If P p≠EMPTY, go to step (4); otherwise, go to step (7);
[0044] (4) From P p Select a main path p from P p Delete p, P p =P p \{p};
[0045] (5) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test case t covering the main path p;
[0046] (6) Insert t into TC, TC = TC∪{t}. Go to step (3);
[0047] (7) Get the edge pair set E p ;
[0048] (8) If E p ≠EMPTY, go to step (9); otherwise, go to step (13);
[0049] (9) From E p Choose an edge pair ep from E p Delete E p =E p \{ep};
[0050] (10) If there is at least one test case covering ep in TC, go to step (8); otherwise, go to step (11);
[0051] (11) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test cases t that cover edge pairs ep;
[0052] (12) Insert t into TC, TC = TC∪{t}, and go to step (8);
[0053] (13) Output TC set.
[0054] A second object of the present invention is to provide a computer device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the method described above when executing the computer program.
[0055] A third object of the present invention is to provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method described above when executed by a processor.
[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 the traditional modeling method, incorporates the severity characteristics of different functional modules of the train autonomous operation system into the test model, and covers the functional logic and severity changes of the system at the same time, providing a new model basis for the test of the train autonomous operation system.
[0058] (2) The train autonomous operation system test case priority sorting method proposed in the present invention covers the entire process of the train autonomous operation system from test modeling to test case generation and sorting, and proposes a method for converting a severity state machine into a severity reachability graph, which can traverse the test path of the train autonomous operation system. While ensuring the comprehensiveness of the train autonomous operation system test, it adds priority attributes to the test cases, which can guide the execution order of the test cases and avoid the current problem that the execution order of the test cases depends on the experience of the testers and is highly subjective and random.
[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 early stage of testing, especially functional modules involving complex logic, interaction with external systems and core business processes, so that more time and resources are available to repair defects and reduce the risks caused by discovering serious defects in the late stage of testing. It helps to improve and optimize the management of the life cycle of the train autonomous operation system and ensure that the project proceeds smoothly as planned.
[0060] (4) The method provided by the present invention helps project managers to better predict project risks, formulate countermeasures and adjust project plans through quantitative indicators. The method provided by the present invention can prioritize testing and repairing problems in high-severity functional modules, thereby enhancing the confidence of team members and promoting the smooth progress of the project.
[0061] (5) The method provided by the present invention can significantly early detect 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. It is particularly suitable for large-scale and complex safety-critical systems with greatly differentiated safety requirements.
[0062] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description and the preceding claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0064] Figure 1 It is a schematic diagram of the process of the present invention;
[0065] Figure 2 The definition of the Z specification language of the severity state machine of the present invention;
[0066] Figure 3 A schematic diagram of a process of converting a severity state machine into a severity reachability graph according to the present invention;
[0067] Figure 4 A schematic diagram of a process flow generated for a test case of the present invention;
[0068] Figure 5 The severity level classification and definition of Example 1;
[0069] Figure 6 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] Fig. 9 is the edge pair set of Example 1;
[0073] Fig.10 The main paths and edge pairs covered by the test cases in Example 1;
[0074] Fig.11 The priority of the test case of Example 1;
[0075] Fig.12 The severity state machine test model of Example 2;
[0076] Fig.13 The severity reachability graph model of Example 2;
[0077] Fig.14 is the main path set of Example 2;
[0078] Fig.15 is the edge pair set of Example 2;
[0079] Fig.16 The main paths and edge pairs covered by the test cases generated for the main path coverage of Example 2;
[0080] Fig.17 The set of edge pairs covered by the test cases generated for the edge pair coverage of Example 2;
[0081] Fig.18 The priority of the test case of Example 2. DETAILED DESCRIPTION
[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 for limiting the protection scope of the present invention.
[0083] Embodiment 1
[0084] like Figure 1 As shown, this embodiment specifically includes the following steps:
[0085] Step S1: According to the business functions of the train autonomous operation system, analyze the system modeling requirements and extract the system state set S tacs , signal set G tacs And the transition relationship 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; 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 S tacs The impact degree after failure of each state in S tacs The severity level of each state in the failure mode and effect analysis FMEA method is used in this embodiment. 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. The severity is divided as follows: Figure 5 In this embodiment, 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;
[0087] Step S3: Combine the business functions and state set S of the train autonomous operation system tacs , signal set G tacs, the transition relationship between states and the severity level of each state, and adopt 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 that includes the functional logic of the train autonomous operation system and the severity level.
[0088] 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 recorded as KIND, including the initial state (INIT) and the normal state (NORMAL). The and (and) relationship, or (or) relationship, and not (not) relationship between signals constitute the signal expression, recorded as G. E ; The constant that the signal always occurs is recorded 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.
[0089] 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 from a state to its direct child state, u defines the type of each state, w defines whether the state is the initial state, and v assigns a severity level to the state. Figure 2 As shown, using the Z specification language, the state hierarchy of the severity state machine satisfies the following constraints:
[0090] (1) c assigns a child state to the state from the bottom state back. back is the only state without a parent state, satisfying: domc\
[0091] ∪(ran c)={back};
[0092] (2) back is in OR state, satisfying: u(back) = OR;
[0093] (3) Any non-back state has only one direct parent state that satisfies:
[0095] (4) c is a state that allocates sub-states, but cannot form a cyclic path, satisfying:
[0097] (5) Only the BASIC state has no substates, satisfying:
[0098] (6) Multiple concurrent OR states form an AND state, satisfying:
[0100] (7) The OR state consists of states and transitions at the same level, including and only including one initial state, satisfying:
[0101]
[0102] (8) v assigns severity to the state. The severity of the OR state and the AND state is the maximum severity of all the sub-states it contains, satisfying:
[0103]
[0104] A severity state machine consists of a state hierarchy tree and a migration set, 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 in the back state, satisfying:
[0107] (3) Migration is not allowed across layers, and must meet the following requirements:
[0108] (4) The direct child state of the OR state has one and only one INIT state, and the INIT state is the source state of at least one migration and is not the target state of any migration, satisfying:
[0109] The maximum set of states that a severity state machine can be in at the same time is called a configuration, denoted by conf. The set of initial states constitutes the initial configuration. At any time, the 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 an arbitrary configuration cf, follow the following rules:
[0110] (1) cf contains the bottom state back, that is, for the state hierarchy tree, the pattern 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 direct substate of st that satisfies:
[0113] (4) If cf contains an AND state st, cf contains every direct OR substate of st, satisfying:
[0114] (5) cf only contains all states that satisfy rules (1), (2), (3), and (4).
[0115] For any configuration, at least a back state and a BASIC state should be included.
[0116] The severity state machine test model M1 of this embodiment is as follows: Figure 6 As shown. M1 in S tacs Based on M1, the s0 state is added, which is the back state. M1 includes 10 BASIC states, 18 migrations, and 12 signals. The severity level is assigned to the state to describe the change of system severity. For example, after state s2 is transferred to state s1, the severity increases from 7 to 8. The severity function satisfies ran v = {1,2,3,4,5,6,7,8}, and 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. M1 initial pattern (s0,s2,s3,s4,s5,s6,s9 s 11 ), if signal g4 occurs, state s6 transfers to state s7, and M1 changes from the initial state to the state (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 four-tuple SRG=(D,I,L,R), where: D is a reachable identifier set, I is a finite input symbol set, L:D×I→D is a reachable identifier transfer function, and R:D→N is a reachable identifier severity allocation function. Map the pattern of the severity state machine to the reachable identifier of the severity reachability graph, and map the severity of the severity state machine pattern to the severity of the corresponding reachable identifier in the severity reachability graph. Figure 3As shown, the method of converting the severity state machine into a severity reachability graph includes the following processes:
[0118] (1) Create an empty pattern set CQ, an empty reachable identifier set D, and an empty input symbol set I;
[0119] (2) Extract the initial pattern, 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 the pattern cf from CQ i , and delete it from CQ, CQ = CQ\{cf i};
[0123] (6) If there is cf in D i Corresponding reachability identifier D i , extract the reachable identifier D i , go to step (9); otherwise, go to step (7);
[0124] (7) Create a pattern cf i Corresponding reachability identifier D i , D=D∪{D i};
[0125] (8) Calculate cf i The severity level r i , and R(D i )=r i ;
[0126] (9) Get from cf i The set of all possible patterns to be reached is denoted as CF;
[0127] (10) If CF≠EMPTY, go to step (11); otherwise, go to step (4);
[0128] (11) Select the pattern cf from CF j , CQ=CQ∪{cf j}, and delete from CF, CF = CF\{cf j};
[0129] (12) If cf j There is already a corresponding reachable identifier D in D j , get the reachable identifier D j , go to step (15); otherwise, go to step (13);
[0130] (13) Create a pattern cf j Corresponding reachability identifier D j , D=D∪{D j};
[0131] (14) Calculate cf j The severity level r j , and R(D j )=r j ;
[0132] (15) Get 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);
[0133] (16) Output severity reachability graph SRG = (D, I, L, R).
[0134] In this embodiment, the severity state machine test model M1 is converted into a severity reachability graph model M2 as shown in Figure 7 As shown. For the convenience of description, M2 adds a label to each transition. The strictness reachability graph model M2 includes 7 reachability identifiers, corresponding to the 7 patterns of M1. For the convenience of description, the reachability identifier only includes the BASIC state in the pattern. For example, the reachability identifier (s8,s 10 ,s 14 ) corresponds to the pattern of M1 (s0,s2,s3,s4,s5,s8,s 10 ,s 14 ), the severity is state s0,s2,s3,s4,s5,s8,s 10 ,s 14 The maximum value of severity is 7.
[0135] Step S5: Determine the test start reachability mark d0 and the end reachability mark d f In this embodiment, the reachable identifier (s6, s9, s 11 ) is the test start reachable marker d0, (s6, s9, s 11 ) is the terminal reachable mark 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 migration from d0 along the strictness reachable graph to reach d f And completely cover the main path set P pThe path set is recorded 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 test case of the train autonomous operation system Tc = Tcp; if Tcp does not completely cover the edge pair set E p , for E p The set of edge pairs E that have not yet been covered pu , calculate the migration from d0 along the severity reachable graph to reach d f And completely covers the edge pair set E pu The path set is recorded as the test case set Tce, and the train autonomous operation system test case Tc = Tcp∪Tce. Figure 4 As shown, the specific calculation process is as follows:
[0137] (1) Create an empty test case set TC;
[0138] (2) Obtaining the main path set P p ;
[0139] (3) If P p ≠EMPTY, go to step (4); otherwise, go to step (7);
[0140] (4) From P p Select a main path p from P p Delete p, P p =P p \{p};
[0141] (5) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test case t covering the main path p;
[0142] (6) Insert t into TC, TC = TC∪{t}. Go to step (3);
[0143] (7) Get the edge pair set E p ;
[0144] (8) If E p ≠EMPTY, go to step (9); otherwise, go to step (13);
[0145] (9) From E p Choose an edge pair ep from E p Delete E p =E p \{ep};
[0146] (10) If there is at least one test case covering ep in TC, go to step (8); otherwise, go to step (11);
[0147] (11) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test cases t that cover edge pairs ep;
[0148] (12) Insert t into TC, TC = TC∪{t}, and go to step (8);
[0149] (13) Output TC set.
[0150] In this embodiment, the main path set P of M2 p like Figure 8 As shown in Figure 1, there are 14 main paths including Pp1–Pp14. Generate test cases for each main path and calculate the 11 ) along the migration in the severity reachable graph can reach (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 like Fig. 9 As shown, there are 19 edge pairs including Ep1–Ep19. The 13 test cases generated when covering the main path can completely cover the edge pair set E. p , no new test cases need to be generated for edge pair coverage. The 13 test cases and the main paths and edge pairs covered by each test case are as follows Fig.10 As shown in the figure, for the description aspect, the test case is described in a migration way.
[0152] Step S7: Identify the reachability flags contained in each test case and calculate the severity sequence of each test case. The severity sequence is an arrangement of the severity of all reachability flags contained in the test case from large to small. For test case tc, its severity sequence is recorded as PS tc ;#PS tc Represents sequence PS tc Length, PS tc (i) represents the severity sequence PS tc The severity value of the ith position. For example, the test case Tc1 = {t1, t4, t7, t 11 , t 16 , t 17}, the severity of each state of the test case is: 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 severity of each state of the test case is: 2, 3, 4, 5, 7, 2, and the severity sequence is: 7, 5, 4, 3, 2, 2.
[0153] Step S8: Calculate the priority of the test case using exponential weighted moving average according to the severity sequence of the test case. tc , the priority of tc is denoted by A(tc), and Among them: β∈[0,1], β represents the weighting coefficient, y i Represents the severity sequence PS tc The priority at the ith position.
[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 from high to low according to their priorities 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 priority the test needs to be performed. The priorities of test cases Tc1-Tc13 are as follows: Fig.11 As shown, the test priorities are Tc1, Tc2, Tc4, Tc3, Tc13, Tc5, Tc6, Tc9, Tc12, Tc7, Tc8, Tc10, and Tc11. According to the method proposed in the present invention, it is possible to ensure that functional modules with high severity are tested first.
[0156] Example 2
[0157] The difference between this embodiment and embodiment 1 is that the severity state machine test model M1 of the train autonomous operation system functional logic and severity characteristics is as follows: Fig.12 The train autonomous operation system test model M1 is converted into the severity reachability graph model M2 as shown in Fig.13 shown.
[0158] Select M2's reachable identifier (s2, s5) as the test start reachable identifier d0, and (s4, s6) as the test end reachable identifier d f .
[0159] For any main path and edge pair, d0 is not its intermediate node, and the main path set P of M2 is p like Fig.14As shown, there are 5 main paths including Pp1-Pp5. A test case is generated for each main path, and a total of 5 test cases are generated.
[0160] The edge pair set E of M2 p like Fig.15 As shown in Figure 1, there are 12 edge pairs, including Ep1–Ep12. When covering the main path, the main path and edge pairs covered by the generated 5 test cases are as follows: Fig.16 As shown. For the description aspect, the test cases are described in a migration manner. The 5 test cases fail to fully cover the edge pair set E p , the set of uncovered edge pairs E pu ={Ep6,Ep8,Ep11}.
[0161] Generate test cases for Ep6, Ep8, and Ep11 respectively, calculate the path set from (s2, s5) along the strictness reachable graph that can reach (s4, s6) and cover the edge pairs Ep6, Ep8, and Ep11, and generate 3 test cases in total. Each test case covers the following edge pairs: Fig.17 As shown, combined with the test cases covering the main path, there are a total of 8 test cases in this embodiment.
[0162] Calculate the priority of the test cases, sort the test cases from high to low according to their priority, and form a sorted test case set. In this embodiment, β = 0.95, and the priority of test cases Tc1-Tc8 is as follows: Fig.18 As shown, the test priorities from high to low are Tc6, Tc8, Tc1, Tc5, Tc4, Tc7, Tc2, and Tc3. According to the method proposed in the present invention, it is possible to ensure that the functional modules with high severity are tested first.
[0163] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method may be implemented in a computer program using standard programming techniques - including a non-transitory computer-readable storage medium configured with a 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 may be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if desired, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose.
[0164] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.
[0165] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various 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 a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes 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 solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A method for prioritizing test cases for a train autonomous operation system, characterized in that: The method comprises the following steps: Step S1: According to the business functions of the train autonomous operation system, analyze the system modeling requirements and extract the system state set S tacs , signal set G tacs and the transition relationship between states; Step S2: Analyze S tacs The impact degree after failure of each state in S tacs The severity level of each state in the Step S3: Combine the business functions and state set S of the train autonomous operation system tacs , signal set G tacs , the transition relationship between states and the severity level of each state, 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 of the train autonomous operation system and the severity level; Step S4: converting the train autonomous operation system test model M1 into a severity reachability graph model M2, the severity reachability graph is a four-tuple SRG=(D,I,L,R), where: D is a reachable identifier set, I is a finite input symbol set, L:D×I→D is a reachable identifier transfer function, R:D→N is a reachable identifier severity allocation function, mapping the pattern of the severity state machine to the reachable identifier of the severity reachability graph, and mapping the severity of the severity state machine pattern to the severity of the corresponding reachable identifier in the severity reachability graph; Step S5: Determine the test start reachability mark d0 and the end reachability mark d f ; 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 complete coverage main path set P p and the edge pair set E p The test case set Tc; Step S7: Identify the reachability identifiers contained in each test case and calculate the severity sequence of each test case; Step S8: Calculate the priority of the test case using exponentially weighted moving average according to the severity sequence of the test case; Step S9: Sort the test cases in descending order according to their priorities to form a sorted test case set.
2. A method for prioritizing test cases for a train autonomous operation system according to claim 1, characterized in that: 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 recorded as KIND, including the initial state (INIT) and the normal state (NORMAL). The and (and) relationship, or (or) relationship, and not (not) relationship between signals constitute the signal expression, recorded as G. E ; The constant that the signal always occurs is recorded 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 from a state to its direct child state, u defines the type of each state, w defines whether the state is the initial state, and v assigns a severity level to the state.
3. A method for prioritizing test cases for a train autonomous operation system according to claim 1 or 2, characterized in that: The step S4 specifically includes the following process: (1) Create an empty pattern set CQ, an empty reachable identifier set D, and an empty input symbol set I; (2) Extract the initial pattern, 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 there is cf in D i Corresponding reachability identifier D i , extract the reachable identifier D i , go to step (9); otherwise, go to step (7); (7) Create a pattern cf i Corresponding reachability identifier D i , D=D∪{D i }; (8) Calculate cf i The severity level r i , and R(D i )=r i ; (9) Get from cf i The set of all possible patterns to be reached is denoted as CF; (10) If CF≠EMPTY, go to step (11); otherwise, go to step (4); (11) Select the pattern cf from CF j , CQ=CQ∪{cf j }, and delete it from CF, CF=CF\{cf j }; (12) If cf j There is already a corresponding reachable identifier D in D j , get the reachable identifier D j , go to step (15); otherwise, go to step (13); (13) Create a pattern cf j Corresponding reachability identifier D j , D=D∪{D j }; (14) Calculate cf j The severity level r j , and R(D j )=r j ; (15) Get 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 severity reachability graph SRG = (D, I, L, R).
4. A method for prioritizing test cases for 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 number of migrations from d0 along the strictness reachable graph that can reach d f And completely cover the main path set P p The path set is recorded 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 test case of the train autonomous operation system Tc = Tcp; if Tcp does not completely cover the edge pair set E p , for E p The set of edge pairs E that have not yet been covered pu , calculate the migration from d0 along the severity reachable graph to reach d f And completely covers the edge pair set E pu The path set is recorded as the test case set Tce, and the train autonomous operation system test case Tc = Tcp∪Tce.
5. A method for prioritizing test cases for a train autonomous operation system according to claim 4, characterized in that: The step S6 specifically includes the following process: (1) Create an empty test case set TC; (2) Obtaining the main path set P p ; (3) If P p ≠EMPTY, go to step (4); otherwise, go to step (7); (4) From P p Select a main path p from P p Delete p, P p =P p \{p}; (5) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test case t covering the main path p; (6) Insert t into TC, TC = TC∪{t}, and go to the above step (3); (7) Get the edge pair set E p ; (8) If E p ≠EMPTY, go to step (9); otherwise, go to the following step (13); (9) From E p Choose an edge pair ep from E p Delete E p =E p \{ep}; (10) If there is at least one test case covering ep in TC, go to step (8); otherwise, go to step (11); (11) According to the starting reachable identifier d0 and the ending reachable identifier d f Generate test cases t that cover edge pairs ep; (12) Insert t into TC, TC = TC∪{t}, and go to step (8); (13) Output TC set.
6. A method for prioritizing test cases for a train autonomous operation system according to claim 1, characterized in that: In step S7, the severity sequence is an arrangement of the severity of all reachable identifiers contained in the test case from large to small. For the test case tc, its severity sequence is recorded as PS tc ;#PS tc Represents the sequence PS tc Length, PS tc (i) represents the severity sequence PS tc The severity value of the ith position.
7. A method for prioritizing test cases for a train autonomous operation system according to claim 1, characterized in that: In step S8, the priority of the test case is calculated as follows: tc , the priority of tc is denoted by A(tc), and Among them: β∈[0,1], β represents the weighting coefficient, y i Represents the severity sequence PS tc The priority at the ith 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, the method according to any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Test case prioritization method based on UML model
CN106502892A
SoftAPFD evaluation method for test case optimization
CN118069512A
Train autonomous operation control system test case generation method and device and storage medium
CN118394638A
Dynamic reprioritization of test cases during test execution
US20130159774A1
Test case optimization and prioritization
US20210303450A1