Automatic test data upgrading method, system and equipment for ZC and medium

By generating and configuring data structure templates, the test data of the rail transit area controller is automatically upgraded, which solves the problem of manual upgrade difficulties caused by changes in the test data format in the regression test, and realizes efficient and automated test data upgrades, improving testing efficiency and reducing costs.

CN120066948APending Publication Date: 2025-05-30CASCO SIGNAL LTD

Patent Information

Application Number
CN202411910284.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

During the regression testing of rail transit area controllers, changes in the test data format result in a lot of time and effort spent on manual upgrades and maintenance, reducing the testing efficiency.

Method used

By analyzing the test data, a data structure template is generated, and the old version of the test data is automatically upgraded based on the default values ​​and optionally required attributes configured by the user to generate test data that meets the new data structure.

Benefits of technology

It realizes automatic test data upgrades, reduces the workload of manual maintenance, improves the efficiency of regression testing, and reduces the testing cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066948A_ABST
    Figure CN120066948A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic test data upgrading method, system and device for ZC and a medium, and the method comprises the steps: S1, analyzing test data, and converting the test data into a dictionary form; s2, extracting a structure template from the dictionary form data, processing common attributes, dictionary attributes and list attributes in the dictionary form data, adding corresponding default value rules for attributes in the structure template according to attribute default value rules provided by a user, and generating a new data structure template first draft; s3, further processing the new data structure template first draft to generate a final data structure template; and S4, according to the data structure template generated in the step S3, performing data upgrading on the test data of the old version. Compared with the prior art, the method has the advantages that the testing efficiency is further improved, and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a rail transit signal system, and in particular, to an automatic test data upgrade method, system, device and medium for a ZC (rail transit area controller). Background Art

[0002] As the core control system of rail transit, the rail transit area controller ZC (Zone Control) undertakes tasks such as train automatic protection and train movement authorization. High requirements are imposed on its stability and security. In order to obtain a highly reliable and high-quality area controller, it is very necessary to design rich test scenarios to comprehensively test the system. To meet the corresponding test scenarios, a large number of various test data must be produced. During the regression test process, due to the upgrade of the system function, the test data format changes, resulting in a large amount of time and effort being consumed to manually upgrade and maintain the test data during the regression test process, reducing the test efficiency. For the above reasons, inventing an efficient and automated test data upgrade system has become an important direction to solve this problem.

[0003] Currently, the production of data in the traditional area controller test is mainly completed by testers (manually). Although keyword technology is adopted in some automated test systems to automatically match test data that meets the test conditions and construct test scenarios, when the system cannot find test data that meets the conditions, the corresponding test scenarios still cannot be tested, and only by manually modifying the data and then performing the corresponding test. There are also some ways to automatically generate data according to test scenarios, but the data generated in this way will inevitably have certain differences from the original data, resulting in the need to modify the test execution and analysis scripts during the test process. Although the problem of test data is solved, the maintenance cost of the test scripts is increased. Especially when using an automated test system to perform a full regression test of test cases, a large amount of time is spent modifying the original test data and test scripts, making the automated test unable to be truly automated and the test efficiency unable to be improved.

[0004] After retrieval, Chinese Patent Publication No. CN116401144A discloses a method, system, device and medium for automatically generating test data for ATC. Although this existing patent describes a method for automatically generating test data for ATC, which mainly generates test data according to a data description script, the generated data can meet the test requirements. However, since it depends on a test data template, if the template changes, the data generated each time may be different, which may affect the test script, resulting in the need to rewrite and debug the test execution and analysis scripts, introducing new workload.

[0005] Therefore, how to improve the data production efficiency of testers during regression testing without changing the test execution and analysis scripts has become a technical problem to be solved. Summary of the Invention

[0006] The purpose of the present invention is to overcome the defects of the above-mentioned existing technologies and provide a method, system, device and medium for automatic upgrade of test data for ZC, which overcomes the disadvantages of low efficiency, error-proneness and difficult maintenance in test data upgrade and maintenance in traditional automated testing. Analyze the new version of the test data structure and generate a data structure template. Testers then configure the default values and other logics according to the template, and finally upgrade the original data according to the configuration to generate new test data that meets the conditions for use by the software under test, further improving the test efficiency.

[0007] The purpose of the present invention can be achieved by the following technical solutions:

[0008] According to the first aspect of the present invention, a method for automatic upgrade of test data for ZC is provided, and the method includes the following steps:

[0009] Step S1, parse the test data and convert the test data into a dictionary form;

[0010] Step S2, extract the structure template from the dictionary-form data obtained in step S1, process the ordinary attributes, dictionary attributes, and list attributes respectively, and add corresponding default value rules to the attributes in the structured template according to the attribute default value rules provided by the user to generate a preliminary draft of the new data structure template;

[0011] Step S3, further process the preliminary draft of the new data structure template generated in step S2, update the optional and mandatory values of the attributes of the data structure template according to the optional and mandatory configurations of the attributes provided by the user, and at the same time update the attribute structure conversion rules of the data structure template according to the attribute structure conversion rules provided by the user, and generate the final data structure template;

[0012] Step S4, upgrade the old version of the test data according to the data structure template generated in step S3.

[0013] As a preferred technical solution, the dictionary form in step S1 is specifically: the attribute name is used as the key, and the value is used as the key value.

[0014] As a preferred technical solution, step S1 specifically includes the following steps:

[0015] Step S101, read the test data folder, traverse the data therein, and obtain a file list;

[0016] Step S102: Traverse according to the file list obtained in step S101. When the file traversal is not completed, go to step S103; when completed, go to step S105.

[0017] Step S103: Read the current data file, store the content thereof according to the dictionary information of key-value pairs, and go to step S104.

[0018] Step S104: Use the file name as the root node, and store the dictionary of "attribute - value" parsed in step S103 as the leaf node of the root node, and go to step S105.

[0019] Step S105: Aggregate the data dictionaries of each file obtained in step S104 to generate a total dictionary data structure with the file name as the key and the dictionary data of each file as the value.

[0020] As a preferred technical solution, in step S105, convert the generated total dictionary data structure into json format.

[0021] As a preferred technical solution, step S2 specifically includes the following steps:

[0022] Step S201: Traverse each attribute of the parsed data one by one, and go to step S202.

[0023] Step S202: Judge the type of the traversed attribute. If it is a common attribute, go to step S203; if it is a dictionary attribute, go to step S204; if it is a list attribute, go to step S205.

[0024] Step S203: For a common attribute, define the attribute as a common value type, generate a corresponding default value according to the data default rule library provided, store it in a key-value pair with the attribute name as the key and the default value as the value, and transfer the data to step S206.

[0025] Step S204: For a dictionary attribute, define the attribute as a dictionary type, and at the same time use the attribute name as the key, and continue to traverse and analyze the value in the way of steps S201 - S205 to obtain its structured dictionary as the value for storage, and transfer the final result to step S206.

[0026] Step S205: For a list attribute, define the attribute as a list type, and at the same time use the attribute name as the key, and continue to traverse and analyze the first value in the way of steps S201 - S205 to obtain its structured dictionary as the value for storage, and transfer the final result to step S206.

[0027] Step S206: Aggregate the results of steps S203 - S205, and finally generate a draft of the data structure template.

[0028] As a preferred technical solution, step S3 specifically includes the following steps:

[0029] Step S301: Determine whether there is an existing data structure template. If so, go to step S302; otherwise, go to step S304.

[0030] Step S302: Calculate the MD5 code for the initial draft of the new data structure template, and go to step S303.

[0031] Step S303: Compare the MD5 in the existing template with the MD5 calculated in step S302. If they are the same, go to step S305; if different, go to step S304.

[0032] Step S304: Store the MD5 of the new template, and use the initial draft of the new template as the template to input into step S306 for processing.

[0033] Step S305: If the template MD5 is the same, continue to use the original template and input it into step S306 for processing.

[0034] Step S306: According to the optional and mandatory attribute definitions input by the user, update the optional and mandatory features of the template, and go to step S307.

[0035] Step S307: According to the data structure conversion configuration defined by the user, update the data conversion related configuration to generate the final data structure template.

[0036] As a preferred technical solution, step S4 specifically includes the following steps:

[0037] Step S401: Read the new data structure template and the old version of the data, and go to step S402.

[0038] Step S402: Traverse each attribute of the data structure template, and go to step S403.

[0039] Step S403: Judge the type of the traversed attribute. If it is a common attribute, go to step S404; if it is a dictionary attribute, go to step S405; if it is a list attribute, go to step S406.

[0040] Step S404: For common attributes, check whether the old version of the data contains this attribute. If it does, go to step S407; otherwise, go to step S408.

[0041] Step S405: Traverse the sub-attributes in the dictionary, and process the data in the way of steps S402 - S411. After processing, go to step S412.

