Test method, device, electronic device and storage medium

By receiving the test identification in the test instructions, obtaining and verifying the test cases, and generating accurate test results, it solves the problem of difficult testing of distributed storage systems, realizes an efficient and accurate test process, and reduces costs and coupling.

CN114328231BActive Publication Date: 2024-10-22INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111638924.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2024-10-22
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

Under the current technology, it is difficult to test distributed storage systems, resulting in high costs in manpower, financial resources, material resources, and time, and the test results are prone to errors.

Method used

By receiving the test identification in the test instructions, the test cases are obtained and verified, and accurate test results are generated to avoid manual creation of false data and improve test efficiency and accuracy.

Benefits of technology

It saves human, financial and material costs, improves the efficiency and accuracy of distributed system testing, reduces the coupling between modules, and facilitates independent maintenance and debugging of each module.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328231B_ABST
    Figure CN114328231B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer science, and specifically to testing methods, devices, electronic devices and storage media. The method comprises: receiving a test instruction, the test instruction comprising a test identifier; obtaining a test case corresponding to the test identifier according to the test identifier; testing the test case to generate a test result. The above method can obtain the test case corresponding to the test identifier according to the test identifier, thereby eliminating the need for manual intervention to create false data for debugging, thereby saving a large amount of manpower, financial resources, material resources and time costs, saving resources, and improving the efficiency of testing distributed systems. In addition, the entire testing method relatively completely integrates the test process development and test requirements of the test model in the storage system, providing a complete test docking system, which is convenient for the development of collaborative concurrent work between modules, improves development efficiency, and is also conducive to the advancement of testing work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer science, and in particular to a testing method, a device, an electronic device and a storage medium. Background Art

[0002] With the development of computer science, a large amount of data needs to be processed and stored. Therefore, distributed storage systems are booming. In order to ensure the stability of distributed storage systems, it is necessary to test distributed storage systems. However, due to the existence of distributed characteristics and the need for the test system to integrate large-scale data and complex and redundant test data simulation, the verification of the Application Programming Interface (API) requires a lot of development and large-scale test code writing. This involves a large amount of redundant data simulation and verification data simulation code, such as test verification code for data attribute values, method parameter values, method values, return values, and constraints.

[0003] Under the existing technology, the test verification method focuses on manual intervention to create false data for debugging, or using specific scenario data to develop test cases for maintenance testing. It is very difficult to test the distributed storage system, resulting in manpower occupation, high development and testing costs, or time waiting problems caused by blocking of the previous process in the serial process, which is a serious waste of manpower, financial resources, material resources and time costs.

[0004] Therefore, a testing method, an apparatus, an electronic device and a storage medium are needed to overcome the above-mentioned defects. Summary of the invention

[0005] In view of this, embodiments of the present invention provide a testing method, an apparatus, an electronic device, and a storage medium to solve the problem of difficulty in testing a distributed storage system in the prior art.

[0006] According to a first aspect, an embodiment of the present invention provides a testing method, the method comprising:

[0007] receiving a test instruction, the test instruction including a test identifier;

[0008] According to the test identifier, obtain the test case corresponding to the test identifier;

[0009] Test the test cases and generate test results.

[0010] The test method provided in the embodiment of the present application receives a test instruction, and the test instruction includes a test identifier, so that the electronic device can obtain the test case corresponding to the test identifier according to the test identifier, thereby ensuring the accuracy of the obtained test case. Then, the test case is tested to generate a test result, thereby ensuring the accuracy of the generated test result. It is avoided that a function needs to be tested, but the test case corresponding to another function is used, thereby causing an error in the test result. In addition, the above method can obtain the test case corresponding to the test identifier according to the test identifier, so that there is no need for manual intervention to create false data for debugging, thereby saving a lot of manpower, financial resources, material resources and time costs, and saving resources, and improving the efficiency of testing distributed systems. In addition, the entire test method relatively completely integrates the test process development and test requirements of the test model in the storage system, provides a complete test docking system, facilitates the development of collaborative concurrent work between modules, improves development efficiency, and is also conducive to the advancement of testing work; at the same time, the coupling between modules is low, which is convenient for each module to be independently maintained and debugged, reducing labor costs and operational difficulty.

