A method, device and storage medium for generating test cases for a train autonomous operation control system

Through the SCADE modeling tool and artificial fish swarm algorithm, comprehensive and efficient test cases are generated, which solves the problem of insufficient coverage of deep state and business processes in the test of autonomous train operation control system, and improves test efficiency and quality.

CN118394638BActive Publication Date: 2024-10-22CHENGDU UNIV OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410485342.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-22
Publication Date
2024-10-22
Estimated Expiration
2044-04-22

AI Technical Summary

Technical Problem

Existing testing methods for autonomous train operation control systems cannot effectively cover deep-level states and business processes, resulting in a large number of test cases, low testing efficiency, and difficulty in ensuring safety and reliability.

Method used

Use SCADE modeling tools for safety state machine modeling and data flow diagram modeling to generate formal test models. Combined with model-based testing theory and combined testing methods, specific test cases are generated through abstract test cases and combined test cases, using artificial The fish swarm algorithm optimizes testing costs.

Benefits of technology

It achieves comprehensive testing of the train's autonomous operation control system, especially in-depth testing of deep paths and business processes, reduces the number of test cases, improves testing efficiency and quality, and is suitable for complex safety-critical systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394638B_ABST
    Figure CN118394638B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating test cases for a train autonomous operation control system. The method combines a model-based test method, a variable-intensity combination test method and an artificial fish swarm algorithm, thereby achieving full coverage of the test requirements for the train autonomous operation control system, facilitating the discovery of test cases that are easily overlooked in the deep level of the system and in conventional processes, and ensuring the comprehensiveness and safety of the test scenario. The variable-intensity combination method can flexibly perform combination coverage according to the different safety requirements of modules or parameters in the train autonomous operation control system, greatly reducing the number of test cases. The artificial fish swarm algorithm performs multi-objective optimization on test cases, parameter combinations and overall test costs, thereby reducing test costs while ensuring comprehensive test coverage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of train autonomous operation control system testing, and in particular to a train autonomous operation control system test case generation method, device and storage medium. Background Art

[0002] The Train Autonomous Circumambulate System (TACS) is a new generation of train control system that realizes autonomous resource management and active interval protection based on operation plan and real-time position. It has the characteristics of high safety, high real-time and high precision. It is the train control technology that is currently being tackled by global rail transit. The Train Autonomous Circumambulate System can greatly improve the utilization rate of line resources and the control accuracy of the system, reduce project construction and operation costs by 20%~30%, and shorten the project construction and commissioning cycle by 20%~30%; at the same time, it makes the train operation organization more flexible and can greatly improve the line operation efficiency. The application of the Train Autonomous Circumambulate System will reduce the country's overall investment in urban rail transit infrastructure, improve the overall service quality of urban rail transit, help the high-quality development of China's urban rail transit, and provide strong guarantees for the "going out" of China's urban rail transit equipment. It has very important strategic significance for China's rail transit industry.

[0003] As a new train control system, the introduction of new technologies, new functions and new scenarios has deepened the difficulty of testing the correctness, safety and reliability of the train autonomous operation control system. At present, the safety and reliability testing of the train autonomous operation control system has become an important research content in the current urban rail transit field. The train autonomous operation control system has complex operation scenarios, numerous control parameters, rich information types, diverse interfaces, and a huge behavior space. It contains a large number of deep-level paths and interactive combinations, which brings many difficulties to the effective testing of the train autonomous operation control system. These deep-level paths and interactive combinations are often one of the important factors that induce system failure. The train autonomous operation control system is a typical safety-critical system. System defects may cause major safety accidents, resulting in serious property losses and even casualties. Therefore, before it is put into operation, it needs to undergo rigorous and comprehensive testing, and systematically and exhaustively test the system's possible deep-level, long-path states, complex operation scenarios, complex interactions, parameter combinations, and multi-parameter interactions to ensure that the system's safety and reliability meet the requirements.