[0042] Step S406: Traverse each item data in the list, process each item in the manner of steps S402 - S411, and after completion, proceed to step S412;

[0043] Step S407: Without modifying the old version data, directly proceed to step S412;

[0044] Step S408: Determine whether the attribute is a mandatory or optional attribute. If it is an optional attribute, proceed to step S407; if it is a mandatory attribute, proceed to step S409;

[0045] Step S409: Determine whether the attribute is an attribute in the structure conversion definition. If it is, proceed to step S411; otherwise, proceed to step S410;

[0046] Step S410: Generate the value in the data according to the default value expression in the structure template, update the relevant attribute data, and proceed to step S412;

[0047] Step S411: According to the structure conversion definition, copy the content in the original data to the new attribute after conversion for data update, and proceed to step S412;

[0048] Step S412: Search for and delete the attributes that exist in the old data but do not exist in the structure template, and proceed to step S413;

[0049] Step S413: Re - convert the data file obtained from the calculation in step S412 into a file in the test data format.

[0050] As a preferred technical solution, the data file in step S413 is a data file in json format.

[0051] According to the second aspect of the present invention, there is provided a test data automatic upgrade system for ZC, including:

[0052] A data parsing module M1, which is used to parse the test data, convert the test data into a dictionary form, and provide it for use by the data structure template generation module M2 and the data upgrade module M4;

[0053] A data structure template generation module M2, which is used to extract the structure template from the dictionary data generated by the data parsing module M1, process the ordinary attributes, dictionary attributes, and list attributes respectively, and then add corresponding default value rules to the attributes in the structured template according to the attribute default value rules provided by the user, and finally generate a preliminary draft of the new data structure template for use by the data template editing module M3;

[0054] The data structure template editing module M3 is used to further process the initial draft of the new data structure template generated by the data structure template generation module M2. According to the optional and mandatory configuration of attributes provided by the user, it updates the optional and mandatory values of the attributes of the data structure template. According to the attribute structure conversion rules provided by the user, it updates the attribute structure conversion rules of the data structure template, and generates the final data structure template for use by the data upgrade module M4;

[0055] The data upgrade module M4 is used to perform data upgrade on the old version of test data according to the data structure template generated by the data structure template editing module M3.

[0056] As a preferred technical solution, the upgrade content of the data upgrade module M4 includes the addition of new attributes, the deletion of redundant attributes, the automatic transformation of attributes with structural changes, and the automatic upgrade of the old version data into test data that meets the new data structure.

[0057] According to the third aspect of the present invention, there is provided an electronic device, including a memory and a processor. A computer program is stored on the memory, and when the processor executes the program, the method described above is implemented.

[0058] According to the fourth aspect of the present invention, there is provided a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described above is implemented.

[0059] Compared with the prior art, the present invention has the following advantages:

[0060] 1) The present invention converts the original manual test data upgrade process into an automatic data upgrade process. At the same time, on the premise that the function remains unchanged, since the original content of the data has not changed, there is no need to adjust the execution and analysis scripts, saving a large amount of complicated and repetitive data upgrade work, greatly reducing the time for data maintenance and upgrade in the regional controller regression test, and providing strong data guarantee for the full automation of the regression test.

[0061] 2) The present invention provides a set of processes including the definition and configuration of data structure templates. Testers only need to complete the definition of the default values of data attributes, the optional and mandatory configuration of data attributes, and the configuration of data structure conversion. The system will automatically generate the final data structure template based on this, and analyze, process, and upgrade the data of other versions, and finally automatically obtain the test data that meets the current test requirements, greatly simplifying the difficulty of data upgrade and the data production cost for testers during the regression test, and being of great help to improving the test efficiency (especially the regression test efficiency).

[0062] 3) The present invention can also store and manage data structure templates of different versions, so that when subsequent version backtracking is performed, according to this template data, the data of other versions can be automatically converted into the data of this version, and corresponding test problem backtracking can be performed, reducing the time required for test problem backtracking. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 is a structural diagram of the automatic data upgrade system of the rail transit area controller of the present invention;

[0064] Figure 2 is a flowchart of the data parsing process of the automatic data upgrade system of the rail transit area controller of the present invention;

[0065] Figure 3 is a flowchart of the data structure process generation module of the automatic data upgrade system of the rail transit area controller of the present invention;

[0066] Figure 4 is a flowchart of the data structure template editing process of the automatic data upgrade system of the rail transit area controller of the present invention;