[0011] According to the first aspect, in a first implementation of the first aspect of the present invention, testing a test case and generating a test result includes:

[0012] Parse and verify the data in the test case;

[0013] Generate test results based on the parsing verification results.

[0014] The test method provided in the embodiment of the present application performs parsing and verification on the data in the test case, thereby ensuring the accuracy of the parsing and verification results. Then, the test results are generated based on the parsing and verification results, thereby ensuring the accuracy of the generated test results.

[0015] According to the first implementation of the first aspect, in the second implementation of the first aspect of the present invention, parsing and verifying the data in the test case includes:

[0016] Obtain the test data dependency set and the test data constraint verification set in the test case;

[0017] According to the test data constraint verification set, the data in the test data dependency set is parsed and verified.

[0018] The test method provided in the embodiment of the present application obtains the test data dependency set and the test data constraint verification set in the test case, and parses and verifies the data in the test data dependency set according to the test data constraint verification set, thereby ensuring the accuracy of the verification of the data in the test data dependency set.

[0019] According to the first implementation of the first aspect, in the third implementation of the first aspect of the present invention, generating a test result according to the parsing verification result includes:

[0020] Get the document description result set template in the test case;

[0021] Generate test case execution results based on parsing and verification results;

[0022] Fill the execution results into the document description result set template to generate the test results.

[0023] The test method provided in the embodiment of the present application obtains a document description result set template in a test case; generates a test case execution result based on the parsing verification result; fills the execution result into the document description result set template to generate a test result, thereby ensuring that the generated test result is more intuitive and easy for users to obtain, thereby improving the efficiency of testing the distributed storage system.

[0024] According to any one of the first aspect to the third embodiment, in a fourth embodiment of the first aspect of the present invention, obtaining a test case corresponding to the test identifier includes:

[0025] receiving a test case generation instruction, wherein the test case generation instruction includes a test identifier;

[0026] Generate instructions based on test cases and obtain benchmark data;

[0027] According to the test identification, the benchmark data is debugged and processed to generate test cases.

[0028] The test method provided in the embodiment of the present application receives a test case generation instruction, and the test case generation instruction includes a test identifier; according to the test case generation instruction, the benchmark data is obtained to ensure the accuracy of the obtained benchmark data. Then, according to the test identifier, the benchmark data is debugged and processed to generate a test case. Thereby, the accuracy of the generated test case can be guaranteed. In the above method, in the process of generating test cases, there is no need for manual intervention to create false data for debugging, thus saving a lot of manpower, financial resources, material resources and time costs, saving resources, and improving the efficiency of testing distributed systems. In addition, the process of generating test cases more completely integrates the test process development and test requirements of the test model in the storage system, improves development efficiency, and is also conducive to the advancement of testing work; at the same time, the coupling between modules is low, which is convenient for each module to be independently maintained and debugged, reducing labor costs and operational difficulty.

[0029] According to the fourth implementation of the first aspect, in the fifth implementation of the first aspect of the present invention, debugging is performed on the benchmark data according to the test identifier to generate a test case, including:

[0030] According to the configuration definition corresponding to the test identifier, the benchmark data is deserialized into strings to generate a test data dependency set;

[0031] According to the verification data parameter constraint list corresponding to the test identifier, a test data constraint verification set is formed;

[0032] Generate a document describing the result set template based on the test execution steps, process, and results;

[0033] Generate test cases based on the test data dependency set, test data constraint verification set and document description result set template.

[0034] The testing method provided in the embodiment of the present application ensures the accuracy of the generated test data dependency set, test data constraint verification set and document description result set template, thereby ensuring the accuracy of the test cases generated based on the test data dependency set, test data constraint verification set and document description result set template.