[0004] At present, the test method of the train autonomous operation control system mainly adopts the test method of the rail transit train control system to test the functional logic and typical scenarios of the system. The test requirements of the interactive combination in the system usually adopt a fixed-strength combination test method, that is, the same combination coverage criteria are used for all the combinations of modules or control parameters in the system. Usually, in order to ensure the comprehensiveness of the combination between security modules or parameters, the combination strength is large, resulting in a large number of combination test cases, and the testing work faces huge pressure. If the combination strength is reduced, the combination coverage between security modules or parameters will be insufficient. For the deep-level states and business processes in the system, model-based testing methods are usually used to compile test cases, but they are mainly abstract test cases, and there is little research on the process of instantiating abstract test cases into specific test cases. Therefore, combining model-based testing theory and combination testing methods, comprehensive and efficient test cases are generated for the train autonomous operation control system, especially covering the deep-level states and business processes of the train autonomous operation control system, achieving variable-strength combination coverage between modules and parameters of different safety levels, reducing testing workload, improving test quality, and having certain significance for the safe and efficient testing of the train autonomous operation control system and reducing testing costs. Summary of the invention

[0005] In view of this, one of the purposes of the present invention is to provide a method for generating test cases for a train autonomous operation control system, which is safe, reliable, has high test efficiency, strong versatility and a wide range of applications.

[0006] One of the purposes of the present invention is achieved through the following technical solutions:

[0007] A method for generating test cases for a train autonomous operation control system, the method comprising the following steps:

[0008] Step S1: Formal modeling of the train autonomous operation control system: Use the SCADE modeling tool and the safety state machine modeling method to formally describe the requirements of the train autonomous operation control system and establish a formal model M of the train autonomous operation control system. 1;

[0009] Step S2: Based on the formalized model M1 of the train autonomous operation control system, mark each migration in M1, record the triggering action of each migration, and form the migration marking model M1 of the train autonomous operation control system 2;

[0010] Step S3: Use the data flow diagram modeling method of SCADE to model the triggering behavior of each migration in M2, describe the behavior of the migration that has been triggered or not triggered, and establish the migration behavior model M3 of the train autonomous operation control system. Model M2 and model M3 constitute the test model of the train autonomous operation control system, denoted as M, that is, M := M2|| M 3;

[0011] Step S4: For the test model M, obtain the start node and end node of the model, and use the model checking mechanism of SCADE to generate an abstract test case set. A(M) ,The abstract test case set covers all paths from the starting node to the ending node in M;

[0012] Step S5: Extract the instantiation values ​​of all input variables in M ​​to form an instantiation value set I(M);

[0013] Step S6: Determine the combination strength between each input variable in M: the coverage strength between different input variables is different, that is, a variable strength combination test method is adopted between input variables;

[0014] Step S7: Combination I(M) And the combination coverage requirements between each input variable, use the combination test tool to generate the combination coverage table between the input variables C(M);

[0015] Step S8: Extraction A(M) The input variables contained in each abstract test case in C (M) The coverage relationship between them is calculated, the number of executions of abstract test cases is calculated, the combination coverage table of all abstract test cases and input variables is completely covered, and the overall test cost in the calculation process is minimized;

[0016] Step S9: According to the number of executions of the abstract test case, the abstract test case and C(M) The coverage relationship between them is used to assign instantiation values ​​of input variables to each abstract test case to generate specific test cases.

[0017] Furthermore, after step S1, the method also includes the steps of simulating and formally verifying the model of the train autonomous operation control system, that is, the formal model M1 established in step S1 is simulated by using the model simulation mechanism of SCADE according to the modeling requirements of the train autonomous operation control system to check the correctness of the model. If the model is incorrect, the method returns to step S1 to correct the model. If the model is correct, the formal verification mechanism of SCADE is further used to verify the correctness of the model. If the model is incorrect, the method returns to step S1 to correct the model until the model is correct.

[0018] Furthermore, the step S2 specifically includes: marking all migrations in the formal model M1 of the train autonomous operation control system, adding a signal or output variable to each migration in M1, and when the migration is triggered, broadcasting the signal or updating the output variable value; adding an output variable to the terminal node of M1, recording whether the node is activated, and forming a migration marking model M2 of the train autonomous operation control system.

[0019] Further, the step S3 includes the following process.

[0020] Using the data flow diagram of SCADE, the migration behavior model M3 of the train autonomous operation control system is established. M3 adds an output variable for each migration in M2 to describe whether the migration is triggered; the default value of the output variable is false, the last value is false, and it is reset to true after the migration is triggered, indicating that the migration has been triggered; that is, after M3 receives the signal on the corresponding migration in M2, or detects the value of the corresponding output variable, or the last value of the output variable is true, the value of the output variable is true, otherwise it is false.

[0021] Further, the step S4 comprises:

[0022] The SCADE model checking mechanism is used to generate abstract test cases, which includes the following steps:

[0023] a) Generate an empty abstract test case suite T a;

[0024] b) Generate a verification file, the verification content is: T a In the path, M does not have a path from the starting node to the ending node;

[0025] c) Based on the output variable description in model M3 T a The path in the above example is to use SCADE to establish a formal verification model for the verification file;

[0026] d) Use SCADE’s model checking mechanism to check whether M satisfies the verification file. If M If the verification file is not satisfied, the path corresponding to the counterexample file generated by SCADE model detection is recorded as an abstract test case. t , added to T a In , go to step b); otherwise, the algorithm ends and outputs the abstract test case set T a;

[0027] Furthermore, in step S8, the following constraints are specifically met: a) for any abstract test case, there is at least one corresponding specific test case; b) the specific test case covers the combination test requirements between input variables, that is, covers C(M) in all situations.

[0028] Furthermore, in step S8, an artificial fish swarm algorithm is used to calculate the execution times of the abstract test case, and the goal of the artificial fish swarm algorithm is:

[0029] ;

[0030] Where: n is the number of abstract test cases; m for C(M) The number of input variable combinations; For abstract test cases Testing costs; For abstract test cases The actual number of executions; For abstract test cases For j The combination of input variables covers the requirements; For abstract test cases For j The actual number of executions for each combination of input variables.

[0031] Under the constraint of test cost, the artificial fish swarm algorithm searches according to the input variables and combination coverage tables contained in the abstract test cases. t The fitness function value at the iteration is:

[0032] ;

[0033] No. t The optimal fitness function value of all individuals in the iteration process is defined as follows:

[0034] ;

[0035] Further, in step S8, calculating the number of abstract test case executions includes the following specific steps:

[0036] a) Initialization settings, including population size size_pop , the maximum displacement of each step step , crowding threshold δ , the maximum sensing range of artificial fish visual , the perception range attenuation coefficient of the artificial fish q , maximum number of iterations max_iter , maximum number of prey attempts max_try_num;

[0037] b) Initialize the number of iterations and generate them randomly within the feasible domain size_pop artificial fish individuals to form an initial fish school;

[0038] c) Calculate the food concentration value of the current state of each artificial fish in the initial fish school, and assign the optimal artificial fish state and its value to the bulletin board;

[0039] d) Each artificial fish simulates the flocking behavior and the tail-chasing behavior respectively, and selects the behavior with the best food concentration value after the action to execute. The default behavior is the foraging behavior;

[0040] e) After each artificial fish performs an action, it compares its own food concentration value with the food concentration value on the bulletin board. If it is better than the one on the bulletin board, the current best food concentration value is assigned to the bulletin board;

[0041] f) If the number of iterations is less than the preset maximum number of iterations max_iter , then go to step d); otherwise, terminate the iteration and output the food concentration value on the bulletin board.

[0042] 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.

[0043] 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.

[0044] The beneficial effects of the present invention are:

[0045] (1) The train autonomous operation control system test case generation method provided by the present invention combines the model-based test theory and the combinatorial test theory, covering the entire process from test model, abstract test case generation to specific test case generation. By establishing a SCADE formal test model and model detection method, it is possible to completely traverse the path of the train autonomous operation control system, especially the deep-level path, and conduct in-depth testing on the operating status and business process of the train autonomous operation control system, thereby improving the comprehensiveness of the train autonomous operation control system test cases and the ability to find errors;

[0046] (2) The present invention combines different modules and parameters in the train autonomous operation control system through combined testing, thereby improving the comprehensiveness of the test scenarios of the train autonomous operation control system, especially the abnormal scenarios obtained by combination, and the scenarios that are rare but affect safety in routine operations or business, and supplement the test cases in the train autonomous operation control system that are difficult to find, have a low probability, but have serious consequences;

[0047] (3) The present invention adopts a variable strength combination test method, which can reduce the number of test cases while ensuring that the necessary safety requirement combinations of the train autonomous operation control system are covered, avoiding problems such as test case explosion in traditional fixed combination strength test methods. The method provided by the present invention can flexibly carry out targeted and different strength combinations of modules or parameters with different safety requirements according to the actual situation of the test project. In the complex test scenario of the train autonomous operation control system, according to the specific characteristics of the test project, high-security modules or parameters can be combined with high strength, and low-security or no-security modules can be combined with low strength or not combined, taking into account both the safety test requirements and test efficiency of the train autonomous operation control system;