[0067] Figure 5 is a flowchart of the data upgrade process of the automatic data upgrade system of the rail transit area controller of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0068] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0069] In order to ensure that during the full regression test process, when the relevant functions remain unchanged, the test execution and analysis scripts do not need to be modified and can be directly used for functional testing, it is particularly important that the test data can be automatically upgraded without changing the original structure, which can greatly save the manual maintenance cost required in automated testing and improve the test efficiency. Therefore, analyzing the latest data and generating a preliminary draft of the test data structure template, the tester sets the default values and optional attributes of the template according to the data structure change requirements to define the final data template, and then sorts and upgrades the historical version test data according to this template to automatically generate the test data available for the current version, which is finally used in the functional testing of the current version and is of great help in reducing the test cost of the rail transit area controller and improving the test efficiency.

[0070] The method for automatically upgrading the test data of the present invention for ZC includes the following steps:

[0071] Step S1, parse the test data and convert the test data into a dictionary form;

[0072] Step S2, extract the structure template from the dictionary-form data obtained in Step S1, process the ordinary attributes, dictionary attributes, and list attributes respectively, and add corresponding default value rules to the attributes in the structured template according to the attribute default value rules provided by the user, generating a preliminary draft of the new data structure template;

[0073] Step S3, further process the preliminary draft of the new data structure template generated in Step S2, update the optional and mandatory values of the attributes of the data structure template according to the optional and mandatory configuration of the attributes provided by the user, and at the same time update the attribute structure conversion rules of the data structure template according to the attribute structure conversion rules provided by the user, and generate the final data structure template;

[0074] Step S4, upgrade the old version of the test data according to the data structure template generated in Step S3, mainly including adding new attributes, deleting redundant attributes, and automatically transforming the attributes with structural changes, and finally automatically upgrade the old version of the data into test data that meets the new data structure for use in the new round of regression testing.

[0075] As Figure 2 shown, Step S1 of the present invention includes the following steps:

[0076] Step S101: Read the test data folder, traverse the data therein, and obtain a file list;

[0077] Step S102: Extract and traverse the file list obtained in S101. When the file traversal is not completed, go to Step S103; when completed, go to Step S105;

[0078] Step S103: Read the current data file, store the content thereof according to the dictionary information of key-value pairs, and go to Step S104.

[0079] Step S104: Store the file name as the root node and the "attribute - value" dictionary parsed in Step S103 as the leaf nodes of the root node, and go to Step S105.

[0080] Step S105: Summarize the data dictionaries of each file obtained in Step S104 to form a total dictionary data structure with the file name as the key and the dictionary data of each file as the value, and convert it into json format for use by the data structure template generation module M2 and the data upgrade module M4, and end this process;

[0081] As Figure 3 shown, Step S2 of the present invention includes the following steps:

[0082] Step S201: Parse the new data into the form of a dictionary using the data parsing module M1, traverse each of the attributes therein one by one, and transfer to step S202 for processing.

[0083] Step S202: Judge the type of the traversed attribute. For ordinary attributes, transfer to step S203; for dictionary attributes, transfer to step S204; for list attributes, transfer to step S205.

[0084] Step S203: For ordinary attributes, define the attribute as an ordinary value type, generate the corresponding default value according to the data default rule library provided, store it in the key-value pair with the attribute name as the key and the default value as the value, and transfer the data to step S206.

[0085] Step S204: For dictionary attributes, define the attribute as a dictionary type. At the same time, use the attribute name as the key, and continue to traverse and analyze the value in the way of steps S201 - S205 to obtain its structured dictionary as the value for storage. The final result also transfers to step S206.

[0086] Step S205: For list attributes, define the attribute as a list type. At the same time, use the attribute name as the key, and continue to traverse and analyze the first value in the way of steps S201 - S205 to obtain its structured dictionary as the value for storage. The final result also transfers to step S206.

[0087] Step S206: Summarize the results of steps S203 - S205, and finally generate a preliminary draft of the data structure template for use by the data upgrade module M4, and end this process;

[0088] As Figure 4 shown, step S3 of the present invention includes the following steps:

[0089] Step S301: Judge whether there is an existing data structure template. If not, directly transfer to step S304; if so, transfer to step S302;

[0090] Step S302: Calculate the MD5 code for the preliminary draft of the new data structure template, and transfer to step S303;

[0091] Step S303: Compare the MD5 in the existing template with the MD5 calculated in step S302. If they are the same, transfer to step S305; if different, transfer to step S304;