[0035] According to the fourth implementation of the first aspect, in the sixth implementation of the first aspect of the present invention, generating instructions according to test cases and obtaining benchmark data include:

[0036] Generate instructions based on test cases and obtain test data;

[0037] According to the preset format and data form configuration, the test data is processed to generate benchmark data.

[0038] The test method provided in the embodiment of the present application generates instructions according to the test case and obtains test data; processes the test data according to the preset format and data form configuration to generate benchmark data, thereby ensuring the accuracy of the generated benchmark data.

[0039] According to a second aspect, an embodiment of the present invention provides a testing device, the device comprising:

[0040] A receiving module, used for receiving a test instruction, wherein the test instruction includes a test identifier;

[0041] An acquisition module is used to acquire the test case corresponding to the test identifier according to the test identifier;

[0042] The test module is used to test the test cases and generate test results.

[0043] The test device provided in the embodiment of the present application receives a test instruction, and the test instruction includes a test identifier, so that the electronic device can obtain the test case corresponding to the test identifier according to the test identifier, thereby ensuring the accuracy of the obtained test case. Then, the test case is tested to generate a test result, thereby ensuring the accuracy of the generated test result. It is avoided that a test case corresponding to another function is used to test a function, thereby causing an error in the test result. In addition, the above-mentioned device can obtain the test case corresponding to the test identifier according to the test identifier, so that there is no need for manual intervention to create false data for debugging, thereby saving a lot of manpower, financial resources, material resources and time costs, and saving resources, and improving the efficiency of testing distributed systems. In addition, the entire test method relatively completely integrates the test process development and test requirements of the test model in the storage system, provides a complete test docking system, facilitates the development of collaborative concurrent work between modules, improves development efficiency, and is also conducive to the advancement of testing work; at the same time, the coupling between modules is low, which is convenient for each module to be independently maintained and debugged, reducing labor costs and operational difficulty.

[0044] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the test method in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.

[0045] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the test method in the first aspect or any one of the embodiments of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 is a flow chart of the test method provided by the embodiment of the present invention;

[0048] Figure 2 is a flow chart of a testing method provided by another embodiment of the present invention;

[0049] Figure 3 is a flow chart of a testing method provided by another embodiment of the present invention;

[0050] Figure 4 is a flow chart of a testing method provided by another embodiment of the present invention;

[0051] Figure 5 It is a schematic diagram of the overall framework of the test method provided by the embodiment of the present invention;

[0052] Figure 6 is a schematic diagram of a test model method provided by an embodiment of the present invention;

[0053] Figure 7 It is a schematic diagram of the data interaction sequence of the test method provided by the embodiment of the present invention;

[0054] Figure 8 It is a functional module diagram of a test device provided by an embodiment of the present invention;

[0055] Fig. 9 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0058] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0059] In the description of the present invention, it should be noted that the term "and / and / or" used in the present specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0060] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0062] It should be noted that the test method provided in the embodiment of the present application, its execution subject can be a test device, and the test device can be implemented as part or all of an electronic device through software, hardware, or a combination of software and hardware, wherein the electronic device can be a server or a terminal, wherein the server in the embodiment of the present application can be a single server or a server cluster composed of multiple servers, and the terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, a wearable device, and other intelligent hardware devices such as an intelligent robot. In the following method embodiments, the execution subject is an electronic device as an example for explanation.

[0063] In one embodiment of the present application, Figure 1 As shown, a testing method is provided, which is described by taking the application of the method to an electronic device as an example, and includes the following steps:

[0064] S11. Receive test instructions.

[0065] The test instruction includes a test identifier. The test identifier may be an MCC (Message Command Code). The message command code is an identifier for the business system message subscription and delivery in the storage system. Each business operation or command line mode corresponds to a command code. The test identifier may also be other identification information.

[0066] Specifically, the electronic device may receive a test instruction issued by a user based on a client or a UI (User Interface). The test instruction may be used to instruct the electronic device to import a test case corresponding to the test identifier and perform a test on the test case.