[0048] (4) The method provided by the present invention has a better test case simplification effect when the coverage dimension is large and the parameters are large, which can save more test costs and significantly improve the comprehensiveness and efficiency of the test. It is suitable for testing large-scale, complex, and safety-critical systems.

[0049] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and in 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

[0050] 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:

[0051] Figure 1 It is a schematic diagram of the process of the present invention;

[0052] Figure 2 The figure is a schematic diagram of the formal modeling process of the SCADE safety state machine of the present invention;

[0053] Figure 3 Generate a flow chart for the abstract test case of the present invention;

[0054] Figure 4 A schematic diagram for generating a combined test coverage table of the present invention;

[0055] Figure 5 A schematic diagram of the process flow of searching the execution times of abstract test cases by the artificial fish swarm algorithm of the present invention;

[0056] Figure 6 This is a schematic diagram of a SCADE safety state machine M1 according to Embodiment 1;

[0057] Figure 7It is a schematic diagram of the SCADE migration markup model M2 of Example 1;

[0058] Figure 8 Schematic diagram of SCADE migration behavior model M3 of Example 1;

[0059] Fig. 9 It is a schematic diagram of the verification model of the first SCADE model detection in Example 1;

[0060] Fig.10 This is a schematic diagram of the SCADE counterexample file of Example 1;

[0061] Fig.11 It is a schematic diagram of the verification model of the second SCADE model detection in Example 1;

[0062] Fig.12 It is a schematic diagram of the final verification model of the SCADE model detection in Example 1;

[0063] Fig.13 This is a schematic diagram of test cost of an abstract test case in Example 1;

[0064] Fig.14 A schematic diagram of input variable combinations covered by the abstract test cases in Example 1;

[0065] Fig.15 This is a schematic diagram of the foraging behavior process of the artificial fish school algorithm in Example 1;

[0066] Fig.16 This is a schematic diagram of the clustering behavior process of the artificial fish swarm algorithm in Example 1;

[0067] Fig.17 This is a schematic diagram of the process flow of the artificial fish school algorithm tail-end chasing behavior in Example 1;

[0068] Fig.18 This is a schematic diagram of instantiating values ​​for an abstract test case in Example 1;

[0069] Fig.19 A schematic diagram of input variable combinations covered by the abstract test cases of Example 2;

[0070] Fig. 20 This is a schematic diagram of the instantiation of values ​​for the abstract test case of Example 2. DETAILED DESCRIPTION

[0071] 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.

[0072] Embodiment 1

[0073] This embodiment specifically includes the following steps:

[0074] Step S1: Formal modeling of the train autonomous operation control system: According to the requirements, technical conditions and domain knowledge of the train autonomous operation control system, the SCADE modeling tool is used to formally describe the requirements of the train autonomous operation control system using the safety state machine modeling method, and a formal model M1 of the train autonomous operation control system is established. The example model of the SCADE safety state machine of the train autonomous operation control system of the embodiment of the present invention is as follows: Figure 6 The example model of the safety state machine includes 7 states from State1 to State7, of which State1 is the initial state. a - j There are 10 bool input variables in total. The safety state machine example model triggers the state transition based on the true or false value of the input variable and the size of the migration priority. For example, the migration priority of the transition from State3 to State4 is 1, and the migration priority of the transition from State3 to State5 is 2. When State3 is activated, the input variable d When the value is true, transfer to State5; input variable c When the value is true, it moves to State4.

[0075] In this embodiment, the formal model M1 established in step S1 is simulated by using the model simulation mechanism of SCADE according to the modeling requirements of the train autonomous operation control system to check the correctness of the model and meet the simulation requirements. The formal verification mechanism of SCADE is further used to verify the correctness of the model, and the model is correct and meets the formal verification requirements.

[0076] Step S2: Based on the formal model M1 of the train autonomous operation control system, mark each transition in M1 and record the triggering action of each transition; mark all transitions in the formal model M1 of the train autonomous operation control system and record the triggering action of each transition; Each migration in M1 adds a signal, and when the migration is triggered, the signal is broadcast; a bool output variable EndState is added to the terminal node State7 of M1. When state State7 is activated, the value of EndState is true, forming the migration marking model M2 of the train autonomous operation control system, such as Figure 7 As shown, there are 10 signals including T1 - T10, which respectively represent the signals broadcast when migration 1 - migration 10 are triggered.

