System testing method, device, equipment and storage medium
By obtaining the playback records and comparison scripts of the historical system, determining new modules, adjusting the running results, extracting target results and comparing them, the problem of low testing efficiency and accuracy of system version upgrade is solved, and efficient and accurate system testing is achieved .
Patent Information
- Application Number
- CN202111222472.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When upgrading the system version, the testing efficiency of the new version of the system is inefficient and the test accuracy is not high, and the production data cannot be fully simulated and simulated, resulting in inaccurate test results.
By receiving test requests, obtaining playback records of the historical system, comparing historical scripts with test scripts, determining new modules, adjusting operation results, extracting target results, and combining and processing and comparing the results to generate test results to avoid unnecessary Recording and comparative analysis.
It improves the efficiency and accuracy of system testing, reduces the number of results to be analyzed, and enhances the accuracy and generation efficiency of test results.
Smart Images

Figure CN113886263B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technology, and in particular to a system testing method, device, equipment and storage medium. Background Art
[0002] When the system is upgraded, it is usually necessary to detect whether there are defects in the new version of the system during operation to ensure the stable operation of the new version of the system. However, due to the substantial growth of the current business, the production traffic has increased, resulting in low testing efficiency for the new version of the system. In addition, due to the diverse forms of production data, the new version of the system cannot be fully simulated, resulting in low testing accuracy for the new version of the system. Summary of the invention
[0003] In view of the above, it is necessary to provide a system testing method, device, equipment and storage medium that can improve the testing efficiency and testing accuracy of the system.
[0004] In one aspect, the present invention provides a system testing method, the system testing method comprising:
[0005] receiving a test request for a test system;
[0006] Acquire a playback record of the historical system according to the test request, wherein the playback record includes a historical data stream and an operation result of the historical data stream, and the test system is an upgrade system of the historical system;
[0007] Comparing the historical script of the historical system with the test script of the test system to obtain a new module of the test system;
[0008] Adjust the operating result according to the newly added module to obtain a benchmark result;
[0009] Replaying the historical data stream based on the test system to obtain a response result of the test system;
[0010] Extracting a target result from the response result according to the operation field corresponding to the benchmark result;
[0011] The target results are merged to obtain the results to be analyzed and the result types of the results to be analyzed;
[0012] The result to be analyzed is compared with the benchmark result according to the result type to generate a test result.
[0013] According to a preferred embodiment of the present invention, obtaining a playback record of a historical system according to the test request includes:
[0014] Parsing the generation time of the test system from the test request as a first time point;
[0015] Acquire all associated systems associated with the test system, and acquire the generation time of each associated system as a second time point;
[0016] Determine the associated system corresponding to the second time point closest to the first time point as the historical system;
[0017] Obtaining a test log of the historical system;
[0018] Extracting a data storage path from the test log;
[0019] The playback record is obtained from the data storage path according to the system code of the historical system.
[0020] According to a preferred embodiment of the present invention, comparing the historical script of the historical system with the test script of the test system to obtain the newly added module of the test system includes:
[0021] Convert the history script into a history syntax tree, and convert the test script into a test syntax tree;
[0022] Compare the historical syntax tree with the test syntax tree to obtain a new script;
[0023] The function point corresponding to the newly added script is determined as the newly added module.
[0024] According to a preferred embodiment of the present invention, adjusting the operating result according to the newly added module to obtain a benchmark result includes:
[0025] Obtaining module rules in the newly added module;
[0026] Performing semantic analysis on the module rules to obtain semantic information;
[0027] Matching the semantic information with the historical fields in the historical system, and determining the historical fields that successfully match the semantic information as adjustment fields;
[0028] Filtering the results to be processed from the operation results according to the adjustment fields;
[0029] The to-be-processed result is adjusted according to the module rule to obtain a control result, and the to-be-processed result in the operation result is replaced based on the control result to obtain the benchmark result.
[0030] According to a preferred embodiment of the present invention, replaying the historical data stream based on the test system to obtain a response result of the test system includes:
[0031] Identifying a data type of the historical data stream;
[0032] Calling a traffic playback module according to the data type;
[0033] The historical data flow is replayed in the test system based on the traffic replay module to obtain the response result.
[0034] According to a preferred embodiment of the present invention, extracting the target result from the response result according to the operation field corresponding to the benchmark result includes:
[0035] Filtering the result corresponding to the operation field from the response results as the initial result;
[0036] The results corresponding to the preset fields are removed from the initial results as the target results.
[0037] According to a preferred embodiment of the present invention, comparing the result to be analyzed with the benchmark result according to the result type to generate a test result includes:
[0038] Counting the number of the result types as the number of types;
[0039] Obtain idle threads whose number of threads is equal to the number of the type as running threads;
[0040] Calling the running thread according to the result type to concurrently compare the result to be analyzed with the benchmark result;
[0041] If the result to be analyzed is consistent with the reference result, the test result is determined as a success of the test system test; or
[0042] If the result to be analyzed is inconsistent with the reference result, the test result is determined as a test failure of the test system.
[0043] On the other hand, the present invention further provides a system testing device, the system testing device comprising:
[0044] A receiving unit, used for receiving a test request for the test system;
[0045] an acquisition unit, configured to acquire a playback record of a historical system according to the test request, wherein the playback record includes a historical data stream and an operation result of the historical data stream, and the test system is an upgrade system of the historical system;
[0046] A comparison unit, used for comparing the historical script of the historical system with the test script of the test system to obtain a newly added module of the test system;
[0047] An adjustment unit, configured to adjust the operation result according to the newly added module to obtain a benchmark result;
[0048] A playback unit, used to play back the historical data stream based on the test system to obtain a response result of the test system;
[0049] An extraction unit, configured to extract a target result from the response result according to an operation field corresponding to the benchmark result;
[0050] A merging unit, used for merging the target results to obtain the results to be analyzed and the result types of the results to be analyzed;
[0051] A generating unit is used to compare the result to be analyzed with the benchmark result according to the result type to generate a test result.
[0052] On the other hand, the present invention further provides an electronic device, comprising:
[0053] a memory storing computer readable instructions; and
[0054] The processor executes the computer-readable instructions stored in the memory to implement the system testing method.
[0055] On the other hand, the present invention further proposes a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the system testing method.
[0056] It can be seen from the above technical scheme that the present invention obtains the playback record of the historical system according to the test request. Since the playback record refers to the data generated when the historical system is tested, there is no need to record the historical system when the test system is tested, thereby improving the test efficiency of the test system. By comparing the historical script with the test script, the new module can be accurately determined, and then the operation result can be adjusted according to the new module, which can avoid the impact of the new module on the test system and cause the test result to be inaccurate, thereby improving the test accuracy of the test system. By extracting the target result, since there is no need to compare and analyze all the response results, not only the test efficiency can be improved, but also the impact of field information irrelevant to the business scenario on the test result can be avoided, thereby improving the accuracy of the test result. By merging the target results, the target results of the same type can be merged to reduce the number of the results to be analyzed, thereby improving the generation efficiency of the test results. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is a flow chart of a preferred embodiment of the system testing method of the present invention.
[0058] Figure 2 It is a functional module diagram of a preferred embodiment of the system testing device of the present invention.
[0059] Figure 3 It is a schematic diagram of the structure of an electronic device of a preferred embodiment of the system testing method of the present invention. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0061] like Figure 1 FIG. 1 is a flow chart of a preferred embodiment of the system testing method of the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0062] The system testing method can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0063] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0064] The system testing method is applied to one or more electronic devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions, and whose hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0065] The electronic device can be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0066] The electronic device may include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of multiple network electronic devices, or a cloud consisting of a large number of hosts or network electronic devices based on cloud computing.
[0067] The network where the electronic device is located includes, but is not limited to: the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0068] S10, receiving a test request for the test system.
[0069] In at least one embodiment of the present invention, the test system refers to a system that requires flow testing.
[0070] The information carried in the test request includes, but is not limited to: the generation time of the test system, etc. The test request can be triggered and generated by any terminal.
[0071] S11, obtaining a playback record of a historical system according to the test request, wherein the playback record includes a historical data stream and an operation result of the historical data stream, and the test system is an upgrade system of the historical system.
[0072] In at least one embodiment of the present invention, the historical system refers to an associated system that is closest to the generation time of the test system, and the associated system refers to a system that has an associated relationship with the test system.
[0073] The historical data flow refers to traffic data, and the operation result refers to the execution result of the historical system on the traffic data.
[0074] In at least one embodiment of the present invention, the electronic device obtaining the playback record of the history system according to the test request includes:
[0075] Parsing the generation time of the test system from the test request as a first time point;
[0076] Acquire all associated systems associated with the test system, and acquire the generation time of each associated system as a second time point;
[0077] Determine the associated system corresponding to the second time point closest to the first time point as the historical system;
[0078] Obtaining a test log of the historical system;
[0079] Extracting a data storage path from the test log;
[0080] The playback record is obtained from the data storage path according to the system code of the historical system.
[0081] The first time point refers to the time point when the development of the test system is completed.
[0082] The system version of each associated system is smaller than the system version of the test system, that is, the system version of the test system is an upgraded version of each associated system. For example, if the system version of the test system is V3, then all associated systems include associated systems corresponding to version V1 and associated systems corresponding to version V2.
[0083] The second time point refers to the time point when the development of each associated system is completed.
[0084] The test log records the test events of the historical system. Specifically, the test log can be obtained from the log library of the historical system.
[0085] The data storage path stores playback information of multiple systems.
[0086] The system code refers to a number that can uniquely identify the historical system.
[0087] The historical system can be accurately determined through the first time point and the second time point, and then the playback record can be accurately obtained based on the historical system, avoiding a large gap between the historical system and the test system that leads to a large adjustment of the operating results, thereby improving the efficiency of generating the benchmark results, thereby improving the efficiency of generating the test results.
[0088] S12, comparing the historical script of the historical system with the test script of the test system to obtain a new module of the test system.
[0089] In at least one embodiment of the present invention, the newly added module refers to a function point newly added in the test system based on the historical system.
[0090] In at least one embodiment of the present invention, the electronic device compares the historical script of the historical system with the test script of the test system to obtain the newly added module of the test system, including:
[0091] Convert the history script into a history syntax tree, and convert the test script into a test syntax tree;
[0092] Compare the historical syntax tree with the test syntax tree to obtain a new script;
[0093] The function point corresponding to the newly added script is determined as the newly added module.
[0094] The historical syntax tree refers to the tree representation of the historical script on the abstract syntax structure, and each node of the historical syntax tree represents a structure of the historical script. The test syntax tree refers to the tree representation of the test script on the abstract syntax structure, and each node of the test syntax tree represents a structure of the test script.
[0095] The newly added script refers to code information that exists in the test script but does not exist in the historical script.
[0096] By converting the historical script and the test script, the historical script and the test script can be compared from a macro perspective, thereby improving the efficiency of determining the new script and quickly determining the new module.
[0097] S13, adjusting the operating result according to the newly added module to obtain a benchmark result.
[0098] In at least one embodiment of the present invention, the benchmark result refers to a result obtained after adjusting the operating result of the historical system according to the newly added module, and the benchmark result is used to compare with the response result of the test system.
[0099] In at least one embodiment of the present invention, the electronic device adjusts the operation result according to the newly added module to obtain the benchmark result, which includes:
[0100] Obtaining module rules in the newly added module;
[0101] Performing semantic analysis on the module rules to obtain semantic information;
[0102] Matching the semantic information with the historical fields in the historical system, and determining the historical fields that successfully match the semantic information as adjustment fields;
[0103] Filtering the results to be processed from the operation results according to the adjustment fields;
[0104] The to-be-processed result is adjusted according to the module rule to obtain a control result, and the to-be-processed result in the operation result is replaced based on the control result to obtain the benchmark result.
[0105] The module rule refers to the specific function information implemented by the newly added module. The module rule can be a rule set by demand, for example, the module rule can be a 20 yuan discount for every 100 yuan of consumption.
[0106] The semantic information is used to represent the semantics of the module rule.
[0107] The adjustment field refers to the historical field having the highest similarity to the semantic information.
[0108] The result to be processed refers to the operation result corresponding to the adjustment field.
[0109] For example, the module rule is: a discount of 20 yuan for every 100 yuan spent. After screening, the pending result is: a total consumption of 350 yuan, and the benchmark result is: a total consumption of 290 yuan.
[0110] The adjustment field can be accurately matched through the semantic information corresponding to the module rule, and then the result to be processed is screened out according to the adjustment field for adjustment, so that accurate benchmark results can be generated, thereby improving the test accuracy of the test system.
[0111] S14, replaying the historical data stream based on the test system to obtain a response result of the test system.
[0112] In at least one embodiment of the present invention, the response result refers to a result generated by the test system executing the historical data flow.
[0113] In at least one embodiment of the present invention, the electronic device replays the historical data stream based on the test system to obtain a response result of the test system, including:
[0114] Identifying a data type of the historical data stream;
[0115] Calling a traffic playback module according to the data type;
[0116] The historical data flow is replayed in the test system based on the traffic replay module to obtain the response result.
[0117] Among them, the traffic playback module refers to a player corresponding to the data type.
[0118] By calling the traffic playback module to play back the historical data stream through the data type, it is possible to ensure that a suitable traffic playback module is used to play the historical data stream, thereby improving the smoothness of generating the response result.
[0119] S15, extracting a target result from the response result according to the operation field corresponding to the benchmark result.
[0120] In at least one embodiment of the present invention, the running field refers to a field included in the historical system.
[0121] The target result refers to the response result corresponding to the running field except the preset field. Among them, the preset field refers to a field that is irrelevant to the business scenario, such as a timestamp.
[0122] In at least one embodiment of the present invention, the electronic device extracting the target result from the response result according to the operation field corresponding to the reference result includes:
[0123] Filtering the result corresponding to the operation field from the response results as the initial result;
[0124] The results corresponding to the preset fields are removed from the initial results as the target results.
[0125] The operation field refers to the field included in the historical system.
[0126] The initial result refers to a response result corresponding to the operation field.
[0127] The preset fields refer to fields that are irrelevant to business scenarios, such as timestamp and IP address (Internet Protocol Address).
[0128] By filtering out the initial result from the response result through the running field, it is possible to avoid the test failure of the test system due to the fact that the historical system does not contain the newly added field of the test system, thereby improving the test accuracy of the test system.
[0129] S16, merging the target results to obtain the results to be analyzed and the result types of the results to be analyzed.
[0130] In at least one embodiment of the present invention, each type of the results to be analyzed includes target results of the same format type. The result type is the format type, for example, the result type can be an integer type, a character type, and the like.
[0131] In at least one embodiment of the present invention, the electronic device performs merging processing on the target results to obtain the results to be analyzed and the result types of the results to be analyzed include:
[0132] identifying a format type of the target result;
[0133] The target results of the same format type are merged to obtain the result to be analyzed, and the format type is determined as the result type.
[0134] The target results can be quickly merged through the format type, thereby improving the generation efficiency of the results to be analyzed and the result types.
[0135] S17, comparing the result to be analyzed with the benchmark result according to the result type to generate a test result.
[0136] In at least one embodiment of the present invention, the test result refers to a flow test result of the test system.
[0137] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned traffic test results, the above-mentioned traffic test results can also be stored in a blockchain node.
[0138] In at least one embodiment of the present invention, the electronic device compares the result to be analyzed with the reference result according to the result type to generate a test result, including:
[0139] Counting the number of the result types as the number of types;
[0140] Obtain idle threads whose number of threads is equal to the number of the type as running threads;
[0141] Calling the running thread according to the result type to concurrently compare the result to be analyzed with the benchmark result;
[0142] If the result to be analyzed is consistent with the reference result, the test result is determined as a success of the test system test; or
[0143] If the result to be analyzed is inconsistent with the reference result, the test result is determined as a test failure of the test system.
[0144] The consistency between the result to be analyzed and the benchmark result means that the characters included in the result to be analyzed are the same as the characters included in the benchmark result. The inconsistency between the result to be analyzed and the benchmark result means that the characters in the result to be analyzed are different from the corresponding characters in the benchmark result.
[0145] By concurrently comparing the result to be analyzed with the benchmark result through the running thread, the efficiency of generating the test result can be improved.
[0146] In this embodiment, the electronic device calls the running thread according to the result type to compare the result to be analyzed with the benchmark result concurrently. Specifically, the electronic device uses the same running thread to compare the result to be analyzed with the benchmark result of the same result type.
[0147] By comparing the result to be analyzed of the same result type with the benchmark result through the same running thread, the comparison efficiency can be improved because the running thread does not need to convert the types of the result to be analyzed and the benchmark result.
[0148] It can be seen from the above technical scheme that the present invention obtains the playback record of the historical system according to the test request. Since the playback record refers to the data generated when the historical system is tested, there is no need to record the historical system when the test system is tested, thereby improving the test efficiency of the test system. By comparing the historical script with the test script, the new module can be accurately determined, and then the operation result can be adjusted according to the new module, which can avoid the impact of the new module on the test system and cause the test result to be inaccurate, thereby improving the test accuracy of the test system. By extracting the target result, since there is no need to compare and analyze all the response results, not only the test efficiency can be improved, but also the impact of field information irrelevant to the business scenario on the test result can be avoided, thereby improving the accuracy of the test result. By merging the target results, the target results of the same type can be merged to reduce the number of the results to be analyzed, thereby improving the generation efficiency of the test results.
[0149] like Figure 2 As shown, it is a functional module diagram of a preferred embodiment of the system test device of the present invention. The system test device 11 includes a receiving unit 110, an acquisition unit 111, a comparison unit 112, an adjustment unit 113, a playback unit 114, an extraction unit 115, a merging unit 116 and a generation unit 117. The module / unit referred to in the present invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can complete a fixed function, which is stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0150] The receiving unit 110 receives a test request for the test system.
[0151] In at least one embodiment of the present invention, the test system refers to a system that requires flow testing.
[0152] The information carried in the test request includes, but is not limited to: the generation time of the test system, etc. The test request can be triggered and generated by any terminal.
[0153] The acquisition unit 111 acquires the playback record of the historical system according to the test request, wherein the playback record includes the historical data stream and the operation result of the historical data stream, and the test system is an upgraded system of the historical system.
[0154] In at least one embodiment of the present invention, the historical system refers to an associated system that is closest to the generation time of the test system, and the associated system refers to a system that has an associated relationship with the test system.
[0155] The historical data flow refers to traffic data, and the operation result refers to the execution result of the historical system on the traffic data.
[0156] In at least one embodiment of the present invention, the acquiring unit 111 acquires the playback record of the history system according to the test request, including:
[0157] Parsing the generation time of the test system from the test request as a first time point;
[0158] Acquire all associated systems associated with the test system, and acquire the generation time of each associated system as a second time point;
[0159] Determine the associated system corresponding to the second time point closest to the first time point as the historical system;
[0160] Obtaining a test log of the historical system;
[0161] Extracting a data storage path from the test log;
[0162] The playback record is obtained from the data storage path according to the system code of the historical system.
[0163] The first time point refers to the time point when the development of the test system is completed.
[0164] The system version of each associated system is smaller than the system version of the test system, that is, the system version of the test system is an upgraded version of each associated system. For example, if the system version of the test system is V3, then all associated systems include associated systems corresponding to version V1 and associated systems corresponding to version V2.
[0165] The second time point refers to the time point when the development of each associated system is completed.
[0166] The test log records the test events of the historical system. Specifically, the test log can be obtained from the log library of the historical system.
[0167] The data storage path stores playback information of multiple systems.
[0168] The system code refers to a number that can uniquely identify the historical system.
[0169] The historical system can be accurately determined through the first time point and the second time point, and then the playback record can be accurately obtained based on the historical system, avoiding a large gap between the historical system and the test system that leads to a large adjustment of the operating results, thereby improving the efficiency of generating the benchmark results, thereby improving the efficiency of generating the test results.
[0170] The comparison unit 112 compares the historical script of the historical system with the test script of the test system to obtain a newly added module of the test system.
[0171] In at least one embodiment of the present invention, the newly added module refers to a function point newly added in the test system based on the historical system.
[0172] In at least one embodiment of the present invention, the comparing unit 112 compares the historical script of the historical system with the test script of the test system to obtain the newly added module of the test system, including:
[0173] Convert the history script into a history syntax tree, and convert the test script into a test syntax tree;
[0174] Compare the historical syntax tree with the test syntax tree to obtain a new script;
[0175] The function point corresponding to the newly added script is determined as the newly added module.
[0176] The historical syntax tree refers to the tree representation of the historical script on the abstract syntax structure, and each node of the historical syntax tree represents a structure of the historical script. The test syntax tree refers to the tree representation of the test script on the abstract syntax structure, and each node of the test syntax tree represents a structure of the test script.
[0177] The newly added script refers to code information that exists in the test script but does not exist in the historical script.
[0178] By converting the historical script and the test script, the historical script and the test script can be compared from a macro perspective, thereby improving the efficiency of determining the new script and quickly determining the new module.
[0179] The adjustment unit 113 adjusts the operation result according to the newly added module to obtain a benchmark result.
[0180] In at least one embodiment of the present invention, the benchmark result refers to a result obtained after adjusting the operating result of the historical system according to the newly added module, and the benchmark result is used to compare with the response result of the test system.
[0181] In at least one embodiment of the present invention, the adjusting unit 113 adjusts the running result according to the newly added module, and the benchmark result includes:
[0182] Obtaining module rules in the newly added module;
[0183] Performing semantic analysis on the module rules to obtain semantic information;
[0184] Matching the semantic information with the historical fields in the historical system, and determining the historical fields that successfully match the semantic information as adjustment fields;
[0185] Filtering the results to be processed from the operation results according to the adjustment fields;
[0186] The to-be-processed result is adjusted according to the module rule to obtain a control result, and the to-be-processed result in the operation result is replaced based on the control result to obtain the benchmark result.
[0187] The module rule refers to the specific function information implemented by the newly added module. The module rule can be a rule set by demand, for example, the module rule can be a 20 yuan discount for every 100 yuan of consumption.
[0188] The semantic information is used to represent the semantics of the module rule.
[0189] The adjustment field refers to the historical field having the highest similarity to the semantic information.
[0190] The result to be processed refers to the operation result corresponding to the adjustment field.
[0191] For example, the module rule is: a discount of 20 yuan for every 100 yuan spent. After screening, the pending result is: a total consumption of 350 yuan, and the benchmark result is: a total consumption of 290 yuan.
[0192] The adjustment field can be accurately matched through the semantic information corresponding to the module rule, and then the result to be processed is screened out according to the adjustment field for adjustment, so that accurate benchmark results can be generated, thereby improving the test accuracy of the test system.
[0193] The playback unit 114 plays back the historical data stream based on the test system to obtain a response result of the test system.
[0194] In at least one embodiment of the present invention, the response result refers to a result generated by the test system executing the historical data flow.
[0195] In at least one embodiment of the present invention, the playback unit 114 plays back the historical data stream based on the test system to obtain a response result of the test system, including:
[0196] Identifying a data type of the historical data stream;
[0197] Calling a traffic playback module according to the data type;
[0198] The historical data flow is replayed in the test system based on the traffic replay module to obtain the response result.
[0199] Among them, the traffic playback module refers to a player corresponding to the data type.
[0200] By calling the traffic playback module to play back the historical data stream through the data type, it is possible to ensure that a suitable traffic playback module is used to play the historical data stream, thereby improving the smoothness of generating the response result.
[0201] The extraction unit 115 extracts the target result from the response result according to the operation field corresponding to the reference result.
[0202] In at least one embodiment of the present invention, the running field refers to a field included in the historical system.
[0203] The target result refers to the response result corresponding to the running field except the preset field. Among them, the preset field refers to a field that is irrelevant to the business scenario, such as a timestamp.
[0204] In at least one embodiment of the present invention, the extracting unit 115 extracts the target result from the response result according to the operation field corresponding to the benchmark result, including:
[0205] Filtering the result corresponding to the operation field from the response results as the initial result;
[0206] The results corresponding to the preset fields are removed from the initial results as the target results.
[0207] The operation field refers to the field included in the historical system.
[0208] The initial result refers to a response result corresponding to the operation field.
[0209] The preset fields refer to fields that are irrelevant to business scenarios, such as timestamp and IP address (Internet Protocol Address).
[0210] By filtering out the initial result from the response result through the running field, it is possible to avoid the test failure of the test system due to the fact that the historical system does not contain the newly added field of the test system, thereby improving the test accuracy of the test system.
[0211] The merging unit 116 performs merging processing on the target results to obtain the results to be analyzed and the result types of the results to be analyzed.
[0212] In at least one embodiment of the present invention, each type of the results to be analyzed includes target results of the same format type. The result type is the format type, for example, the result type can be an integer type, a character type, and the like.
[0213] In at least one embodiment of the present invention, the merging unit 116 performs merging processing on the target results to obtain the results to be analyzed and the result types of the results to be analyzed include:
[0214] identifying a format type of the target result;
[0215] The target results of the same format type are merged to obtain the result to be analyzed, and the format type is determined as the result type.
[0216] The target results can be quickly merged through the format type, thereby improving the generation efficiency of the results to be analyzed and the result types.
[0217] The generating unit 117 compares the result to be analyzed with the benchmark result according to the result type to generate a test result.
[0218] In at least one embodiment of the present invention, the test result refers to a flow test result of the test system.
[0219] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned traffic test results, the above-mentioned traffic test results can also be stored in a blockchain node.
[0220] In at least one embodiment of the present invention, the generating unit 117 compares the result to be analyzed with the benchmark result according to the result type, and generating the test result includes:
[0221] Counting the number of the result types as the number of types;
[0222] Obtain idle threads whose number of threads is equal to the number of the type as running threads;
[0223] Calling the running thread according to the result type to concurrently compare the result to be analyzed with the benchmark result;
[0224] If the result to be analyzed is consistent with the reference result, the test result is determined as a success of the test system test; or
[0225] If the result to be analyzed is inconsistent with the reference result, the test result is determined as a test failure of the test system.
[0226] The consistency between the result to be analyzed and the benchmark result means that the characters included in the result to be analyzed are the same as the characters included in the benchmark result. The inconsistency between the result to be analyzed and the benchmark result means that the characters in the result to be analyzed are different from the corresponding characters in the benchmark result.
[0227] By concurrently comparing the result to be analyzed with the benchmark result through the running thread, the efficiency of generating the test result can be improved.
[0228] In this embodiment, the generating unit 117 calls the running thread according to the result type to compare the result to be analyzed with the benchmark result concurrently. Specifically, the generating unit 117 uses the same running thread to compare the result to be analyzed with the benchmark result of the same result type.
[0229] By comparing the result to be analyzed of the same result type with the benchmark result through the same running thread, the comparison efficiency can be improved because the running thread does not need to convert the types of the result to be analyzed and the benchmark result.
[0230] It can be seen from the above technical scheme that the present invention obtains the playback record of the historical system according to the test request. Since the playback record refers to the data generated when the historical system is tested, there is no need to record the historical system when the test system is tested, thereby improving the test efficiency of the test system. By comparing the historical script with the test script, the new module can be accurately determined, and then the operation result can be adjusted according to the new module, which can avoid the impact of the new module on the test system and cause the test result to be inaccurate, thereby improving the test accuracy of the test system. By extracting the target result, since there is no need to compare and analyze all the response results, not only the test efficiency can be improved, but also the impact of field information irrelevant to the business scenario on the test result can be avoided, thereby improving the accuracy of the test result. By merging the target results, the target results of the same type can be merged to reduce the number of the results to be analyzed, thereby improving the generation efficiency of the test results.
[0231] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device of a preferred embodiment of the system testing method of the present invention.
[0232] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a system test program.
[0233] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.
[0234] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect various parts of the entire electronic device 1, and executes the operating system of the electronic device 1 and various installed applications, program codes, etc.
[0235] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into a receiving unit 110, an acquisition unit 111, a comparison unit 112, an adjustment unit 113, a playback unit 114, an extraction unit 115, a merging unit 116, and a generation unit 117.
[0236] The memory 12 can be used to store the computer-readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0237] The memory 12 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0238] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.
[0239] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0240] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0241] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a system testing method, and the processor 13 can execute the computer-readable instructions to implement:
[0242] receiving a test request for a test system;
[0243] Acquire a playback record of the historical system according to the test request, wherein the playback record includes a historical data stream and an operation result of the historical data stream, and the test system is an upgrade system of the historical system;
[0244] Comparing the historical script of the historical system with the test script of the test system to obtain a new module of the test system;
[0245] Adjust the operating result according to the newly added module to obtain a benchmark result;
[0246] Replaying the historical data stream based on the test system to obtain a response result of the test system;
[0247] Extracting a target result from the response result according to the operation field corresponding to the benchmark result;
[0248] The target results are merged to obtain the results to be analyzed and the result types of the results to be analyzed;
[0249] The result to be analyzed is compared with the benchmark result according to the result type to generate a test result.
[0250] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0251] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0252] The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
[0253] receiving a test request for a test system;
[0254] Acquire a playback record of the historical system according to the test request, wherein the playback record includes a historical data stream and an operation result of the historical data stream, and the test system is an upgrade system of the historical system;
[0255] Comparing the historical script of the historical system with the test script of the test system to obtain a new module of the test system;
[0256] Adjust the operating result according to the newly added module to obtain a benchmark result;
[0257] Replaying the historical data stream based on the test system to obtain a response result of the test system;
[0258] Extracting a target result from the response result according to the operation field corresponding to the benchmark result;
[0259] The target results are merged to obtain the results to be analyzed and the result types of the results to be analyzed;
[0260] The result to be analyzed is compared with the benchmark result according to the result type to generate a test result.
[0261] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0262] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0263] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0264] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices mentioned can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0265] 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 spirit and scope of the technical solution of the present invention.
Claims
1. A system testing method, characterized in that: The system testing method comprises: receiving a test request for a test system; Obtaining the playback record of the historical system according to the test request, including: parsing the generation time of the test system from the test request as the first time point; obtaining all associated systems associated with the test system, and obtaining the generation time of each associated system as the second time point; determining the associated system corresponding to the second time point closest to the first time point as the historical system; obtaining the test log of the historical system; extracting the data storage path from the test log; obtaining the playback record from the data storage path according to the system code of the historical system, the playback record including the historical data stream and the running result of the historical data stream, and the test system is an upgraded system of the historical system; Comparing the historical script of the historical system with the test script of the test system to obtain a new module of the test system; Adjusting the operation result according to the newly added module to obtain a benchmark result includes: acquiring module rules in the newly added module; performing semantic analysis on the module rules to obtain semantic information; matching the semantic information with historical fields in the historical system, and determining the historical fields that successfully match the semantic information as adjustment fields; filtering out the results to be processed from the operation result according to the adjustment fields; adjusting the results to be processed according to the module rules to obtain a control result, and replacing the results to be processed in the operation result based on the control result to obtain the benchmark result; Replaying the historical data stream based on the test system to obtain a response result of the test system includes: identifying a data type of the historical data stream; calling a traffic replay module according to the data type; replaying the historical data stream in the test system based on the traffic replay module to obtain the response result; Extracting a target result from the response result according to the operation field corresponding to the benchmark result; The target results are merged to obtain the results to be analyzed and the result types of the results to be analyzed; The result to be analyzed is compared with the benchmark result according to the result type to generate a test result, including: counting the number of result types as the type number; obtaining idle threads whose number of threads is equal to the type number as running threads; calling the running thread according to the result type and concurrently comparing the result to be analyzed with the benchmark result; if the result to be analyzed is consistent with the benchmark result, determining the test result as a success of the test system test; or if the result to be analyzed is inconsistent with the benchmark result, determining the test result as a failure of the test system test.
2. The system testing method according to claim 1, characterized in that: The comparing the historical script of the historical system with the test script of the test system to obtain the newly added module of the test system comprises: Convert the history script into a history syntax tree, and convert the test script into a test syntax tree; Compare the historical syntax tree with the test syntax tree to obtain a new script; The function point corresponding to the newly added script is determined as the newly added module.
3. The system testing method according to claim 1, characterized in that: The extracting the target result from the response result according to the operation field corresponding to the benchmark result includes: Filtering the result corresponding to the operation field from the response results as the initial result; The results corresponding to the preset fields are removed from the initial results as the target results.
4. A system testing device, characterized in that: The system testing device comprises: A receiving unit, used for receiving a test request for the test system; An acquisition unit is used to acquire a playback record of a historical system according to the test request, including: parsing the generation time of the test system from the test request as a first time point; acquiring all associated systems associated with the test system, and acquiring the generation time of each associated system as a second time point; determining the associated system corresponding to the second time point closest to the first time point as the historical system; acquiring a test log of the historical system; extracting a data storage path from the test log; acquiring the playback record from the data storage path according to the system code of the historical system, the playback record including a historical data stream and an operation result of the historical data stream, and the test system is an upgraded system of the historical system; A comparison unit, used for comparing the historical script of the historical system with the test script of the test system to obtain a newly added module of the test system; An adjustment unit, used for adjusting the operation result according to the newly added module to obtain a benchmark result, including: obtaining module rules in the newly added module; performing semantic analysis on the module rules to obtain semantic information; matching the semantic information with historical fields in the historical system, and determining the historical fields that successfully match the semantic information as adjustment fields; filtering out the results to be processed from the operation result according to the adjustment fields; adjusting the results to be processed according to the module rules to obtain a control result, and replacing the results to be processed in the operation result based on the control result to obtain the benchmark result; A playback unit, used to play back the historical data stream based on the test system to obtain a response result of the test system, including: identifying a data type of the historical data stream; calling a traffic playback module according to the data type; playing back the historical data stream in the test system based on the traffic playback module to obtain the response result; An extraction unit, configured to extract a target result from the response result according to an operation field corresponding to the benchmark result; A merging unit, used to merge the target results to obtain the results to be analyzed and the result types of the results to be analyzed; A generating unit is used to compare the result to be analyzed with the benchmark result according to the result type to generate a test result, including: counting the number of the result types as the type number; obtaining idle threads whose thread number is equal to the type number as running threads; calling the running threads according to the result type and concurrently comparing the result to be analyzed with the benchmark result; if the result to be analyzed is consistent with the benchmark result, determining the test result as a success of the test system test; or if the result to be analyzed is inconsistent with the benchmark result, determining the test result as a failure of the test system test.
5. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes the computer-readable instructions stored in the memory to implement the system testing method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the system testing method according to any one of claims 1 to 3.