[0067] It should be noted that the electronic device may be a device in a distributed storage system, and the distributed storage system may also be installed in the electronic device.

[0068] S12. According to the test identifier, obtain a test case corresponding to the test identifier.

[0069] In an optional implementation, the electronic device may search for a test case corresponding to the test identifier from a test case database according to the test identifier, thereby acquiring the test case corresponding to the test identifier.

[0070] In another optional implementation, the electronic device may also receive, through the external interface, a test case corresponding to a test identifier input by the user based on the external interface.

[0071] Among them, the external interface can provide interface services to the outside, and the external interface can be a REST API interface or provide a CLI interface to the cluster downward. The embodiment of the present application does not specifically limit the form of the external interface. The external interface can facilitate R&D personnel to dock and debug test cases in electronic devices, which is beneficial to testers, and debugging operations can be completed through an intuitive operation interface.

[0072] In another optional implementation, the electronic device may obtain test data corresponding to the test identifier according to the test identifier, and then process the test data to generate a test case corresponding to the test identifier.

[0073] The embodiment of the present application does not specifically limit the manner in which the electronic device obtains the test case corresponding to the test identifier.

[0074] This step will be described in detail below.

[0075] S13. Test the test case and generate test results.

[0076] Specifically, the electronic device can parse and verify the data in the test case to generate a test result.

[0077] This step will be described in detail below.

[0078] The test method provided in the embodiment of the present application receives a test instruction, and the test instruction includes a test identifier, so that the electronic device can obtain the test case corresponding to the test identifier according to the test identifier, thereby ensuring the accuracy of the obtained test case. Then, the test case is tested to generate a test result, thereby ensuring the accuracy of the generated test result. It is avoided that a function needs to be tested, but the test case corresponding to another function is used, thereby causing an error in the test result. In addition, the above method can obtain the test case corresponding to the test identifier according to the test identifier, so that there is no need for manual intervention to create false data for debugging, thereby saving a lot of manpower, financial resources, material resources and time costs, and saving resources, and improving the efficiency of testing distributed systems. In addition, the entire test method relatively completely integrates the test process development and test requirements of the test model in the storage system, provides a complete test docking system, facilitates the development of collaborative concurrent work between modules, improves development efficiency, and is also conducive to the advancement of testing work; at the same time, the coupling between modules is low, which is convenient for each module to be independently maintained and debugged, reducing labor costs and operational difficulty.

[0079] In one embodiment of the present application, Figure 2 As shown, a testing method is provided, which is described by taking the application of the method to an electronic device as an example, and includes the following steps:

[0080] S21. Receive a test instruction.

[0081] The test instruction includes a test identifier.

[0082] See above Figure 1 The introduction of S11 in the previous section will not be repeated here.

[0083] S22. According to the test identifier, obtain a test case corresponding to the test identifier.

[0084] See above Figure 1 The introduction of S12 in the previous section will not be repeated here.

[0085] S23. Test the test case and generate test results.

[0086] Specifically, the above S23 includes:

[0087] S231. Analyze and verify the data in the test case.

[0088] In an optional implementation, the electronic device may read the data in the test case, and may generate a test scenario based on the data in the read test case, thereby testing the distributed storage system in the electronic device under the test scenario.

[0089] In an optional implementation manner, the above S231 “parsing and verifying the data in the test case” includes:

[0090] (1) Obtain the test data dependency set and test data constraint verification set in the test case.

[0091] (2) According to the test data constraint verification set, the data in the test data dependency set is parsed and verified.

[0092] Specifically, the electronic device can read and parse the data in the test case, thereby obtaining a test data dependency set and a test data constraint verification set in the test case.

[0093] The test data dependency set can be a directed acyclic graph data structure generated according to the mutual dependency relationship between the test data, and is used to represent the data relationship between the test data. The test data constraint check set is used to constrain the test data. Exemplarily, each test data must have a certain range, and the range of the test data is the test data constraint check set corresponding to the test data.