[0092] Step S304: Store the MD5 of the new template, and use the preliminary draft of the new template as the template to transfer to step S306 for processing;

[0093] Step S305: If the template MD5 is the same, it indicates that the structure has not changed. Continue to use the original template and proceed to step S306 for processing;

[0094] Step S306: According to the optional and mandatory attribute definitions input by the user, update the optional and mandatory features of the template, and proceed to step S307;

[0095] Step S307: According to the data structure conversion configuration defined by the user, update the data conversion related configuration, generate the final data structure template, and output it to the data upgrade module M4, and end this process;

[0096] As Figure 5 shown, step S4 of the present invention includes the following steps:

[0097] Step S401: Use the data parsing module M1 to read the new data structure template and the old version of the data, and proceed to step S402;

[0098] Step S402: Traverse each attribute of the data structure template, and proceed to step S403;

[0099] Step S403: Judge the type of the traversed attribute. For ordinary attributes, proceed to step S404. For dictionary attributes, proceed to step S405. For list attributes, proceed to step S406.

[0100] Step S404: For ordinary attributes, check whether the old version of the data contains this attribute. If it contains, proceed to step S407. If it does not contain, proceed to step S408;

[0101] Step S405: Traverse the sub-attributes in the dictionary, and process the data in the manner of steps S402 - S411. After processing, proceed to step S412;

[0102] Step S406: Traverse each item data in the list, and process each item in the manner of steps S402 - S411. After processing, proceed to step S412;

[0103] Step S407: Do not modify the old version of the data, and directly proceed to step S412;

[0104] Step S408: Judge whether the attribute is an optional or mandatory attribute. If it is an optional attribute, proceed to step S407. If it is a mandatory attribute, proceed to step S409;

[0105] Step S409: Judge whether the attribute is an attribute in the structure conversion definition. If it is, proceed to step S411. If it is not, proceed to step S410;

[0106] Step S410: Generate the value in the data according to the default value expression in the structure template, and update the relevant attribute data, and proceed to step S412;

[0107] Step S411: According to the structure conversion definition, copy the content in the original data to the new attributes after conversion for data update, and then go to Step S412;

[0108] Step S412: Search for and delete the attributes that exist in the old data but do not exist in the structure template, and finally go to Step S413;

[0109] Step S413: Re-convert the json format data file obtained by the calculation in Step S412 into a file in the test data format, and end the final process.

[0110] The above is the introduction of the method embodiment. The following further illustrates the solution of the present invention through a system embodiment.

[0111] As Figure 1 shown, the test data automatic upgrade system for the rail transit area controller in this embodiment includes: a data parsing module M1, a data structure template generation module M2, a data structure template editing module M3, and a data upgrade module M4.

[0112] Among them, the data parsing module M1 is used to parse the information of the test data. Here, the test data file in par format (a text file with a standard format customized by the area controller) is parsed. The test data file list is obtained through Step S101, and then the file is read and parsed into json form through S102. The result of one of the files (adjzcboa_area.par) is shown as follows:

[0113] {'ADJZCBOA_STDE_BLOCK':[{'ADJACENT_ZC_EOUIPMENT_NAME':'ZC2','ADJZCBOA_STDE_NAME':'TO2E',...}],...}

[0114] After all files are read, through S104 and S105, the data of a single file is summarized with the file name as the key value and the content as the value to obtain the following structure:

[0115] {"adjzcboa_area": {"ADJZCBOA_STDE_BLOCK": [{"ADJACENT_ZC_EOUIPMENT_NAME": "ZC2", "ADJZCBOA_STDE_NAME": "TO2E",...}],...}, "ap_fences": {"AP_FENCE": [{"ZC_NAME": "ZC1", "TYPE": "AP_FENCE1", "AP_FENCE_NAME": "APF_683_UP", "UPSTREAM_STDE_NAME": "T03C",...}],...}....}

[0116] Both adjzcboa_area and ap_fences are file names.

[0117] For the newly parsed test data above, traverse the data attributes and process them separately according to the type of the attributes, and finally add the default values. The default values of this data are processed in the manner shown in Table 1 according to the user rules:

[0118] Table 1

[0119] Attribute feature Default value Attributes whose names contain IS_ YES Other attributes 0

[0120] Finally, generate the initial draft of the data structure template in the following form:

[0121] {"adjzcboa_area": {

[0122] "ADJZCBOA_STDE_BLOCK": {

[0123] "ADJACENT_ZC_EQUIPMENT_NAME": “0”,

[0124] "ADJZC_ORIENTATION_CONVENTION": “0”,

[0125] "ADJZCBOA_BLOCKS_NUMBER": "0”},

[0126] "ADJZCBOA_BLOCK_HEADER": {

[0127] "ADJACENT_ZC_EOUIPMENT_NAME": “0”,

[0128] "ADJZCBOA_BLOCK_NAME": “0”,

[0129] "LENGTH": “0”,

[0130] "IS_BOA_FRT":"YES"},...},...}

[0131] Further configure the above data structure template by adding optional and required configurations. Here, we provide a list of optional attributes for the user. Attributes not in the optional attribute list are required attributes. Since most attributes are required attributes, the time spent by testers on configuring optional and required attributes can be reduced. In this example, we define AP_FENCE as an optional attribute and the rest as required attributes, and automatically update the option content of the data structure template as follows:

[0132] {"option":{

[0133] "adjzcboa_area":{

[0134] "ADJZCBOA_STDE_BLOCK":{

[0135] "ADJACENT_ZC_EQUIPMENT_NAME":false,

[0136] "ADJZCBOA_STDE_NAME":false,

[0137] "ADJZCBOA_BLOCKS_NUMBER":false},

[0138] "AP_FENCE":{

[0139] "ZC_NAME":false,

[0140] "AP_FENCE_NAME":false,

[0141] "AP_FENCE":true},...},...}}

[0142] In this data update, all the content in the files areas and ma_zone is converted to the new file zone_inter. Therefore, the structure conversion is defined as follows:

[0143] {"transferFile":{"areas":"zone_inter","ma_zone":"zone_inter"}

[0144] The above completes the final configuration of the data structure template. Next, we will read the old data and perform structure conversion on it. The data read by the data parsing module in this example is shown as follows:

[0145] {'adjzcboa_area':{

[0146] 'ADJZCBOA_STDE_BLOCK':[{'ADJACENT_ZC_EOUIPMENT_NAME':'ZC2','ADJZCBOA_STDE_NAME':'TO2E','ADJZCBOA_STDE_NAME_DELETE':'TO2E'},...],

[0147] 'AP_FENCE':[{'ZC_NAME':'ZC1','AP_FENCE_NAME':'APF_683_UP'},...],...}

[0148] 'areas':{

[0149] 'CHANGE_OF_DIRECTION_AREA_BLOCK':

[0150] [{'ZC_NAME':'ZC1','CHANGE_OF_DIRECTION_AREA_NAME':'COD_T06C_U','BLOCK_NAME':'B_1079'},...],...}

[0151] 'ma_zones':{

[0152] 'MA_ZONE':

[0153] [{'ZC_NAME':'ZC1','MA_ZONE_NAME':'MAZ_T06C_U_TFCH1_TL_B_245','BLOCK_NAME_A':'B_245”BLOCK_NAME_B':'B_246'},...],...}}

[0154] The above data attributes are traversed and upgraded, and the specific identified changes are as follows:

[0155] adjzcboa_area / ADJZCBOA_STDE_BLOCK / ADJZCBOA_BLOCKS_NUMBER exists in the new structure and is a required attribute, but does not exist in the old data. Therefore, it needs to be added and filled with the default value;

[0156] adjzcboa_area / ADJZCBOA_STDE_BLOCK / ADJZCBOA_STDE_NAME_DELETE does not exist in the data structure template. Therefore, it needs to be deleted;

[0157] The property adjzcboa_area / AP_FENCE / AP_FENCE does not exist in the old data, but this property is optional, so it is ignored and no addition is required.

[0158] The content in areas and ma_zones in the old data is transferred to the new node zone_inter for storage.

[0159] According to the above changes, the old data is automatically upgraded to obtain the new data content as follows:

[0160] {'adjzcboa_area':{

[0161] 'ADJZCBOA_STDE_BLOCK':[{'ADJACENT_ZC_EOUIPMENT_NAME':'ZC2','ADJZCBOA_STDE_NAME':

[0162] 'TO2E','ADJZCBOA_BLOCKS_NUMBER':'0'},...],

[0163] 'AP_FENCE':[{'ZC_NAME':'ZC1','AP_FENCE':'APF_683_UP'},...],...}

[0164] 'zone_inter':{

[0165] 'CHANGE_OF_DIRECTION_AREA_BLOCK':

[0166] [{'ZC_NAME':'ZC1','CHANGE_OF_DIRECTION_AREA_NAME':'COD_T06C_U','BLOCK_NAME':'B_1079'},...],...},

[0167] 'MA_ZONE':

[0168] [{'ZC_NAME':'ZC1','MA_ZONE_NAME':'MAZ_T06C_U_TFCH1_TL_B_245','BLOCK_NAME_A':'B_245”BLOCK_NAME_B':'B_246'},...],...}}

[0169] Then, generate the data file format (.par) of the area controller according to the above new data. Finally, complete the data upgrade work this time.

[0170] As can be seen from the above examples, by adopting this method, testers only need to perform simple configurations for property default values, property required / optional settings, and structure conversions. The system will automatically generate a new data structure template and automatically upgrade the test data of the old version according to the data structure template, which is extremely helpful for reducing the cost of making and upgrading test data for area controllers and improving test efficiency.

[0171] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the described modules can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0172] The embodiment of the present invention also provides an electronic device including a central processing unit (CPU), which can execute various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or computer program instructions loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The CPU, ROM, and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.