[0077] Step S3: Use the data flow diagram modeling method of SCADE to model the triggering behavior of each migration in M2, describe the behavior of the migration that has been triggered or not, and establish the migration behavior model M3 of the train autonomous operation control system. M3 adds an output variable to each migration in M2 to describe whether the migration is triggered; the Default value of the output variable is false, the last value is false, and it is reset to true after the migration is triggered, indicating that the migration has been triggered; that is, after M3 receives the signal on the corresponding migration in M2, or detects the value of the corresponding output variable, or the last value of the output variable is true, the value of the output variable is true, otherwise it is false. The M3 model of this embodiment is as follows Figure 8 As shown, there are 10 output variables Tran1 - Tran10, which represent the triggering behaviors of migration 1 - migration 10. Model M2 and model M3 form the test model of the train autonomous operation control system of this embodiment, which is denoted by M.

[0078] Step S4: For the test model M, obtain the start node and end node of the model, and use the model checking mechanism of SCADE to generate an abstract test case set. A(M) ,The abstract test case set covers all paths from the starting node to the ending node in M, including the following steps;

[0079] a) The model starts at State1 and ends at State7.

[0080] b) Generate an empty abstract test case suite T a .

[0081] c) Generate a verification file, the verification content is: T a There is no path from the start node to the end node in M.

[0082] d) Description of output variables based on model M3 T a According to the path in , SCADE is used to establish the formal verification model of the verification file. T a is an empty set, and the verification model is as follows Fig. 9 As shown, the HasNeverBeenTrue operator in the libverif library is used. In the verification model diagram, the operator M represents the test model M of the train autonomous operation control system.

[0083] e) Use SCADE’s model checking mechanism to check whether M satisfies the verification document. If the verification file is not satisfied, the counterexample file generated by SCADE model detection is as follows Fig.10In the figure, the value of the input variable is t, which means the value of the input variable is true, and the value of the input variable is f, which means the value of the input variable is false.

[0084] f) Extract the path corresponding to the counterexample file and record it as an abstract test case t 1:

[0085] t 1 = (State1, State2, State3, State5, State7);

[0086] g) Abstract test cases t 1 Add to T a In, that is T a = {(State1, State2, State3, State5,State7)}.

[0087] h) Go to step c). Generate a verification file, the verification content is: T a The path in M There is no path from the start node to the end node. The SCADE verification model is in the form of Fig.11 shown.

[0088] i) Use SCADE’s model checking mechanism to check whether M satisfies the verification document. The path corresponding to the counterexample file generated by SCADE model detection that does not meet the verification file is recorded as an abstract test case t 2,

[0089] t 2 = (State1, State2, State3, State4, State5, State6, State7);

[0090] j) Add to T a In, that is T a = {(State1, State2, State3, State5, State7),(State1, State2, State3, State4, State5, State6, State7)};

[0091] k) Go to step c). Until the algorithm ends, output the abstract test case set T aThe final SCADE verification model is as follows: Fig.12 shown.

[0092] T a = {(State1, State2, State3, State5, State7), (State1, State2,State3, State4, State5, State6, State7), (State1, State2, State3, State4,State5, State7), (State1, State2, State3, State4, State6, State7), (State1,State2, State3, State4, State7), (State1, State2, State3, State5, State6,State7)}.

[0093] Determine the test cost of each abstract test case based on historical data, tester experience, etc. Test cost can be test time, test resources, or test investment, etc. The test cost of abstract test cases 1-6 is as follows: Fig.13 shown.

[0094] Step S5: Extract the instantiation values ​​of all input variables in M ​​to form an instantiation value set I(M) In this embodiment, the variable a , b , c. d. The number of instantiated values ​​is 3, 2, 2, and 2 respectively, and the number of instantiated values ​​of the remaining variables is 1. a , b , c. d. The instantiation values ​​are:

[0095] .

[0096] Step S6: Determine the combination strength between the various input variables in M, mainly based on specific conditions such as test resources, historical experience, project characteristics or key parameters.

[0097] It should be emphasized that in the scheme adopted by the present invention, the coverage strengths between different input variables are different, that is, a variable strength combination test method is adopted between input variables. According to actual test requirements, a combination test with a higher strength (strength greater than 2) can be adopted between important input variables such as security, and a combination test with a strength of 2 can be adopted between unimportant input variables, or even no combination test can be performed. In this embodiment, a ,b , c 3 input variables are combined for coverage, b , d The two input variables are combined for coverage, and the coverage strength is 2. There is no need for other combination coverage.