[0094] Specifically, after obtaining the test data dependency set and the test data constraint verification set in the test case, the electronic device can parse and verify the data in the test data dependency set, and then determine whether the result generated by the data in the test data dependency set exceeds the constraint conditions corresponding to the test data in the test data constraint verification set. If it does not exceed the constraint conditions corresponding to the test data in the test data constraint verification set, it passes; if it exceeds, the output is failed.

[0095] S232. Generate test results based on the analysis and verification results.

[0096] In an optional implementation, the electronic device may generate a test table based on the analyzed test results, thereby generating the test results.

[0097] Specifically, the above S232 “generating a test result according to the parsing verification result” includes:

[0098] (1) Obtain the document description result set template in the test case.

[0099] (2) Generate test case execution results based on the analysis and verification results.

[0100] (3) Fill the execution results into the document description result set template to generate test results.

[0101] Specifically, before or after testing a test case, the electronic device can obtain a document description result set template in the test case. The document description result set template can be a table or a document, and the document description result set template includes some test result information. Exemplarily, the document description result set template may include "Whether the test is passed:"

[0102] After the electronic device parses and verifies the data in the test case and generates the parsing and verification result, the electronic device can generate the test case execution result according to the parsing and verification result. Then, the electronic device fills the execution result into the document description result set template to generate the test result.

[0103] Exemplarily, after parsing and verifying the data in the test case, the electronic device determines that the distributed storage system in the electronic device has passed the test, and the electronic device generates a test case execution result of passing the test. Then, the electronic device fills the "passed test" in the document description result set template after "whether the test has passed:", thereby generating a test result.

[0104] In an optional implementation of the present application, when the electronic device tests the distributed storage system according to the test case, the test system in the electronic device can monitor whether the test case is executed. If the test case is executed, the task execution status is tracked and the test report is displayed. If the test case is not executed, the monitoring continues and the test task is tracked. Specifically, Figure 3 shown.

[0105] The test method provided in the embodiment of the present application performs parsing and verification on the data in the test case, thereby ensuring the accuracy of the parsing and verification results. Then, the test results are generated based on the parsing and verification results, thereby ensuring the accuracy of the generated test results.

[0106] In addition, the test method provided in the embodiment of the present application obtains the test data dependency set and the test data constraint verification set in the test case; according to the test data constraint verification set, the data in the test data dependency set is parsed and verified. The accuracy of the verification of the data in the test data dependency set is ensured. The document description result set template in the test case is obtained; the test case execution result is generated according to the parsing and verification result; the execution result is filled into the document description result set template to generate the test result, thereby ensuring that the generated test result is more intuitive and easy for users to obtain, thereby improving the efficiency of testing the distributed storage system.

[0107] In one embodiment of the present application, Figure 4 As shown in the figure, the test cases corresponding to the test identifiers include:

[0108] S31. Receive a test case generation instruction.

[0109] The test case generation instruction includes a test identifier. The test identifier may be an MCC (Message Command Code). The message command code is an identification code for business system message subscription and delivery in the storage system; each business operation or command line mode corresponds to a command code. The test identifier may also be other identification information.

[0110] Specifically, the electronic device may receive a test case generation instruction issued by a user based on a client or a UI (User Interface). The test case generation instruction may be used to instruct the electronic device to generate a test case corresponding to the test identifier.

[0111] It should be noted that the electronic device may be a device in a distributed storage system, and the distributed storage system may also be installed in the electronic device.

[0112] S32. Generate instructions according to the test case and obtain benchmark data.

[0113] In an optional implementation, after receiving the test case generation instruction issued by the user based on the client or UI (User Interface), the electronic device may also receive benchmark data input by the user based on the client or UI (User Interface).

[0114] The benchmark data may be basic data used to generate test cases.

[0115] Specifically, the above S32 “generating instructions according to the test case and obtaining benchmark data” may include the following steps:

[0116] S321. Generate instructions according to the test case and obtain test data.