[0173] Multiple components in the device are connected to the I / O interface, including: an input unit, such as a keyboard, a mouse, etc.; an output unit, such as various types of displays, speakers, etc.; a storage unit, such as a disk, an optical disc, etc.; and a communication unit, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit allows the device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0174] The processing unit executes the various methods and processes described above, such as methods S1 to S4. For example, in some embodiments, methods S1 to S4 can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device via the ROM and / or the communication unit. When the computer program is loaded into the RAM and executed by the CPU, one or more steps of the methods S1 to S4 described above can be executed. Alternatively, in other embodiments, the CPU can be configured to execute methods S1 to S4 by any other suitable means (for example, by means of firmware).

[0175] The functions described above herein can be at least partially executed by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and so on.

[0176] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or a controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or the controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program codes can be executed entirely on the machine, partially on the machine, executed partially on the machine as an independent software package and partially on a remote machine, or executed entirely on a remote machine or server.

[0177] In the context of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0178] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for automatically updating test data for ZC, characterized in that: The method comprises the following steps: Step S1, parsing the test data and converting the test data into a dictionary form; Step S2, extracting the structure template from the dictionary-form data obtained in step S1, processing the common attributes, dictionary attributes, and list attributes therein respectively, and adding corresponding default value rules to the attributes in the structure template according to the attribute default value rules provided by the user, and generating a draft of a new data structure template; Step S3, further processing the draft of the new data structure template generated in step S2, updating the optional and required values ​​of the attributes of the data structure template according to the optional and required configurations of the attributes provided by the user, and updating the attribute structure conversion rules of the data structure template according to the attribute structure conversion rules provided by the user, and generating the final data structure template; Step S4: upgrading the old version of the test data according to the data structure template generated in step S3.

2. A method for automatically updating test data for ZC according to claim 1, characterized in that: The dictionary format in step S1 is specifically: the attribute name is used as the key, and the value is used as the key value.

3. The method for automatically updating test data for ZC according to claim 1, characterized in that: The step S1 specifically includes the following steps: Step S101, read the test data folder, traverse the data therein, and obtain a file list; Step S102, traverse the file list obtained in step S101, if the file traversal is not completed, go to step S103, if it is completed, go to step S105; Step S103, read the current data file, store the content therein according to the dictionary information of the key-value pair, and then go to step S104; Step S104, taking the file name as the root node, storing the "attribute-value" dictionary parsed in step S103 as a leaf node of the root node, and proceeding to step S105; Step S105 , summarizing the data dictionaries of the various files obtained in step S104 , and generating a total dictionary data structure with the file name as the key and the dictionary data of the various files as the value.

4. A method for automatically updating test data for ZC according to claim 3, characterized in that: In the step S105, the generated total dictionary data structure is converted into a json format.

5. The method for automatically updating test data for ZC according to claim 1, characterized in that: The step S2 specifically includes the following steps: Step S201, traverse the attributes of the parsed data one by one, and then go to step S202; Step S202, determine the type of the traversed attribute, if it is a common attribute, go to step S203, if it is a dictionary attribute, go to step S204, if it is a list attribute, go to step S205; Step S203, for common attributes, define the attribute as a common value type, and generate a corresponding default value according to the data default rule library provided, store it in a key-value pair with the attribute name as the key and the default value as the value, and transfer the data to step S206; Step S204, for dictionary attributes, define the attribute as a dictionary type, use the attribute name as the key, and continue to traverse and analyze the value in the manner of steps S201-S205 to obtain its structured dictionary as the value to be stored, and the final result is transferred to step S206; Step S205, for list attributes, define the attribute as a list type, and use the attribute name as the key. The first value is traversed and analyzed in the manner of steps S201-S205 and its structured dictionary is obtained as the value to be stored. The final result is transferred to step S206; Step S206, summarizing the results of steps S203-S205, and finally generating a draft of the data structure template.