[0098] Step S7, combining I(M) The combination coverage requirements between the input variables are calculated by using the combination test tool PICT to generate the combination coverage table C between the input variables. (M) , the result is as follows:

[0099] ;

[0100] Step S8: Extraction A(M) Each abstract test case in contains input variables, such as Fig.14 As shown, according to the abstract test case and C(M) The artificial fish swarm algorithm is used to calculate the execution times of abstract test cases, completely covering the combination coverage table of all abstract test cases and input variables, and making the overall test cost in the calculation process the lowest. Specifically, the following constraints are met: a) For any abstract test case, there is at least one corresponding specific test case; b) The specific test case covers the combination test requirements between input variables, that is, coverage C(M) in all situations.

[0101] In this embodiment, the artificial fish swarm algorithm goal is:

[0102] .

[0103] Where: n is the number of abstract test cases; m for C(M) The number of input variable combinations; For abstract test cases Testing costs; For abstract test cases The actual number of executions; For abstract test cases For j The combination of input variables covers the requirements; For abstract test cases For j The actual number of executions for each combination of input variables.

[0104] Under the constraint of test cost, the artificial fish swarm algorithm searches according to the input variables and combination coverage tables contained in the abstract test cases. t The fitness function value at the iteration is:

[0105] .

[0106] No. t The optimal fitness function value of all individuals in the iteration process is defined as follows:

[0107] ;

[0108] Combined with the artificial fish swarm algorithm, the specific steps of calculating the execution times of abstract test cases are as follows:

[0109] a) Initialization settings, the state of each artificial fish can be represented by a vector X = ( x 1, x 2, x 3, x 4, x 5, x 6), the food concentration Y at the location of each artificial fish = f (X), where Y is the objective function value; initialization parameters, initial population size size_ pop = 50, maximum displacement per step step = 1.5, crowding threshold δ = 12, the maximum perception range of fish visual = 15, fish perception range attenuation coefficient q = 1, maximum number of iterations max_iter = 300, maximum number of prey attempts max_try_ num = 100, and artificial fish individuals i and j The distance between d i,j =|| X i - X j ||.

[0110] b) Initialize the number of iterations and generate them randomly within the feasible domain size_pop Artificial fish individuals are generated to form an initial fish school. The state of the artificial fish is mapped to abstract test cases 1-6, 50 positions are randomly generated, and the fitness value of each position is calculated. The fitness value is the sum of the number of abstract test case executions and the corresponding test cost. The number of abstract test case executions with the minimum test cost is taken as the current optimal solution.

[0111] c) Calculate the food concentration value of the current state of each artificial fish in the fish school, and assign the optimal artificial fish state and its food concentration value to the bulletin board.

[0112] d) Each artificial fish simulates the flocking behavior and the tail-chasing behavior respectively, and selects the behavior with the best food concentration value after the action to execute. The default behavior is the foraging behavior, which is described in detail as follows;

[0113] 1) Foraging behavior

[0114] The current state of artificial fish is X i , randomly select a state within its perception range X j ,calculate X i , X j The food concentration values ​​are compared. Y j Compare Y i Excellent, then X i Towards X j Move one step in the direction of . Otherwise, X i Re-select a state randomly within its perception range X j , determine whether the conditions for moving forward are met. Try again and again max_try_num After that, if the forward condition is still not met, it will move one step randomly. The algorithm flow is as follows Fig.15 shown.

[0115] 2) Group behavior

[0116] The current state of artificial fish is X i , search within the current neighborhood Number of partners n f and central location X c , if , indicates that the state of the optimal partner center has a higher food concentration and is not too crowded, then X i Move one step towards the partner. Otherwise, perform foraging behavior. The algorithm flow is as follows Fig.16 shown.

[0117] 3) Rear-end collision

[0118] The current state of artificial fish is X i , search within the current neighborhood Functions in partners Y j Best Partner X j , if, indicates the best partner Xj The state has a higher food concentration and is not too crowded. X i Move one step towards the partner. Otherwise, perform foraging behavior. The algorithm flow is as follows Fig.17 shown.

[0119] 4) Random Behavior

[0120] The artificial fish random behavior is a default behavior of foraging behavior. It randomly selects a state within the perception range and moves one step to this state. Step .

[0121] e) After each artificial fish performs an action, it compares its own food concentration value with the food concentration value on the bulletin board. If it is better than the one on the bulletin board, the current best food concentration value is assigned to the bulletin board.