[0117] S322. Process the test data according to the preset format and data form configuration to generate benchmark data.

[0118] Specifically, after receiving a test case generation instruction issued by a user based on a client or a UI (User Interface), the electronic device may turn on a test debugging switch, which may be used to turn on test case generation.

[0119] Then, the electronic device can generate instructions according to the test case, and obtain the real data of the distributed storage system under normal operation from the online log data interface of the distributed storage system. The electronic device can also obtain the real data in a customized way according to the customized configuration data interface.

[0120] The electronic device processes the acquired real data according to a preset format and data form configuration to generate reference data.

[0121] The preset format may be Json, Yaml, XML, etc., or may be other formats applicable to test cases.

[0122] Then, the electronic device binds the benchmark data with the test identifier, and encapsulates the benchmark data and the test identifier into a common data exchange format (such as Json, Yaml, XML, etc.), and persists them in the local test data in the form of a string.

[0123] S33. According to the test identifier, the benchmark data is debugged and processed to generate a test case.

[0124] In an optional implementation, the electronic device obtains the test requirement corresponding to the test identifier according to the test identifier, and then debugs the benchmark data according to the test requirement to generate a test case.

[0125] In another optional implementation, the above S33 “debugging the benchmark data according to the test identifier to generate a test case” may include the following steps:

[0126] S331. According to the configuration definition corresponding to the test identifier, perform string deserialization processing on the benchmark data to generate a test data dependency set.

[0127] S332. Form a test data constraint verification set according to the verification data parameter constraint list corresponding to the test identifier.

[0128] S333. Generate a document describing the result set template based on the test execution steps, process, and results.

[0129] Specifically, the electronic device deserializes the reference data string into a data object according to the configuration definition corresponding to the test identifier, generates a directed acyclic graph data structure according to the test identifier interdependence according to the preset definition, and forms a test data dependency set. Then, a test data constraint verification set is formed according to the preset verification data parameter constraint list. A test data document description result set template is formed according to the test case execution steps, process, and result output template.

[0130] S334. Generate test cases according to the test data dependency set, the test data constraint verification set and the document description result set template.

[0131] In an optional implementation, the electronic device combines the test data dependency set, the test data constraint verification set, and the document description result set template to generate a test case.

[0132] In another optional implementation, the electronic device may also generate a test process, where the electronic device combines a test data dependency set, a test data constraint verification set, a document description result set template, and a test process to generate a test case.

[0133] The test method provided in the embodiment of the present application receives a test case generation instruction, and the test case generation instruction includes a test identifier; according to the test case generation instruction, the benchmark data is obtained to ensure the accuracy of the obtained benchmark data. Then, according to the test identifier, the benchmark data is debugged and processed to generate a test case. Thereby, the accuracy of the generated test case can be guaranteed. In the above method, in the process of generating test cases, there is no need for manual intervention to create false data for debugging, thus saving a lot of manpower, financial resources, material resources and time costs, saving resources, and improving the efficiency of testing distributed systems. In addition, the process of generating test cases more completely integrates the test process development and test requirements of the test model in the storage system, improves development efficiency, and is also conducive to the advancement of testing work; at the same time, the coupling between modules is low, which is convenient for each module to be independently maintained and debugged, reducing labor costs and operational difficulty.

[0134] In addition, the test method provided in the embodiment of the present application obtains test data according to the test case generation instruction; processes the test data according to the preset format and data form configuration to generate benchmark data, thereby ensuring the accuracy of the generated benchmark data. The accuracy of the generated test data dependency set, test data constraint check set, and document description result set template is ensured, thereby ensuring the accuracy of the test case generated according to the test data dependency set, test data constraint check set, and document description result set template.

[0135] In an optional embodiment of the present application, illustratively, as Figure 5 As shown in FIG. , it is the overall framework of the invention of this application. Figure 5 It can be seen that users can input real data and other data based on the network layer / CLI (Command Line Interface). Then, the real data and other data are input based on the external interface debugging module, and then the test cases are generated based on the benchmark data generation module and the test data assembly module. Then, the test cases are verified based on the data parsing and verification module, and the results are output to the test system. The test system interacts with the main node, continues to generate test cases, and tests the test cases.

