Automatic script generation RBC-PDT test method, system, device and medium
Through the automatic script generation method, hierarchical modeling and script template nesting technology are used to solve the time and complexity problems of manual configuration and script writing in RBC product data testing, achieve unified format script generation and efficient testing process, and improve Improve testing efficiency and ease of use.
Patent Information
- Application Number
- CN202410570341.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-08-23
AI Technical Summary
Existing RBC product data testing requires manual configuration of line information and writing test scripts, which is time-consuming and contains grammatical errors. The test script format is not uniform, and testers need to master specific languages, which affects test efficiency and quality.
By determining the test requirements, obtain the passenger line data, model and process it into an intermediate data model according to the hierarchy, use script templates to nest and generate test scripts, and run them in the automatic test environment to check the results, and use Python language to build an automatic test environment. Simplify script generation and running process.
It realizes automatic script generation for all test requirements, reduces the work of testers, generates scripts in a unified format, facilitates archiving and review, and improves testing efficiency and ease of use.
Smart Images

Figure CN118534874A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of script testing, and in particular relates to an RBC-PDT testing method, system, device and medium for automatic script generation. Background Art
[0002] The C3 train control system is a train control system with C2-level functions, which realizes two-way transmission of train-ground information based on GSM-R wireless communication, generates driving permits through RBC (Radio Blocking Center), realizes train occupancy check through track circuits, and realizes train positioning through transponders. Among them, RBC, as the ground core equipment of the C3 train control system, generates driving permits based on the information provided by ground equipment and train control onboard equipment to ensure the safe operation of trains within its jurisdiction.
[0003] Different passenger dedicated lines have different line data. To ensure that RBC can run correctly when applied to different passenger dedicated lines, it is necessary to perform a PDT (Product Data Test) test to verify the correctness of the data configuration. The RBC PDT test is divided into the following steps:
[0004] (1) Test issuance: Issue test tasks and obtain passenger dedicated line data;
[0005] (2) Test design: formulate test process according to test requirements;
[0006] (3) Test preparation, generate test scripts, and configure the automatic test environment;
[0007] (4) Test implementation: run the test script in the automated testing environment and verify the test results.
[0008] In the PDT test of RBC, the test script simulates the running process of the train and compares the expected correct result with the result actually sent by RBC through Tcl's expect. When the expected result is consistent with the actual result, the data configuration of RBC is correct, otherwise the data configuration of RBC is wrong. In this way, the correctness of the data configuration is verified.
[0009] At present, RBC's product data testing is carried out by using tools to generate + manually write test scripts, and then automatically running the test scripts in the test environment. This method has the following problems:
[0010] 1. The tool-generated script requires manual configuration of line information, and the tool is not suitable for all test requirements;
[0011] 2. Manual script writing takes a lot of time and may lead to grammatical errors and other problems;
[0012] 3. The test script format is not unified, which is not conducive to test script archiving and review;
[0013] 4. Testers need to master the language used in test scripts. Summary of the invention
[0014] The purpose of the present invention is to provide an RBC-PDT test method, system, device and medium for automatic script generation in order to solve the above problems.
[0015] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0016] An RBC-PDT test method with automatic script generation comprises the following steps:
[0017] Determine test requirements and obtain passenger-dedicated line data;
[0018] Modeling is performed in order according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and the passenger dedicated line data is processed into an intermediate data model suitable for script generation;
[0019] Use the intermediate data model to calculate and fill in script templates at each level, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement;
[0020] The test script is run through the automatic test environment, and the test result output by the automatic test environment is checked.
[0021] As a further optimization solution of the present invention, the passenger dedicated line data includes a line data table, a line slope table, a line speed table and a ground equipment number information table;
[0022] The underlying model includes a line model, a station model, an RBC model and a TSRS model;
[0023] The intermediate data model includes an intermediate route data model, an intermediate station data model, an intermediate line data model and an intermediate RBC data model.
[0024] As a further optimization scheme of the present invention, the intermediate route data model includes the route's signal machine, transponder, interlocking, and MA information, which can be directly used for test script generation.
[0025] As a further optimization scheme of the present invention, the intermediate data model is used to calculate and fill in the script templates of each level, the lower-level script template is nested into the upper-level script template, and the test scripts for each test requirement are generated, including:
[0026] Pre-designing a script template of a test script applicable to all test requirements, using the intermediate data model to calculate and fill in the script templates of each level in sequence, and generating a test script by inserting the lower-level script template into the upper-level script template;
[0027] The script templates at each level include a root template, a sub-template and a leaf template.
[0028] As a further optimization scheme of the present invention, the root template is a top-level general script template, which is suitable for generating test scripts for various test requirements, including line script templates and temporary speed limit script templates.
[0029] The sub-template is a script template of the middle layer, which needs to be inserted into other leaf templates and then into the root template;
[0030] The leaf template is the lowest-level script template, corresponding to a specific action or specific expectation in the test script. The leaf template can be inserted into the child template or the root template.
[0031] As a further optimization solution of the present invention, the specific action includes setting a train action and requesting a shunting action; the specific expectation includes checking a P15 information package expectation and checking a P21 information package expectation.
[0032] As a further optimization solution of the present invention, running the test script through an automatic test environment and checking the test results output by the automatic test environment include:
[0033] Building an automatic testing environment based on Python language, the automatic testing environment includes a script controller, a main engine kernel and a sub-engine;
[0034] The script controller is responsible for running the test script and sending commands to the main engine kernel;
[0035] The main engine kernel transmits operation instructions to the sub-engine according to the command, simulates the train running in the train control system, and transmits the information sent by the RBC to the sub-engine to the script controller; the script controller compares the expected result with the actual result sent by the RBC, and outputs log information and execution results according to the comparison result;
[0036] After all the test scripts have been executed, the log information and the execution results are checked and counted to complete the RBC-PDT test.
[0037] An RBC-PDT test system with automatic script generation, comprising:
[0038] Data acquisition module, used to determine test requirements and obtain passenger dedicated line data;
[0039] A model building module, used to build models in order according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and process the passenger dedicated line data into an intermediate data model suitable for script generation;
[0040] A script generation module, used to calculate and fill in script templates of each level using the intermediate data model, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement;
[0041] The test module is used to run the test script through the automatic test environment and check the test results output by the automatic test environment.
[0042] An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0043] Memory, for storing computer programs;
[0044] The processor is used to implement the RBC-PDT test method of automatic script generation when executing the program stored in the memory.
[0045] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements an RBC-PDT test method for automatic script generation.
[0046] The beneficial effects of the present invention are:
[0047] 1. The present invention realizes an automatic script generation method applicable to all test requirements of RBC-PDT test, without the need for testers to configure line information or manually write test scripts. It can directly read passenger dedicated line data and generate test scripts, thus reducing the work of testers in the test preparation stage;
[0048] 2. The present invention can generate test scripts with a unified format, which is convenient for archiving the test scripts after a round of testing is completed and for subsequent review of the test scripts;
[0049] 3. The present invention generates test scripts based on Python language, which has simple syntax, strong readability, and is easy for testers to quickly master. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a distribution flow chart of the present invention;
[0051] Figure 2 is a structural diagram of hierarchical modeling in an embodiment of the present invention;
[0052] Figure 3 is a nested relationship diagram of script templates at each level in an embodiment of the present invention;
[0053] Figure 4 is a system structure block diagram in an embodiment of the present invention;
[0054] Figure 5 It is a block diagram of the device structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The present application is further described in detail below in conjunction with the accompanying drawings. It is necessary to point out here that the following specific implementation methods are only used to further illustrate the present application and cannot be understood as limiting the scope of protection of the present application. Technical personnel in this field can make some non-essential improvements and adjustments to the present application based on the above application content.
[0056] like Figure 1 As shown, an RBC-PDT test method generated by an automatic script comprises the following steps:
[0057] Determine test requirements and obtain passenger-dedicated line data;
[0058] Modeling is performed in order according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and the passenger dedicated line data is processed into an intermediate data model suitable for script generation;
[0059] Use the intermediate data model to calculate and fill in script templates at each level, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement;
[0060] The test script is run through the automatic test environment, and the test result output by the automatic test environment is checked.
[0061] In this embodiment, the method uses a tool to generate instead of manual writing, which is applicable to all test requirements, automatically generates the test script of the RBC-PDT test, and runs and verifies the test results through an automatic test environment to ensure that the RBC-PDT test is carried out efficiently and in a standardized manner. The specific description of the method is as follows:
[0062] Processing passenger dedicated line data based on hierarchical modeling:
[0063] The model is built in the order of passenger line data, bottom-level model, and intermediate data model, and the passenger line data in the file system is processed into an intermediate data model suitable for script generation. The structure of the hierarchical model is as follows: Figure 2 shown.
[0064] The passenger dedicated line data is the engineering data of the passenger dedicated line obtained from the outside by the test personnel during the test issuance stage, including line data tables, line slope tables and other train control engineering data tables and interface files such as ground equipment number information tables. The line information in the passenger dedicated line data is relatively scattered and cannot be directly used for test script generation.
[0065] The underlying model is a model built based on the structure of the train control system and the passenger dedicated line, including the line model, station model, RBC model and TSRS model. The underlying model parses the passenger dedicated line data stored in the file system in a hierarchical structure, extracts the line information and stores it in each model by category, thereby building an aggregated data model. Since the parameters in the test script need to be calculated through the data of RBC, station, and line, the calculation process is relatively complicated, so the underlying model is not suitable for test script generation.
[0066] The intermediate data model is artificially defined and is obtained by further modeling based on the underlying model. It serves the generation of test scripts, including the intermediate route data model, the intermediate station data model, the intermediate line data model and the intermediate RBC data model. Among them, the intermediate route data model is an intermediate data model constructed with routes and block sections as units after the line data is divided into routes and block sections. The intermediate route data model contains information such as the route's signal, transponder, interlocking, MA (Movement Authority, driving permit), etc., and can be directly used for test script generation. The other three models build a hierarchical structure based on the intermediate route data model to adapt to the generation of test scripts for various test requirements, including the hierarchical structure of the intermediate RBC data model-intermediate station data model-intermediate route data model in the station and the intermediate RBC data model-intermediate line data model-mainline intermediate route data model.
[0067] Generate a test script by filling in the nested script template:
[0068] Pre-design a script template for test scripts that are applicable to all test requirements, and generate test scripts by filling in the script templates of each level in turn and inserting the lower script template into the upper script template. The nested relationship of the script templates at each level is as follows: Figure 3 As shown;
[0069] The root template is the top-level general script template, which can be used to generate test scripts for various test requirements, including line script templates, temporary speed limit script templates, etc.
[0070] Sub-templates are script templates at the middle layer, which need to be inserted into other leaf templates and then into the root template. Sub-templates include general script templates such as MA expectation check, and non-general script templates corresponding to various test requirements such as route setting.
[0071] The leaf template is the lowest level script template, corresponding to an action or expectation in the test script, such as setting train action, requesting shunting action, checking P15 information package expectation, checking P21 information package expectation, etc. The leaf template can be inserted into a child template or a root template.
[0072] Use the automated test environment to run test scripts and verify test results:
[0073] The automatic test environment is built based on Python language and consists of three parts: script controller, main engine kernel and sub-engine. The script controller is responsible for running the test script and sending commands to the main engine kernel. The main engine kernel transmits operation instructions to the sub-engine according to the command, simulates the train running in the train control system, and transmits the information sent by RBC to the sub-engine to the script controller. The script controller compares the expected results with the actual results sent by RBC, and outputs log information and execution results according to the comparison results.
[0074] After all test scripts are executed, the tester checks and counts the log information and execution results to complete the RBC-PDT test.
[0075] like Figure 4 As shown, an embodiment of the present disclosure provides an RBC-PDT test system for automatic script generation, comprising:
[0076] The data acquisition module 11 is used to determine the test requirements and obtain the passenger dedicated line data;
[0077] A model building module 12, used to model in sequence according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and process the passenger dedicated line data into an intermediate data model suitable for script generation;
[0078] A script generation module 13 is used to calculate and fill in script templates of each level using the intermediate data model, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement;
[0079] The test module 14 is used to run the test script through the automatic test environment and check the test results output by the automatic test environment.
[0080] The implementation process of the functions and effects of each module in the above system is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0081] For the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The system embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Those of ordinary skill in the art can understand and implement it without paying creative labor.
[0082] In the above-mentioned embodiment, any multiple of all modules can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least some functions of one or more of these modules can be combined with at least some functions of other modules and implemented in one module. At least one of all modules can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation modes of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of all modules can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0083] See also Figure 5 , an electronic device provided by an embodiment of the present disclosure includes a processor 1110, a communication interface 1120, a memory 1130 and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140;
[0084] Memory 1130, for storing computer programs;
[0085] The processor 1110 is used to implement the RBC-PDT test method of automatic script generation as shown below when executing the program stored in the memory 1130.
[0086] The communication bus 1140 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 1140 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0087] The communication interface 1120 is used for communication between the above electronic device and other devices.
[0088] The memory 1130 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory 1130 may also be at least one storage device located away from the processor 1110.
[0089] The above-mentioned processor 1110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0090] The embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the RBC-PDT test method for automatic script generation as described above is implemented.
[0091] The computer-readable storage medium may be included in the device / apparatus described in the above embodiment; or it may exist independently without being assembled into the device / apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the RBC-PDT test method for automatic script generation according to the embodiment of the present disclosure is implemented.
[0092] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0093] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. An RBC-PDT test method with automatic script generation, characterized in that: The following steps are involved: Determine test requirements and obtain passenger-dedicated line data; Modeling is performed in order according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and the passenger dedicated line data is processed into an intermediate data model suitable for script generation; Use the intermediate data model to calculate and fill in script templates at each level, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement; The test script is run through the automatic test environment, and the test result output by the automatic test environment is checked.
2. The RBC-PDT test method according to claim 1, characterized in that: The passenger-dedicated line data includes a line data table, a line gradient table, a line speed table and a ground equipment number information table; The underlying model includes a line model, a station model, an RBC model and a TSRS model; The intermediate data model includes an intermediate route data model, an intermediate station data model, an intermediate line data model and an intermediate RBC data model.
3. The RBC-PDT test method according to claim 1, characterized in that: The intermediate route data model includes the route's signal machine, transponder, interlocking, and MA information, and can be directly used for test script generation.
4. The RBC-PDT test method according to claim 1, characterized in that: The intermediate data model is used to calculate and fill in script templates at each level, and the lower-level script template is nested into the upper-level script template to generate test scripts for each test requirement, including: Pre-designing a script template of a test script applicable to all test requirements, using the intermediate data model to calculate and fill in the script templates of each level in sequence, and generating a test script by inserting the lower-level script template into the upper-level script template; The script templates at each level include a root template, a sub-template and a leaf template.
5. The RBC-PDT test method according to claim 4, characterized in that: The root template is a top-level general script template, which is applicable to the generation of test scripts for various test requirements, including line script templates and temporary speed limit script templates. The sub-template is a script template of the middle layer, which needs to be inserted into other leaf templates and then into the root template; The leaf template is the lowest-level script template, corresponding to a specific action or specific expectation in the test script. The leaf template can be inserted into the child template or the root template.
6. The RBC-PDT test method according to claim 1, characterized in that: The specific actions include setting train actions and requesting shunting actions; the specific expectations include checking P15 information package expectations and checking P21 information package expectations.
7. The RBC-PDT test method according to claim 1, characterized in that: Running the test script through the automatic test environment and checking the test results output by the automatic test environment include: Building an automatic testing environment based on Python language, the automatic testing environment includes a script controller, a main engine kernel and a sub-engine; The script controller is responsible for running the test script and sending commands to the main engine kernel; The main engine kernel transmits operation instructions to the sub-engine according to the command, simulates the train running in the train control system, and transmits the information sent by the RBC to the sub-engine to the script controller; the script controller compares the expected result with the actual result sent by the RBC, and outputs log information and execution results according to the comparison result; After all the test scripts have been executed, the log information and the execution results are checked and counted to complete the RBC-PDT test.
8. An RBC-PDT test system with automatic script generation, characterized in that: include: Data acquisition module, used to determine test requirements and obtain passenger dedicated line data; A model building module, used to build models in order according to the hierarchy of passenger dedicated line data-bottom layer model-intermediate data model, and process the passenger dedicated line data into an intermediate data model suitable for script generation; A script generation module, used to calculate and fill in script templates of each level using the intermediate data model, embed the lower-level script template into the upper-level script template, and generate test scripts for each test requirement; The test module is used to run the test script through the automatic test environment and check the test results output by the automatic test environment.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, for storing computer programs; The processor is used to implement the RBC-PDT test method generated by the automatic script described in any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the RBC-PDT test method of automatic script generation according to any one of claims 1 to 7 is implemented.