[0122] f) Improve the artificial fish swarm algorithm and add a "last place elimination" mechanism. After each iteration of the algorithm, the artificial fish with the worst food concentration value is eliminated, that is, the artificial fish with the worst food concentration value is reinitialized to the solution space.

[0123] g) If the number of iterations is less than the preset maximum number of iterations max_iter , then go to step d); otherwise, terminate the iteration and output the food concentration value on the bulletin board.

[0124] The artificial fish in the population make behavioral selections through foraging, clustering, chasing, and randomization until the maximum number of iterations is reached, and finally the optimal position is {1, 3, 1, 1, 1, 3}, and the food concentration value is 1112, indicating that the execution times of abstract test cases 1 - abstract test cases 6 are 1, 3, 1, 1, 1, 3 respectively, and the test cost is 1112.

[0125] Step S9: According to the number of executions of the abstract test case, the abstract test case and C(M) The coverage relationship between them is used to assign instantiation values ​​of input variables to each abstract test case, and generate specific test cases, such as Fig.18 shown.

[0126] Embodiment 2

[0127] The difference between this embodiment and the first embodiment is that the input variable a , b , c , j The number of instantiation values ​​is 2, and the number of instantiation values ​​of the remaining input variables is 1. a , b , j There is a combined coverage requirement with a combined strength of 3, b ,c There is a combined coverage requirement with a combined strength of 2, a , b , j and b , c The combined strengths are different, and a , c and c , j There is no combination coverage requirement, that is, no testing is required a , c and c , j Combination coverage. a , b , c , j The instantiation values ​​are:

[0128] .

[0129] Generate combination coverage set table using combination test tool C(M) , the results are as follows:

[0130] ;

[0131] .

[0132] Extract the input variables contained in each abstract test case, such as Fig.19 As shown in the figure, the artificial fish swarm algorithm is used to calculate the execution times of the abstract test cases. The artificial fish in the population conduct behavior selection by foraging, grouping, chasing, and randomization until the maximum number of iterations is reached. Finally, the optimal position is {1, 1, 1, 1, 6, 1}, and the food concentration value is 1267, which means that the execution times of abstract test cases 1 to abstract test cases 6 are 1, 1, 1, 1, 6, and 1 respectively, and the overall test cost is 1267.

[0133] According to the number of executions of abstract test cases, abstract test cases and C(M) The coverage relationship between them is used to assign instantiation values ​​of input variables to each abstract test case, and generate specific test cases, such as Fig. 20 shown.

[0134] 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.

[0135] 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.

[0136] 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.

[0137] 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 generating test cases for a train autonomous operation control system, characterized in that: The method comprises the following steps: Step S1: Formal modeling of the train autonomous operation control system: Use the SCADE modeling tool and the safety state machine modeling method to formally describe the requirements of the train autonomous operation control system and establish a formal model M1 of the train autonomous operation control system; Step S2: Based on the formalized model M1 of the train autonomous operation control system, mark each migration in M1, record the triggering action of each migration, and form the migration marking model M2 of the train autonomous operation control system; Step S3: Use the data flow diagram modeling method of SCADE to model the triggering behavior of each migration in M2, describe the behavior of the migration that has been triggered or not triggered, and establish the migration behavior model M3 of the train autonomous operation control system. Model M2 and model M3 constitute the test model of the train autonomous operation control system, denoted as M, that is, M := M2 || M3; Step S4: For the test model M, obtain the start node and the end node of the model, and use the model detection mechanism of SCADE to generate an abstract test case set A(M), which covers all paths from the start node to the end node in M; Step S5: extracting instantiated values ​​of all input variables in M ​​to form an instantiated value set (M); Step S6: Determine the combination strength between each input variable in M: the coverage strength between different input variables is different, that is, a variable strength combination test method is adopted between input variables; Step S7: Combining I(M) with the combination coverage requirements between various input variables, using a combination test tool to generate a combination coverage table C(M) between input variables; Step S8: extract the input variables contained in each abstract test case in A(M), calculate the execution times of the abstract test case according to the coverage relationship between the abstract test case and C(M), completely cover the combination coverage table of all abstract test cases and input variables, and make the overall test cost in the calculation process the lowest; in the step S8, the artificial fish swarm algorithm is used to calculate the execution times of the abstract test case, and the goal of the artificial fish swarm algorithm is: ; Where: n is the number of abstract test cases; m is the number of input variable combinations of C(M); For abstract test cases Testing costs; For abstract test cases The actual number of executions; For abstract test cases For j The combination of input variables covers the requirements; For abstract test cases For j The actual number of executions for each combination of input variables; Artificial fish swarm algorithm in testing cost Under the constraints of , the search is performed based on the input variables and combination coverage tables contained in the abstract test cases. t The fitness function value at the iteration is: ; No. t The optimal fitness function value of all individuals in the iteration process is defined as follows: ; In step S8, calculating the number of abstract test case executions includes the following specific steps: a) Initialization settings, including population size size_pop , the maximum displacement of each step step , crowding threshold δ , the maximum sensing range of artificial fish visual , the perception range attenuation coefficient of the artificial fish q , maximum number of iterations max_iter , maximum number of prey attempts max_try_num ; b) Initialize the number of iterations and generate them randomly within the feasible domain size_pop artificial fish individuals to form an initial fish school; c) Calculate the food concentration value of the current state of each artificial fish in the initial fish school, and assign the optimal artificial fish state and its value to the bulletin board; d) Each artificial fish simulates the flocking behavior and the tail-chasing behavior respectively, and selects the behavior with the best food concentration value after the action to execute. The default behavior is the foraging behavior; e) After each artificial fish performs an action, it compares its own food concentration value with the food concentration value on the bulletin board. If it is better than the one on the bulletin board, the current best food concentration value is assigned to the bulletin board; f) If the number of iterations is less than the preset maximum number of iterations max_iter , then go to step d); otherwise, terminate the iteration and output the food concentration value on the bulletin board; Step S9: According to the number of executions of the abstract test case and the coverage relationship between the abstract test case and C(M), an instantiation value of the input variable is assigned to each abstract test case to generate a specific test case.