[0136] For example, Figure 6The test model method is shown in the figure, which mainly includes three parts: benchmark data generation module, test data assembly module and test data parsing model. Among them, the benchmark data generation module mainly includes: online log data, that is, collecting real data; custom configuration, that is, supplementary data, and debugging mode, that is, switch control. The test data assembly module mainly generates dependency sets, that is, directed acyclic graphs; constraint verification sets, that is, constraint parameters; document description sets, that is, test reports; the test data parsing model mainly includes: monitoring process, that is, use case execution; deserialization, that is, result delivery.

[0137] For example, Figure 7 As shown in the figure, it is a data interaction sequence diagram. Figure 7 As shown, firstly, the test case is generated and configured on the WEB, CLI or background, then the configuration message is sent, and data assembly, data parsing, verification, and loop detection are performed. Then, the benchmark data is generated and imported, the results are summarized, the processing result message is returned, and it is displayed on the client.

[0138] It should be understood that although Figure 1 , Figure 2 ,as well as Figure 4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, 1. Figure 2 ,as well as Figure 4 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0139] In this embodiment, a test device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0140] This embodiment provides a testing device, such as Figure 8 As shown, including:

[0141] A receiving module 41 is used to receive a test instruction, where the test instruction includes a test identifier;

[0142] The acquisition module 42 is used to acquire the test case corresponding to the test identifier according to the test identifier;

[0143] The testing module 43 is used to test the test cases and generate test results.

[0144] In one embodiment of the present application, the above-mentioned test module 43 is specifically used to parse and verify the data in the test case; and generate a test result based on the parsing and verification result.

[0145] In one embodiment of the present application, the above-mentioned test module 43 is specifically used to obtain a test data dependency set and a test data constraint verification set in a test case; and parse and verify the data in the test data dependency set according to the test data constraint verification set.

[0146] In one embodiment of the present application, the above-mentioned test module 43 is specifically used to obtain the document description result set template in the test case; generate the test case execution result according to the parsing verification result; fill the execution result into the document description result set template to generate the test result.

[0147] In one embodiment of the present application, the acquisition module 42 is specifically used to receive a test case generation instruction, which includes a test identifier; obtain benchmark data according to the test case generation instruction; and debug the benchmark data according to the test identifier to generate a test case.

[0148] In one embodiment of the present application, the above-mentioned acquisition module 42 is specifically used to perform string deserialization processing on the benchmark data according to the configuration definition corresponding to the test identifier to generate a test data dependency set; form a test data constraint verification set according to the verification data parameter constraint list corresponding to the test identifier; generate a document description result set template according to the test execution steps, process, and results; generate a test case according to the test data dependency set, the test data constraint verification set, and the document description result set template.

[0149] In one embodiment of the present application, the acquisition module 42 is specifically used to generate instructions according to the test case and acquire test data; and process the test data according to the preset format and data form configuration to generate benchmark data.

[0150] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.

[0151] The embodiment of the present invention also provides an electronic device having the above Figure 8 The test setup is shown.

[0152] See also Fig. 9 , Fig. 9is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, a memory 54, and at least one communication bus 52. The communication bus 52 is used to realize the connection and communication between these components. The communication interface 53 may include a display screen (Display) and a keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a wireless interface. The memory 54 may be a high-speed RAM memory (Random Access Memory) or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 54 may optionally be at least one storage device located away from the aforementioned processor 51. The processor 51 may be combined with Figure 8 In the described device, the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 to execute any of the above method steps.

[0153] The communication bus 52 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 52 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0154] Among them, the memory 54 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk drive (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 54 may also include a combination of the above types of memory.

[0155] The processor 51 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.

[0156] The processor 51 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0157] Optionally, the memory 54 is also used to store program instructions. The processor 51 can call the program instructions to implement the test method shown in any embodiment of the present application.