6. The method for automatically updating test data for ZC according to claim 1, characterized in that: The step S3 specifically comprises the following steps: Step S301, determine whether there is an existing data structure template, if yes, go to step S302, otherwise go to step S304; Step S302, calculate the MD5 code for the draft of the new data structure template, and then go to step S303; Step S303: Compare the MD5 in the existing template with the MD5 calculated in step S302. If they are the same, go to step S305; if they are different, go to step S304. Step S304: storing the MD5 of the new template, and using the draft of the new template as the template input into step S306 for processing; Step S305: If the template MD5 is the same, continue to use the original template and input step S306 for processing; Step S306: Update the optional and required features of the template according to the optional and required attribute definitions input by the user, and then go to step S307; Step S307: According to the data structure conversion configuration defined by the user, update the data conversion related configuration and generate the final data structure template.

7. The method for automatically updating test data for ZC according to claim 1, characterized in that: The step S4 specifically comprises the following steps: Step S401, read the new data structure template and the old version of data, and then go to step S402; Step S402, traverse each attribute of the data structure template, and go to step S403; Step S403, determine the type of the traversed attribute, if it is a common attribute, go to step S404, if it is a dictionary attribute, go to step S405, if it is a list attribute, go to step S406; Step S404, for common attributes, check whether the old version data contains this attribute, if yes, go to step S407, otherwise go to step S408; Step S405, traverse the sub-attributes in the dictionary, and process the data in the manner of steps S402-S411, and after the processing is completed, go to step S412; Step S406, traverse each item of data in the list, and process each item using the method of steps S402-S411, and after the processing is completed, go to step S412; Step S407: do not modify the old version data, and directly go to step S412; Step S408, determine whether the attribute is mandatory or optional, if it is an optional attribute, go to step S407, if it is a mandatory attribute, go to step S409; Step S409, determining whether the attribute is an attribute in the structure conversion definition, if yes, go to step S411, otherwise go to step S410; Step S410, generating the value in the data according to the default value expression in the structure template, and updating the relevant attribute data, and then proceeding to step S412; Step S411, according to the structure conversion definition, copy the content in the original data to the converted new attribute to update the data, and then go to step S412; Step S412, search and delete the attributes that exist in the old data but not in the structure template, and then go to step S413; Step S413, converting the data file obtained by calculation in step S412 back into a file in a test data format.

8. A method for automatically updating test data for ZC according to claim 7, characterized in that: The data file in step S413 is a data file in json format.

9. A test data automatic upgrade system for ZC, characterized in that: include: The data parsing module M1 is used to parse the test data, convert the test data into a dictionary form, and provide it to the data structure template generation module M2 and the data upgrade module M4 for use; The data structure template generation module M2 is used to extract the structure template from the dictionary data generated by the data parsing module M1, process the common attributes, dictionary attributes, and list attributes respectively, and then add corresponding default value rules to the attributes in the structured template according to the attribute default value rules provided by the user, and finally generate a new data structure template draft for use by the data template editing module M3; The data structure template editing module M3 is used to further process the draft of the new data structure template generated by the data structure template generating module M2, update the optional and required values ​​of the attributes of the data structure template according to the optional and required configuration of the attributes provided by the user, update the attribute structure conversion rules of the data structure template according to the attribute structure conversion rules provided by the user, and generate the final data structure template for use by the data upgrading module M4; The data upgrade module M4 is used to upgrade the old version of the test data according to the data structure template generated by the data structure template editing module M3.

10. A test data automatic upgrade system for ZC according to claim 9, characterized in that: The upgrade content of the data upgrade module M4 includes the addition of new attributes, the deletion of redundant attributes, the automatic transformation of structural change attributes, and the automatic upgrade of old version data to test data that meets the new data structure.

11. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Automatic test data generation method, system and device for ATC and medium

    CN116401144A

Cited By

  • Method for supporting automatic batch upgrading of off-line test data of rail transit, electronic equipment and storage medium

    CN121858443A