2. A method for generating test cases for a train autonomous operation control system according to claim 1, characterized in that: After step S1, the method further includes the steps of simulating and formally verifying the model of the train autonomous operation control system, that is, the formal model M1 established in step S1 is simulated by using the model simulation mechanism of SCADE according to the modeling requirements of the train autonomous operation control system to check the correctness of the model. If the model is incorrect, the method returns to step S1 to correct the model. If the model is correct, the formal verification mechanism of SCADE is further used to verify the correctness of the model. If the model is incorrect, the method returns to step S1 to correct the model until the model is correct.

3. The method for generating test cases for a train autonomous operation control system according to claim 1, characterized in that: The step S2 specifically includes: marking all migrations in the formal model M1 of the train autonomous operation control system, adding a signal or output variable to each migration in M1, and when the migration is triggered, broadcasting the signal or updating the output variable value; adding an output variable to the terminal node of M1, recording whether the node is activated, and forming a migration marking model M2 of the train autonomous operation control system.

4. The method for generating test cases for a train autonomous operation control system according to claim 1, characterized in that: Step S3 The process includes: Using the data flow diagram of SCADE, the migration behavior model M3 of the train autonomous operation control system is established. M3 adds an output variable for each migration in M2 to describe whether the migration is triggered; the default value of the output variable is false, the last value is false, and it is reset to true after the migration is triggered, indicating that the migration has been triggered; that is, after M3 receives the signal on the corresponding migration in M2, or detects the value of the corresponding output variable, or the last value of the output variable is true, the value of the output variable is true, otherwise it is false.

5. The method for generating test cases for a train autonomous operation control system according to claim 1, characterized in that: The step S4 comprises: The SCADE model checking mechanism is used to generate abstract test cases, which includes the following steps: a) Generate an empty abstract test case set T a ; b) Generate a verification file, the verification content is: except T a In the path, M does not have a path from the starting node to the ending node; c) Based on the output variable description T in model M3 a The path in the above example is to use SCADE to establish a formal verification model for the verification file; d) Use SCADE's model checking mechanism to check whether M satisfies the verification file. If M does not satisfy the verification file, record the path corresponding to the counterexample file generated by SCADE model checking as an abstract test case. t , added to T a In , go to step b); otherwise, the algorithm ends and outputs the abstract test case set T a .

6. A method for generating test cases for a train autonomous operation control system according to claim 1, characterized in that: In step S8, the following constraints are specifically met: a) for any abstract test case, there is at least one corresponding specific test case; b) the specific test case covers the combination test requirements between input variables, that is, covers all situations in C(M).

7. 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 6 is implemented.

8. 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 6 is implemented.