[0158] The embodiment of the present invention further provides a non-transitory computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions can execute the test method in any of the above method embodiments. The storage medium may be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above types of memory.

[0159] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A testing method, characterized in that: The method comprises: Receive a test instruction, wherein the test instruction includes a test identifier; the test case generation instruction includes the test identifier; wherein the test identifier may be a message command code, which is an identifier code for a business system message subscription and delivery in a storage system; each business operation or command line mode corresponds to a command code; According to the test identifier, obtaining a test case corresponding to the test identifier; Testing the test case and generating test results; Obtaining the test case corresponding to the test identifier includes: Receiving a test case generation instruction, wherein the test case generation instruction includes a test identifier; Generate instructions according to the test case and obtain benchmark data; According to the test identifier, the benchmark data is debugged to generate the test case; The step of debugging the benchmark data according to the test identifier to generate the test case includes: According to the configuration definition corresponding to the test identifier, the benchmark data is deserialized into a string to generate a test data dependency set; wherein, according to the configuration definition corresponding to the test identifier, the benchmark data string is deserialized into a data object, and a directed acyclic graph data structure is generated according to the mutual dependency of the test identifiers according to a preset definition to form a test data dependency set; Forming a test data constraint verification set according to the verification data parameter constraint list corresponding to the test identifier; Generate a document describing the result set template based on the test execution steps, process, and results; Generate the test case according to the test data dependency set, the test data constraint check set and the document description result set template; The step of generating instructions according to the test case and obtaining benchmark data includes: Generate instructions according to the test case and obtain test data; Processing the test data according to a preset format and data form configuration to generate the benchmark data; The step of testing the test case and generating a test result includes: Parsing and verifying the data in the test case; Generate the test result according to the analysis and verification result; The parsing and verifying of the data in the test case includes: Obtaining a test data dependency set and a test data constraint verification set in the test case; According to the test data constraint verification set, the data in the test data dependency set is parsed and verified.

2. The method according to claim 1, characterized in that The generating the test result according to the parsing verification result includes: Obtaining a document description result set template in the test case; Generate the test case execution result according to the analysis verification result; Fill the execution result into the document description result set template to generate the test result.

3. A testing device, characterized in that: The device comprises: A receiving module, used to receive a test instruction, wherein the test instruction includes a test identifier; the test case generation instruction includes a test identifier; wherein the test identifier may be a message command code, which is an identifier code for a business system message subscription and delivery in a storage system; each business operation or command line mode corresponds to a command code; An acquisition module, used to acquire a test case corresponding to the test identifier according to the test identifier; A test module, used to test the test case and generate test results; The acquisition module is specifically used to receive a test case generation instruction, wherein the test case generation instruction includes a test identifier; obtain benchmark data according to the test case generation instruction; debug the benchmark data according to the test identifier to generate a test case; The acquisition module is specifically used to perform string deserialization processing on the benchmark data according to the configuration definition corresponding to the test identifier to generate a test data dependency set; form a test data constraint verification set according to the verification data parameter constraint list corresponding to the test identifier; generate a document description result set template according to the test execution steps, process, and results; generate a test case according to the test data dependency set, the test data constraint verification set, and the document description result set template; wherein, according to the configuration definition corresponding to the test identifier, the benchmark data string is deserialized into a data object, and a directed acyclic graph data structure is generated according to the mutual dependency of the test identifiers according to the preset definition to form a test data dependency set; The acquisition module is specifically used to generate instructions according to the test case and acquire test data; according to the preset format and data form configuration, the test data is processed to generate benchmark data; The test module is specifically used to parse and verify the data in the test case; and generate test results based on the parsing and verification results; The test module is specifically used to obtain the test data dependency set and the test data constraint verification set in the test case; according to the test data constraint verification set, the data in the test data dependency set is parsed and verified.

4. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the test method as described in claim 1 or 2.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the testing method according to claim 1 or 2 are implemented.