Object storage test log generation method and device, computer equipment and readable storage medium
By converting object storage operation node information into a tuple model and correcting test interface information fields, accurate object storage test logs are generated, solving the problem of inaccurate testing in existing technologies and achieving comprehensive coverage of object storage SDK functions and dynamic adjustment of test scenarios.
Patent Information
- Application Number
- CN202411667367.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-18
AI Technical Summary
The existing method for generating test logs for object storage is not accurate enough and cannot effectively cover all the functions of the object storage SDK and dynamically adjusted test scenarios.
By acquiring the test scenario file and extension file, the object storage operation node information is detected and converted into a tuple model. Based on the tuple model and the test scenario file, the test interface information fields in the target template file are corrected and merged into the test extension file. The target test extension file is then executed to generate accurate object storage test logs.
It improves the accuracy of object storage testing, covers commonly used SDK functions for object storage users, supports dynamic adjustment of test scenarios, and generates flexible and accurate test reports.
Smart Images

Figure CN119473923A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for generating an object storage test log. Background Art
[0002] With the development of science and technology, data has become the core asset of all walks of life and needs to be stored and managed in an efficient, scalable and highly reliable way. Among them, object storage is a storage product provided by cloud vendors to customers. It provides storage services for unstructured data (pictures, audio and video, text and other format files) through the S3 protocol and standard service interface. It has the advantages of high reliability, high scalability and high performance. On the basis of object storage, testing the object storage process to generate object storage test logs is also a key topic that technicians in this field need to consider.
[0003] In traditional technology, the commonly used testing tool for object storage is cosbench (Cloud Object StorageBench, cloud object storage service) to perform operational tests on object storage. In other words, an object storage benchmark performance testing tool is used to measure the performance of object storage and then generate object storage test logs.
[0004] However, the current method of generating object storage test logs is not accurate enough. Summary of the invention
[0005] Based on this, it is necessary to provide an accurate object storage test log generation method, device, computer equipment, computer readable storage medium and computer program product to address the above technical problems.
[0006] In a first aspect, the present application provides a method for generating an object storage test log, comprising:
[0007] Get the test scenario file and test extension file;
[0008] Detecting object storage operation node information in the object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents test interface information corresponding to the test interface in the object storage operation node information;
[0009] Based on the test scenario file, the target template file is detected from the preset template file, and based on the multi-tuple model and the test scenario file, the test interface information field in the target template file is corrected;
[0010] Merge the modified target template file into the test extension file to obtain the target test extension file;
[0011] Execute the target test extension file to obtain the object storage test log.
[0012] In one embodiment, the target template file includes a first target template file, a second target template file and a third target template file, the test interface information field includes a thread trigger parameter field, an entity information field and an input parameter field of the test interface, based on the test scenario file, the target template file is detected from the preset template file, and based on the multi-tuple model and the test scenario file, the test interface information field in the target template file is modified, including:
[0013] Based on the test scenario file, a first target template file, a second target template file and a third target template file are respectively detected from the preset template file, wherein the first target template file is a file matching the thread trigger parameter field, the second target template file is a file matching the entity information field, and the third target template file is a file matching the input parameter field;
[0014] According to the multi-tuple model and the test scenario file, the thread trigger parameter field in the first target template file is modified;
[0015] According to the multi-tuple model and the test scenario file, the entity information field in the second target template file is modified;
[0016] According to the multi-tuple model and the test scenario file, the input parameter field in the third target template file is modified.
[0017] In one embodiment, based on the test scenario file, detecting the target template file from the preset template file includes:
[0018] Obtain thread type information of the test interface in the test scenario file and the template file identifier of the preset template file;
[0019] Based on a preset first mapping relationship and thread type information, detecting a first target template file identifier matching the thread type information from the template file identifier, wherein the preset first mapping relationship refers to a mapping relationship between the thread type information and the template file identifier;
[0020] The template file corresponding to the first target template file identifier is used as the first target template file.
[0021] In one embodiment, the thread trigger parameter field of the test interface in the first target template file is modified according to the multi-tuple model and the test scenario file, including:
[0022] Get the thread trigger information in the test scenario file;
[0023] Based on the preset second mapping relationship and the thread trigger information, detecting the thread trigger parameter field of the test interface in the first target template file, wherein the preset second mapping relationship refers to the mapping relationship between the thread trigger information and the thread trigger parameter field;
[0024] The thread trigger parameter field is corrected by replacing the field content of the thread trigger parameter field with the thread trigger information.
[0025] In one embodiment, modifying the entity information field in the second target template file according to the multi-tuple model and the test scenario file includes:
[0026] Get the test interface path in the test scenario file;
[0027] According to the test interface path, a target tuple model matching the test interface path is searched from the tuple model, and the test interface name string and the test interface type of the target tuple model are obtained;
[0028] Generate the test interface address and test interface name based on the test interface name string;
[0029] Based on the test interface address, the test interface name, the test interface type and the preset third mapping relationship, detect the test interface address field, the test interface name field and the test interface type field in the second target template file, wherein the preset third mapping relationship includes the mapping relationship between the test interface address and the test interface address field, the mapping relationship between the test interface name and the test interface name field, and the mapping relationship between the test interface type and the test interface type field;
[0030] The test interface address field is corrected by replacing the field content of the test interface address field with the test interface address, the test interface name field is corrected by replacing the field content of the test interface name field with the test interface name, and the test interface type field is corrected by replacing the field content of the test interface type field with the test interface type.
[0031] In one embodiment, the input parameter field in the third target template file is modified according to the multi-tuple model and the test scenario file, including:
[0032] Obtain the input key-value pair of the test interface in the test scenario file, and generate an input key and an input value corresponding to the input key based on the input key-value pair;
[0033] Detecting the input key field and the input value field of the test interface in the third target template file through the input key, the input value and the preset fourth mapping relationship, wherein the preset fourth mapping relationship includes a mapping relationship between the input key field and the input key, and a mapping relationship between the input value field and the input value;
[0034] The input parameter field in the third target template file is modified by replacing the field content of the input parameter field with the input key-value pair.
[0035] In a second aspect, the present application also provides an object storage test log generation device, including:
[0036] File acquisition module, used to obtain test scenario files and test extension files;
[0037] A multi-tuple conversion module is used to detect object storage operation node information in the object storage process and convert the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents the test interface information corresponding to the test interface in the object storage operation node information;
[0038] A correction module, used for detecting a target template file from a preset template file based on a test scenario file, and correcting a test interface information field in the target template file based on a multi-tuple model and the test scenario file;
[0039] A merging module, used for merging the modified target template file into the test extension file to obtain the target test extension file;
[0040] The log generation module is used to execute the target test extension file to obtain the object storage test log.
[0041] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0042] Get the test scenario file and test extension file;
[0043] Detecting object storage operation node information in the object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents test interface information corresponding to the test interface in the object storage operation node information;
[0044] Based on the test scenario file, the target template file is detected from the preset template file, and based on the multi-tuple model and the test scenario file, the test interface information field in the target template file is corrected;
[0045] Merge the modified target template file into the test extension file to obtain the target test extension file;
[0046] Execute the target test extension file to obtain the object storage test log.
[0047] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0048] Get the test scenario file and test extension file;
[0049] Detecting object storage operation node information in the object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents test interface information corresponding to the test interface in the object storage operation node information;
[0050] Based on the test scenario file, the target template file is detected from the preset template file, and based on the multi-tuple model and the test scenario file, the test interface information field in the target template file is corrected;
[0051] Merge the modified target template file into the test extension file to obtain the target test extension file;
[0052] Execute the target test extension file to obtain the object storage test log.
[0053] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0054] Get the test scenario file and test extension file;
[0055] Detecting object storage operation node information in the object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents test interface information corresponding to the test interface in the object storage operation node information;
[0056] Based on the test scenario file, the target template file is detected from the preset template file, and based on the multi-tuple model and the test scenario file, the test interface information field in the target template file is corrected;
[0057] Merge the modified target template file into the test extension file to obtain the target test extension file;
[0058] Execute the target test extension file to obtain the object storage test log.
[0059] The above-mentioned object storage test log generation method, device, computer equipment, computer-readable storage medium and computer program product, during the whole process, convert the object storage operation node information in the detection object storage process into a multi-tuple model, and obtain the test interface information corresponding to the test interface in the object storage operation node information, so as to facilitate the subsequent clear and accurate correction of the test interface information field in the accurate target template file obtained based on the test scenario file query through the test scenario file and the multi-tuple model, so that the target template file is corrected to a recognizable file related to the object storage operation node information in the object storage process, and then the corrected target template file is merged into the test extension file to obtain the target test extension file, so as to realize the accurate object storage test log by executing the target test extension file. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0061] Figure 1 An application environment diagram of a method for generating an object storage test log in one embodiment;
[0062] Figure 2 A schematic diagram of a flow chart of a method for generating an object storage test log in one embodiment;
[0063] Figure 3 A schematic diagram of object storage operation node information displayed in a tree structure in one embodiment;
[0064] Figure 4 A schematic diagram of a multi-tuple model represented in a tree diagram form in one embodiment;
[0065] Figure 5 It is a flowchart of a method for generating an object storage test log in another embodiment;
[0066] Figure 6 It is a structural block diagram of an object storage test log generating device in one embodiment;
[0067] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are used to explain the present application and are not used to limit the present application.
[0069] Object storage is a storage product provided by cloud vendors to customers. It provides storage services for unstructured data (images, audio and video, text, and other file formats) through the S3 protocol and standard service interfaces. Currently, the commonly used test tool for object storage is cosbench to perform operational tests on object storage, but this tool can only issue read and write operations on files in the bucket and cannot test the full functionality of the object storage SDK (Software Development Kit).
[0070] Therefore, the present application provides a method for generating an object storage test log, by obtaining a test scenario file and a test extension file, and based on the test scenario file, detecting a target template file from a preset template file, detecting object storage operation node information in the object storage process, and converting the object storage operation node information into a multi-tuple model, based on the multi-tuple model and the test scenario file, correcting the target template file, merging the corrected target template file into the test extension file, obtaining a target test extension file, executing the target test extension file, and obtaining an object storage test log. This method supports covering the commonly used calling SDK functions of object storage users, supports dynamic adjustment of test scenarios, conducts tests more flexibly and conveniently, and can output more accurate test reports, thereby improving the accuracy of object storage test log generation during the object storage test process.
[0071] The object storage test log generation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.
[0072] In the user service scenario, the creation of buckets, uploading and reading of files, etc. are completed by calling the object storage SDK. At this time, the user clicks the object storage test button on the terminal 102 to upload the object storage test request to the server 104. The server 104 obtains the test scenario file and the test extension file, detects the object storage operation node information in the object storage process, and converts the object storage operation node information into a tuple model, wherein the tuple model represents the test interface information corresponding to the test interface in the object storage operation node information. Based on the test scenario file, the target template file is detected from the preset template file, and based on the tuple model and the test scenario file, the test interface information field in the target template file is corrected, and the corrected target template file is merged into the test extension file to obtain the target test extension file, execute the target test extension file, and obtain the object storage test log. Further, the server 104 pushes the object storage test log to the terminal 102 for the user to obtain.
[0073] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0074] In an exemplary embodiment, Figure 2 As shown, a method for generating an object storage test log is provided, and the method is applied to Figure 1 The server 104 in FIG. 1 is used as an example for explanation. Among them:
[0075] S100, obtaining a test scenario file and a test extension file.
[0076] Among them, the test scenario file is an excel file used to set the user's scenario during the object storage test process. The test scenario file contains several test parameters, such as the test interface path, the thread parameter information of the test interface, and the input parameters of the test interface. The test extension file is a general template for the jmx (Java Management Extensions, Java Management Extension) file corresponding to the test plan that does not contain any thread group. Specifically, the test scenario file and the test extension file are the basic test files that need to be prepared in this application. The test scenario file is used to set the user's scenario during the object storage test process. The test extension file is a general template for the jmx (Java Management Extensions, Java Management Extension) file corresponding to the test plan that does not contain any thread group. The test extension file is a file that can be recognized by the jmeter test tool. Furthermore, the test scenario file contains several test parameters, such as the test interface path, the thread parameter information of the test interface, and the input parameters of the test interface. Each test parameter is separated by "_".
[0077] In an exemplary embodiment, the test scenario file is shown in Table 1:
[0078] Table 1 Test scenario files
[0079]
[0080] The last number of the test interface path is the interface identification field. The thread parameter information is defined according to the thread group type (0 for setUp thread group, 1 for normal thread group)_number of threads_Ramp-Up time (seconds)_duration (seconds). The input parameters refer to the input parameters of the test interface.
[0081] In an exemplary embodiment, the test extension file is represented in the form of a jmx file. An initial test extension file is as follows:
[0082] <?xml version="1.0" encoding="UTE-8"?>
[0083] <jmetertestplan version="1.2" properties="5.0" jmeter="5.6.3">
[0084] <hashtree>
[0085] <testplan guiclass="TestPlanGui" testclass="TestPlan" testname="测试计划">
[0086] <elementprop name="TestPian,user_defined_variables" elementtype="Arguments" guiclass="Argumentspanel" testclass="Arguments" testname="用户定义的变量”>
[0087] <collectionprop name="Arguments.arguments" / >
[0088] < / elementprop>
[0089] < / testplan>
[0090] < / hashtree>
[0091] < / jmetertestplan>
[0092] S200, detecting object storage operation node information in an object storage process, and converting the object storage operation node information into a multi-tuple model.
[0093] The multi-tuple model represents the test interface information corresponding to the test interface in the object storage operation node information.
[0094] Specifically, in the user service scenario, the object storage SDK is called to complete the creation of buckets, upload and read files, etc. According to the user's usage method, a service that calls the object storage SDK is built. The service provides users with various operation nodes for using object storage, such as initializing object storage connection according to aksk (access Key Id (AK) and Secret Access Key (SK), public key and private key), creating buckets (buckets are the carriers of objects), deleting buckets, etc., as well as uploading and downloading files in the bucket.
[0095] During the object storage process, the object storage operation node information is detected. In order to better display the object storage operation node information to the user, the object storage operation node information can be displayed in a tree structure, such as Figure 3 The figure shows the object storage operation node information displayed in a tree structure. Further, in order to test the object storage process, the object storage operation node information needs to be converted into a tuple model to obtain the test interface information corresponding to the test interface in the object storage operation node information. Generally, the tuple model is a seven-tuple model.
[0096] In this application, the process of converting the object storage operation node information into a multi-tuple model involves the participation of the OEM (Object exchange Model, semi-structured model). The main feature of the OEM model is that it expresses the schema and data under the same data model, which can be regarded as a graph. Each vertex in the graph can correspond to an entity, and the edge between two vertices represents the hierarchical reference between the entity and its sub-entities. Therefore, the object storage operation node information can be converted into a multi-tuple model through the OEM model.
[0097] In an exemplary embodiment, taking the multi-tuple model as a seven-tuple model as an example, as shown in Table 2, each node in the OEM model is represented by a seven-tuple: (Label, Interface, Type, InParam, OutParam, ID).
[0098] Table 2 OEM model seven-tuple
[0099]
[0100] Each operation node can request the corresponding operation service interface, where Label identifies the description of the current interface, Interface is a string used to represent the full name of the current entity interface, Type represents the method of requesting the interface, such as Post / Get, etc. InParam represents the input parameter of the current entity interface, which consists of a json string. Each attribute in the json string represents the variable of the interface. The attribute key in the json string represents the variable name, and the attribute value represents the variable value. Fixed values or functions are supported. In the function definition of the seven-tuple model, the one starting with ^ indicates that the specific attribute value is obtained through the function definition in the service, and the one starting with & indicates that the specific attribute value is obtained through the global variable name in the service; OutParam represents the output parameter of the current entity interface. The definition starting with & indicates that the variables running in the service are stored in the attribute, which can be directly called by other interfaces; Value represents the value of the entity interface (atomic type), or represents the reference of the entity interface (collection type). The latter is represented by {<l1,oid1> …<ln,oidn>} represents the set, li(1≤i<≤n) represents the label of the entity, oidi(1≤i≤n) represents the identification number of the entity interface; ID is the unique identification number of the current entity interface. Furthermore, the last number of the test interface path in the test scenario file corresponds to the entity interface identification field in the OEM model.
[0101] right Figure 3 After the object storage operation node information shown is converted, the seven-tuple model is as follows:
[0102] (Initialize connection, 127.0.0.1 / zos / init, Post, {"aksk"", "endpoints": ""}, null, {<Create bucket, &1><Delete bucket, &2>, Operation within bucket, &3>}, &0);
[0103] (Create bucket, 127.0.0.1 / zos / createbucket, Post, {^type":"","ac!":"","bucketname":"^random
[0104] Str(6,23)},&{ListbucketП},null,&1);
[0105] (deletebucket,127.0.0.1 / zos / deletebucket,Post,{"bucketname":"&Listbucket"},null,null, &2);
[0106] (bucket operation,null,null,null,null,{<upload file,&4>,<download file,&5>},&3);
[0107] (Upload file, 127.0.0.1 / zos / upload, Post, {"bucketname":"&Listbucket[0]","fileSize":”,
[0108] "ac:"",&ListfileD.null,&4);
[0109] (Download file, 127.0.0.1 / zos / download, Post, {"filename":"&Listfilel", null, null, &5}
[0110] Furthermore, in order to help users clearly and conveniently understand the structure of the described multi-tuple model, the multi-tuple model can also be represented in the form of a tree diagram, such as Figure 4 The figure shows a multi-tuple model represented in the form of a tree diagram. It can be seen that only the identifiers of the entity interfaces are retained.
[0111] S300, based on the test scenario file, detecting the target template file from the preset template file, and based on the multi-tuple model and the test scenario file, correcting the test interface information field in the target template file.
[0112] Among them, there are several fields related to the object storage test process in the target template file, which can be used to insert into the test extension file. Specifically, for different thread groups used by the interface during the test process, the corresponding template files are also different. By analyzing the test scenario file, the target template file matching the test scenario file can be detected from multiple preset template files.
[0113] Furthermore, since the test extension file is a file that does not contain the test plan of any thread group, it is necessary to dynamically adjust the target template file through the test information in the object storage test process according to pre-defined rules, and merge the adjusted target template file into the test extension file so that it can become an executable file in the object storage test process.
[0114] That is to say, through the defined rules, the multi-tuple model and the test scenario file are traversed, and the field content of the test interface information field in the target template file is corrected through the test interface information contained in the multi-tuple model and the test scenario file. It should be explained that correcting the target template file actually refers to correcting some fields in the target template file that are related to the test interface information. It can also be considered that since the fields in the target template file do not contain the test information in the current object storage test process, the test interface information contained in the multi-tuple model and the test scenario file can be used to replace the fields in the target template file that are related to the test interface information, so that the target template file is corrected to a file related to the current object storage test process.
[0115] S400, merging the modified target template file into the test extension file to obtain the target test extension file.
[0116] Specifically, define an XML (Extensible Markup Language) node, insert the XML node into the test extension file, merge the corrected target template file into the XML node of the test extension file, and since the test extension file is a file that can be recognized by JMeter, the target test extension file obtained after the merger is also a file that can be recognized by JMeter.
[0117] S500, executing the target test extension file to obtain an object storage test log.
[0118] Specifically, the JAVA service is started, and the jemter executes the target test extension file. After the execution is completed, the object storage test log is obtained. The object storage test log records the interface request of various user operations in detail, and the tester can analyze based on the report.
[0119] In an exemplary embodiment, executing the target test extension file may be implemented by calling an execution function, where the execution function includes “jmeter -n -t new.jmx -l testresults.jtl -e -o / path / to / output”.
[0120] In the above-mentioned object storage test log generation method, during the whole process, the object storage operation node information in the object storage process is converted into a multi-tuple model to obtain the test interface information corresponding to the test interface in the object storage operation node information, so as to facilitate the subsequent clear and accurate use of the test scenario file and the multi-tuple model to correct the test interface information field in the accurate target template file obtained based on the test scenario file query, so that the target template file is corrected to a recognizable file related to the object storage operation node information in the object storage process, and then the corrected target template file is merged into the test extension file to obtain the target test extension file, so as to obtain an accurate object storage test log by executing the target test extension file.
[0121] In an exemplary embodiment, Figure 5 As shown, the target template file includes a first target template file, a second target template file and a third target template file, the test interface information field includes a thread trigger parameter field, an entity information field and an input parameter field of the test interface, and S300 includes:
[0122] S310: Based on the test scenario file, respectively detect a first target template file, a second target template file, and a third target template file from a preset template file.
[0123] S320: modify the thread trigger parameter field in the first target template file according to the multi-tuple model and the test scenario file.
[0124] S330, modifying the entity information field in the second target template file according to the multi-tuple model and the test scenario file.
[0125] S340: modify the input parameter field in the third target template file according to the multi-tuple model and the test scenario file.
[0126] The first target template file is a file that matches the thread trigger parameter field, the second target template file is a file that matches the entity information field, and the third target template file is a file that matches the input parameter field. The thread trigger parameter field includes fields such as the number of threads generated, the thread generation time, and the thread duration, the entity information field includes information fields related to the test interface, and the input parameter field refers to the input parameter field.
[0127] Specifically, define the xml node <hashtree><hashTree / >, insert the xml node into the test extension file, with the test plan <testplan>Node peers.
[0128] Based on the test scenario file, target template files for collecting different test interface information are detected from the preset template files respectively, and the target template files include: a first target template file that matches the thread trigger parameter field of the test interface, a second target template file that matches the entity information field of the test interface, and a third target template file that matches the input parameter field of the test interface.
[0129] Based on the multi-tuple model and the test scenario file, the corresponding fields of the test interface in the target template file are corrected, that is, according to the multi-tuple model and the test scenario file, the thread trigger parameter field of the test interface in the first target template file is corrected, according to the multi-tuple model and the test scenario file, the entity information field of the test interface in the second target template file is corrected, according to the multi-tuple model and the test scenario file, the input parameter field of the test interface in the third target template file is corrected, and each corrected target template file is inserted into the xml file of the test extension file to obtain a identifiable test extension file target test extension file.
[0130] Furthermore, the thread trigger parameter field of the test interface in the first target template file is modified, that is, the number of threads generated, thread generation time, thread duration, other information related to the test interface, and input parameters of the test interface in the target template file are modified.
[0131] In an exemplary embodiment, the thread trigger parameter field of the test interface in the first target template file is corrected according to the multi-tuple model and the test scenario file, the entity information field of the test interface in the second target template file is corrected according to the multi-tuple model and the test scenario file, and the input parameter field of the test interface in the third target template file is corrected according to the multi-tuple model and the test scenario file. These three processes can be performed simultaneously or successively.
[0132] In the above embodiment, by comprehensively revising the corresponding fields of the test interface in different target template files, the revised target template files are closer to the actual test scenarios, thereby making the target test extension files closely related to the current object storage test.
[0133] In an exemplary embodiment, based on the test scenario file, detecting a first target template file from a preset template file includes:
[0134] Obtain the thread type information of the test interface in the test scenario file and the template file identifier of the preset template file, and based on the preset first mapping relationship and the thread type information, detect the first target template file identifier that matches the thread type information from the template file identifier, and use the template file corresponding to the first target template file identifier as the first target template file.
[0135] The preset first mapping relationship refers to the mapping relationship between the thread type information and the template file identifier.
[0136] Specifically, the thread parameter information of the test interface in the test scenario file is read, the thread parameter information includes several parameters separated by "_", for example, the thread parameter information includes: thread type information type_thread generation number Thread_thread generation time ramp_thread duration duration, etc., and the corresponding thread type information is obtained from the thread parameter information. In addition, the template file identifier of each preset template file and the preset first mapping relationship between the thread type information and the template file identifier need to be determined.
[0137] The first mapping relationship can be represented in the form of a table or a graph. The mapping relationship corresponding to the thread type information is queried from the preset first mapping relationship, and based on the mapping relationship, the first target template file identifier matching the thread type information is determined, and then based on the first target template file identifier, the template file corresponding to the first target template file identifier is used as the first target template file.
[0138] In an exemplary embodiment, the preset template file includes a setup thread group definition template file and a common thread group definition template file, and the preset first mapping relationship includes: setup thread group-setup thread group definition template file identifier, common thread group-common thread group definition template file identifier. When the thread type information is the setup thread group, the first target template file is determined as the template file corresponding to the setup thread group definition template file identifier, and when the thread type information is the common thread group, the first target template file is determined as the template file corresponding to the common thread group definition template file identifier.
[0139] Furthermore, the thread type information may also be represented in the form of numbers or letters. For example, when the thread type information is 1, the corresponding thread type information is an ordinary thread group. When the thread type information is 0, the corresponding thread type information is a setup thread group. At this time, the first target template file is still detected from the preset template file according to the above steps.
[0140] In an exemplary embodiment, the setup thread group definition template file includes:
[0141] <setupthreadgroup quiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp 线程组">
[0142] <intprop name="ThreadGroup.num_threads""> l< / intprop>
[0143] <intprop name="ThreadGroup.ramp_time"> l< / intprop>
[0144] <boolProp name="ThreadGroup.same_user_on_next_iteration">true
[0145] <stringprop name="ThreadGroup.on_sample_error"> continue< / stringprop>
[0146] <elementProp name = "ThreadGroup.main_controller" elementType = "Loopcontroller" guiClass = "LoopControlPanel" testClass = "loocontroller" testName = "循环控制器”
[0147] <stringprop name="LoopController.loops"> l< / stringprop>
[0148] <boolprop name="LoopController.continue_forever"> false< / boolprop>
[0149]
[0150] It should be noted that there seems to be an error in the text for ID=14 where "elementTye" should likely be "elementType" and "tetname" should be "testName", and the Chinese "循环控制器” might need to be corrected to the correct English expression if there is a specific one.< / setupthreadgroup>
[0151] The common thread group definition template file includes:
[0152] <threadgroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="线程组">
[0153] <intprop name="ThreadGroup.num_threads"> 1< / intprop>
[0154] <intprop name="ThreadGroup.ramp _time"> l< / intprop>
[0155] <longprop name="ThreadGroup.duration"> 22< / longprop>
[0156] <boolPropname="ThreadGroup.same_user_on_next_iteration">true
[0157] <boolprop name="ThreadGroup.scheduler"> true< / boolprop>
[0158] <stringprop name="ThreadGroup.on_sample_error"> continue< / stringprop>
[0159] <elementprop name="ThreadGroup.main_controller" elementrype="loopcontroller" guiclass="loopcontrolPanel" testclass="loopcontroller" testname="循环控制器”>
[0160] <stringprop name="LoopController.loops"> l< / stringprop>
[0161] <boolprop name="LoopController.continue_forever"> false< / boolprop>
[0162] < / elementprop>
[0163] < / threadgroup>
[0164] In the above embodiment, by using a template file matching the thread type information of the test interface as the first target template file, the first target template file is made to be a file closer to the thread parameter information in the actual test scenario, thereby improving the accuracy of the object storage test.
[0165] In an exemplary embodiment, the thread trigger parameter field in the first target template file is modified according to the multi-tuple model and the test scenario file, including:
[0166] Obtain thread trigger information in the test scenario file, detect the thread trigger parameter field in the first target template file based on the preset second mapping relationship and the thread trigger information, and correct the thread trigger parameter field by replacing the field content of the thread trigger parameter field with the thread trigger information.
[0167] The preset second mapping relationship refers to the mapping relationship between the thread trigger information and the thread trigger parameter field. The thread trigger information includes the number of threads generated Thread, the thread generation time ramp, and the thread duration duration.
[0168] That is, the preset second mapping relationship is a mapping relationship between the thread generation number Thread and the thread generation number field, the thread generation time ramp and the thread generation time field, and the thread duration duration and the thread duration field.
[0169] Specifically, based on the mapping relationship between the thread generation number Thread and the thread generation number field in the preset second mapping relationship, the thread generation number field matching the thread generation number Thread is queried; based on the mapping relationship between the thread generation time ramp and the thread generation time field in the preset second mapping relationship, the thread generation time field matching the thread generation time ramp is queried; based on the mapping relationship between the thread duration duration and the thread duration field in the preset second mapping relationship, the thread duration field matching the thread duration duration is queried. Then, the field content of the corresponding thread trigger parameter field in the target template file is replaced with the value of each thread trigger information to achieve the correction of the thread trigger parameter field.
[0170] Table 3 is a second mapping relationship table between thread trigger information and thread trigger parameter fields represented in a tabular form in one embodiment.
[0171] Table 3 Second mapping relationship table
[0172]
[0173] Based on the mapping relationship between the number of threads Thread and the number of thread fields in the preset second mapping relationship, the number of thread fields ThreadGroup.num_threads that matches the number of threads Thread is queried; based on the mapping relationship between the thread generation time ramp and the thread generation time field in the preset second mapping relationship, the thread generation time field ramp_time that matches the thread generation time ramp is queried; based on the mapping relationship between the thread duration duration and the thread duration field in the preset second mapping relationship, the thread duration field ThreadGroup.duration that matches the thread duration duration is queried.
[0174] At this time, the thread generation number field ThreadGroup.num_threads in the first target template file is replaced with the actual value of the thread generation number in the current test process, the thread generation time field ramp_time in the first target template file is replaced with the actual value of the thread generation time in the current test process, and the thread duration field ThreadGroup.duration in the first target template file is replaced with the actual value of the thread duration in the current test process.
[0175] In the above embodiment, based on the preset second mapping relationship, the thread trigger parameter field in the target template file that matches the thread trigger information is accurately detected, and then the actual value of the thread trigger information replaces the field content of the thread trigger parameter field in the first target template file to correct the thread trigger parameter field, so that the thread trigger parameters in the first target template file are consistent with the thread trigger parameters in the current object storage test process, thereby improving the accuracy of the object storage test.
[0176] In an exemplary embodiment, modifying the entity information field in the second target template file according to the multi-tuple model and the test scenario file includes:
[0177] Obtain the test interface path in the test scenario file, query the target tuple model that matches the test interface path from the tuple model according to the test interface path, and obtain the test interface name string of the target tuple model, generate the test interface address and the test interface name based on the test interface name string, and obtain the test interface type of the target tuple model, detect the test interface address field, the test interface name field and the test interface type field in the second target template file based on the test interface address, the test interface name, the test interface type and the preset third mapping relationship, correct the test interface address field by replacing the field content of the test interface address field with the test interface address, correct the test interface name field by replacing the field content of the test interface name field with the test interface name, and correct the test interface type field by replacing the field content of the test interface type field with the test interface type.
[0178] The preset third mapping relationship includes a mapping relationship between a test interface address and a test interface address field, a mapping relationship between a test interface name and a test interface name field, and a mapping relationship between a test interface type and a test interface type field;
[0179] Specifically, the test interface path in the test scenario file is read, and the entity interface to be tested is determined according to the last number of the test interface path, and the entity interface corresponds to a target multi-tuple model.
[0180] That is to say, according to the last digit of the test interface path, the target tuple model matching the test interface path is queried from the tuple model. It should be explained that the query can be realized because the last digit of the test interface path actually represents the identifier of the entity interface, and the tuple model also includes the identifier of the entity interface, that is, the last digit of the test interface path is determined as the identifier of the entity interface, and the target tuple model whose identifier of the entity interface is the last digit of the test interface path is queried from the tuple model.
[0181] For example, there are two tuple models: (initialize connection, 127.0.0.1 / zos / init, Post, {"aksk"", "endpoints": ""}, null, {<create bucket, &1><delete bucket, &2>, bucket operation, &3>}, &0); (create bucket, 127.0.0.1 / zos / createbucket, Post, {^type": "", "ac!": "", "bucketname": "^randomStr(6,23)}, &{ListbucketП}, null, &1); then when the last digit of the test interface path is 0, the tuple model with the identifier 0 of the entity interface is queried from the tuple model, that is, (initialize connection, 127.0.0.1 / zos / init, Post, {"aksk"", "endpoints": ""}, null, {<create bucket, &1><delete bucket, &2>, bucket operation, &3>}, &0) is determined as the target tuple model.
[0182] Since the target tuple model includes not only the identifier of the entity interface, but also the test interface name string, the test interface address and the test interface type, the test interface name string and the test interface type of the target tuple model are obtained, and based on the test interface name string, the test interface address and the test interface name are generated.
[0183] Generally, the test interface name string is a string divided by " / ". Find the first " / " in the test interface name string, determine the characters before the first " / " in the test interface name string as the test interface address, and determine the characters after the first " / " in the test interface name string as the test interface name.
[0184] For example, if the test interface name string is "127.0.0.1 / zos / init", the characters before the first " / " in the test interface name string, that is, 127.0.0.1, are determined as the test interface address, and the characters after the first " / " in the test interface name string, that is, zos / init, are determined as the test interface name.
[0185] Since the third mapping relationship includes the mapping relationship between the test interface information field and the test interface address, the mapping relationship between the test interface name and the test interface name field, and the mapping relationship between the test interface type and the test interface type field, based on the test interface address, the test interface name, the test interface type and the preset third mapping relationship, the test interface address field that matches the test interface address, the test interface name field that matches the test interface name, and the test interface type field that matches the test interface type in the target template file can be accurately queried.
[0186] In an exemplary embodiment, Table 4 is a third mapping relationship table represented in a table form.
[0187] Table 4 The third mapping relationship table
[0188]
[0189] That is to say, determine the test interface address field HTTPSampler.domain that matches the test interface address, the test interface name field HTTPSamplerProxy that matches the test interface name, and the test interface type field HTTPSampler.method that matches the test interface type in the second target template file, and replace the field content HTTPSampler.domain of the test interface address field in the second target template file with the actual value of the test interface address, replace the field content HTTPSamplerProxy of the test interface name field in the second target template file with the actual value of the test interface name, and replace the field content HTTPSampler.method of the test interface type field in the second target template file with the actual value of the test interface type.
[0190] After the replacement is completed, the modified second target template file is inserted into another XML node in the test extension file. The XML node is the same as the modified first target template file. <setupthreadgroup>or <threadgroup>The nodes that are siblings of the node.
[0191] In an exemplary embodiment, the initial second target template file includes:
[0192] <hashtree>
[0193] <httpsamplerproxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP请求">
[0194] <stringprop name="HTTPSampler.domain"> 127.0.0.1< / stringprop>
[0195] <stringprop name="HTTPSampler.port"> 80< / stringprop>
[0196] <stringprop name="HTTPSampler.protocol"> http< / stringprop>
[0197] <stringprop name="HTTPSampler.path"> zos / init< / stringprop>
[0198] <boolprop name="HTTPSampler.follow_redirects"> true< / boolprop>
[0199] <stringprop name="HTTPSampler.method"> POST< / stringprop>
[0200] <boolprop name="HTTPSampler.use_keepalive"> true< / boolprop>
[0201] <boolprop name="HTTPSampler.postBodyRaw"> false< / boolprop>
[0202] < / httpsamplerproxy>
[0203] <hashtree / >
[0204] In the above embodiment, the field contents of the test interface address field, the test interface name field and the test interface type field in the second target template file are replaced based on the test interface address, the test interface name, the test interface type and the preset third mapping relationship, so that the corrected second target template file is a file that carries the entity interface information in the current object storage test process, thereby improving the accuracy of generating the object storage test log.
[0205] In an exemplary embodiment, based on the multi-tuple model and the test scenario file, the input parameter field in the target template file is modified, including:
[0206] Obtain the input key-value pairs of the test interface in the test scenario file, and based on the input key-value pairs, generate input keys and input values corresponding to the input keys; detect the input key field and input value field in the target template file through the input key, input value and the preset fourth mapping relationship; correct the input parameter field by replacing the field content of the input parameter field in the third target template file with the input key-value pair.
[0207] The preset fourth mapping relationship includes a mapping relationship between an input key field and an input key, and a mapping relationship between an input value field and an input value.
[0208] Specifically, the input key-value pairs of the test interface in the test scenario file are obtained, and the input key-value pairs are split into input keys and input values corresponding to the input keys. The splitting step is to take the input key-value pairs before ":" as the input key, and take the input key-value pairs after ":" as the input value corresponding to the input key. If there is more than one input key-value pair of the test interface, they can be divided by ",".
[0209] Obtain a preset fourth mapping relationship, obtain the mapping relationship between the input key field and the input key, and the mapping relationship between the input value field and the input value from the preset fourth mapping relationship, detect the input key field that matches the input key in the third target template file through the input key and the mapping relationship between the input key field and the input key, and detect the input value field that matches the input value in the third target template file through the input value and the mapping relationship between the input value field and the input value.
[0210] Table 5 shows a preset fourth mapping relationship represented in a table form in one embodiment.
[0211] Table 5 Preset fourth mapping relationship
[0212]
[0213] That is to say, the input key field Argument.name corresponding to the input key and the field content Argument.value of the input value field corresponding to the input value are queried from the third target template file, and the actual value of the input key is used to replace the field content Argument.name of the input key field in the third target template file, and the actual value of the input value is used to replace the field content Argument.value of the input value field in the third target template file to correct all input parameter fields.
[0214] Each key-value pair corresponds to a <elementprop>After the replacement is completed, the XML files generated by each set of key-value pairs are inserted into the test extension file in sequence. <httpsamplerproxy>Within the node.
[0215] In an exemplary embodiment, the third target template file includes:
[0216] <elementprop name="HTTPsampler.Arguments" elementtype="Arguments" guiclass="HTTPArgumentsPanel”testclass=" arguments" testname="用户定义的变量">
[0217] <collectionprop name="Arquments.arguments">
[0218] <elementprop name="key" elementtype="HTTPArgument">
[0219] <boolprop name="HTTPArgument.always_encode"> false< / boolprop>
[0220] <stringprop name="Argument.value"> value< / stringprop>
[0221] <stringprop name="Argument.metadata"> =< / stringprop>
[0222] <boolprop name="HTTPArgument.use_equals"> true< / boolprop>
[0223] <stringprop name="Argument.name"> key< / stringprop>
[0224] < / elementprop>
[0225] < / collectionprop>
[0226] < / elementprop>
[0227] In the above embodiment, by presetting the fourth mapping relationship, the input key field and input value field of the test interface in the third target template file are detected, and the input parameter field in the third target template file is replaced with an input key-value pair, so that the third target template file is close to the input parameters of the actual test interface during the test process, thereby improving the accuracy of generating object storage test logs.
[0228] In an exemplary embodiment, the object storage test log generation method includes:
[0229] S1. Detect object storage operation node information during object storage.
[0230] The application scenario with more object storage users is to complete bucket creation, file upload, reading, etc. by calling the object storage SDK in the user's service. According to this user usage method, a service that calls the object storage SDK is built. The service provides users with various operations for using object storage, such as initializing object storage connection according to aksk, creating buckets (buckets are the carriers of objects), deleting buckets, etc., as well as uploading and downloading files in the bucket, etc., which can be better displayed using a tree structure.
[0231] S2. Use the OEM model to convert the object storage operation node information into a tuple model.
[0232] Each node in the OEM model is represented by a seven-tuple: (Label, Interface, Type, InParam, OutParam, ID). Each operation node can request the corresponding operation service interface, where Label identifies the description of the current interface, Interface is a string used to represent the full name of the current entity interface, Type represents the method of requesting the interface, such as Post / Get, etc. InParam represents the input parameter of the current entity interface, which consists of a json string. Each attribute in the json string represents the variable of the interface. The attribute key in the json string represents the variable name, and the attribute value represents the variable value. Fixed values or functions are supported. In the function definition of the seven-tuple model, the one starting with ^ indicates that the specific attribute value is obtained through the function definition in the service, and the one starting with & indicates that the specific attribute value is obtained through the global variable name in the service; OutParam represents the output parameter of the current entity interface, and the one starting with & indicates that the variable running in the service is stored in the attribute, which can be directly called by other interfaces; Value represents the value of the entity interface (atomic type), or represents the reference of the entity interface (collection type), the latter is represented by {<l1,oid1> …<ln,oidn>} represents the set, li(1≤i<≤n) represents the label of the entity, oidi(1≤i≤n) represents the identification number of the entity interface; ID is the unique identification number of the current entity interface. Furthermore, the last number of the test interface path in the test scenario file corresponds to the entity interface identification field in the OEM model.
[0233] According to the definition of OEM seven-tuple, the OEM model is as follows: (initialize connection, 127.0.0.1 / zos / init, Post, {"aksk"", "endpoints": ""}, null, {<create bucket, &1><delete bucket, &2>, operation within bucket, &3>}, &0).
[0234] S3. Use the test scenario Excel file to set the user's scenario, as shown in Table 1.
[0235] The last number of the test interface path corresponds to the entity interface identification field in the OEM model.
[0236] Thread parameter information: defined by thread group type (0 for setUp thread group, 1 for normal thread group)_number of threads_Ramp-Up time (seconds)_duration (seconds).
[0237] Input parameters: input parameters of the test interface.
[0238] S4. Obtain the test extension file, and modify the target template file based on the multi-tuple model and the test scenario file.
[0239] First, define a general template for a jmx (Java Management Extension) test extension file corresponding to a test plan that does not contain any thread groups. Based on this template, traverse each row of data and OEM model in the excel file through the defined rules to generate a jmx file that can be recognized by jmeter. In other words, when the input is the excel file and OEM model data, the output is an executable jmx file.
[0240] Step 1: Define an XML node <hashtree> <hashtree / > , insert the node into the jmx file in the figure above, the xml node and <testplan>Node peers.
[0241] Step 2: Read the data in the second column of the Excel file, and map the four data values in the second column to the variable type_thread_ramp_duration respectively. The mapping relationship between the data value corresponding to the variable and the template field in the jmx file is shown in Table 1, which represents the first mapping relationship between the thread type information and the template file identifier, and the second mapping relationship between the thread trigger information and the thread trigger parameter field.
[0242] When the parsed type value is 0, select template file A as the first target template file, and when the parsed type value is 0, select template file B as the first target template file. Then map the value of Thread to the ThreadGroup.num_threads field in the first target template file, map the value of ramp to the ramp_time field in the first target template file, and map the value of duration to the ThreadGroup.duration field in the first target template file.
[0243] After the replacement is completed, insert the xml file into Step 1 <hashtree>Node.
[0244] Table 6 First mapping relationship and second mapping relationship
[0245]
[0246] Step 3: Read the last number in the first column of the excel file, query the target OEM model corresponding to this number from the seven-tuple of the OEM model, and then read the value of Interface in the target OEM model. The value of the first segment separated by " / " in Interface is mapped to the variable interface_address, and the rest is mapped to the variable interface_name. For example, for the entity interface identified as 0 in the OEM model, the interface_address is 127.0.0.1, and the interface_name is zos / init; read the value of Type in the entity and map it to the variable interface_type. The mapping relationship between the data value corresponding to the variable and the template field in the jmx file is the preset third mapping relationship, as shown in Table 4.
[0247] Replace the HTTPSampler.domain field in the second template file with the value of interface_address, replace the HTTPSamplerProxy field in the second template file with the value of interface_name, and replace the HTTPSampler.method field in the second template file with the value of interface_type.
[0248] After the replacement is completed, insert the node into the jmx file in Step 2. <setupthreadgroup>Or a <ThreadGroup> node peer.
[0249] Step 4: Read the data in the third column of Excel to get multiple sets of key-value data, each set of key-value corresponds to a <elementprop>Node. The data value corresponding to the variable and the preset fourth mapping relationship of the variable value in the jmx file are as follows Figure 5 shown.
[0250] Replace the key value with the Argument.name field in the third template file, and replace the value value with the Argument.value field in the third template file.
[0251] After the replacement is completed, insert the xml files generated by each set of key-value into the jmx file in Step 3 in sequence <httpsamplerproxy>Within the node.
[0252] After the conversion rule is passed, a complete jmx file that can be recognized by jmeter will be generated.
[0253] S5. Start the Java service and execute the jmx file in step 4. After the execution is completed, the object storage test log is generated. The code for executing the jmx file in step 4 is: jmeter -n -t new.jmx -l testresults.jtl -e -o / path / to / output.
[0254] Based on the above analysis, this application proposes a method for generating long-term stable object storage test logs that is close to user usage, supports covering the commonly used SDK functions of object storage users, supports dynamic adjustment of test scenarios, and can perform long-term stable, flexible and convenient testing of object storage within the test cycle, and can output a relatively complete test log for each request. Specifically, this application has the following advantages:
[0255] 1. Build a service that simulates users calling SDK to use object storage for various functions, and propose a method of using OEM model to express the various interfaces of the service. By reading OEM tree information, it can be accepted faster and better by people, and can reflect the information of each interface more intuitively and clearly.
[0256] 2. By maintaining an excel file to record the user scenarios to be tested, combined with the excel file and the OEM model, a conversion rule is proposed to convert the excel file into a jmx file that can be recognized by jmeter. Use jmeter to start the execution of the jmx file. After the execution is completed, the test results can be viewed. Compared with the traditional Jmeter GUI maintenance, users no longer need to care about the specific definition of each interface. A jmx file can be obtained by directly referencing an entity in the OEM model.
[0257] 3. By defining rules in Excel to maintain the user scenarios to be tested, the test parameters can be adjusted dynamically.
[0258] Compared with existing technologies, the main advantages are:
[0259] 1. It can cover the long-term stability testing of all interfaces of object storage SDKs of all manufacturers.
[0260] 2. Use the OEM model to express the interface to be tested, so that testers can construct test scenarios more clearly through Excel.
[0261] In addition, this application can also be applied to long-term stability testing before the version update of object storage to determine whether the version update will affect user use. It can be applied in the following scenarios:
[0262] 1. Help testers cover more test scenarios and reduce problems caused by code changes.
[0263] 2. Improve the efficiency of testers in maintaining test scenarios and reduce testing time.
[0264] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0265] Based on the same inventive concept, the embodiment of the present application also provides an object storage test log generation device for implementing the object storage test log generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more object storage test log generation device embodiments provided below can refer to the limitations of the object storage test log generation method above, and will not be repeated here.
[0266] In an exemplary embodiment, Figure 6 As shown, an object storage test log generation device is provided, comprising: a file acquisition module 100, a tuple conversion module 200, a correction module 300, a merging module 400 and a log generation module 500, wherein:
[0267] The file acquisition module 100 is used to acquire the test scenario file and the test extension file;
[0268] A tuple conversion module 200 is used to detect object storage operation node information in the object storage process and convert the object storage operation node information into a tuple model, wherein the tuple model represents the test interface information corresponding to the test interface in the object storage operation node information;
[0269] The correction module 300 is used to detect the target template file from the preset template file based on the test scenario file, and to correct the test interface information field in the target template file based on the multi-tuple model and the test scenario file;
[0270] A merging module 400 is used to merge the modified target template file into the test extension file to obtain a target test extension file;
[0271] The log generation module 500 is used to execute the target test extension file to obtain the object storage test log.
[0272] In an exemplary embodiment, the target template file includes a first target template file, a second target template file and a third target template file, the test interface information field includes a thread trigger parameter field, an entity information field and an input parameter field of the test interface, and the correction module 300 is also used to detect the first target template file, the second target template file and the third target template file from the preset template file based on the test scenario file, wherein the first target template file is a file that matches the thread trigger parameter field, the second target template file is a file that matches the entity information field, and the third target template file is a file that matches the input parameter field; according to the tuple model and the test scenario file, the thread trigger parameter field in the first target template file is corrected; according to the tuple model and the test scenario file, the entity information field in the second target template file is corrected; according to the tuple model and the test scenario file, the input parameter field in the third target template file is corrected.
[0273] In an exemplary embodiment, the correction module 300 is also used to obtain thread type information of the test interface in the test scenario file, and a template file identifier of a preset template file; based on a preset first mapping relationship and the thread type information, a first target template file identifier matching the thread type information is detected from the template file identifier, wherein the preset first mapping relationship refers to a mapping relationship between the thread type information and the template file identifier; and the template file corresponding to the first target template file identifier is used as the first target template file.
[0274] In an exemplary embodiment, the correction module 300 is also used to obtain thread trigger information in the test scenario file; based on a preset second mapping relationship and the thread trigger information, detect the thread trigger parameter field of the test interface in the first target template file, wherein the preset second mapping relationship refers to the mapping relationship between the thread trigger information and the thread trigger parameter field; and correct the thread trigger parameter field by replacing the field content of the thread trigger parameter field with the thread trigger information.
[0275] In an exemplary embodiment, the correction module 300 is also used to obtain the test interface path in the test scenario file; according to the test interface path, query the target tuple model that matches the test interface path from the tuple model, and obtain the test interface name string and test interface type of the target tuple model; based on the test interface name string, generate the test interface address and the test interface name; based on the test interface address, test interface name, test interface type and a preset third mapping relationship, detect the test interface address field, test interface name field and test interface type field in the second target template file, wherein the preset third mapping relationship includes the mapping relationship between the test interface information field and the test interface address, the mapping relationship between the test interface name and the test interface name field, and the mapping relationship between the test interface type and the test interface type field; correct the test interface address field by replacing the field content of the test interface address field with the test interface address, correct the test interface name field by replacing the field content of the test interface name field with the test interface name, and correct the test interface type field by replacing the field content of the test interface type field with the test interface type.
[0276] In an exemplary embodiment, the correction module 300 is also used to obtain the input key-value pairs of the test interface in the test scenario file, and based on the input key-value pairs, generate input keys and input values corresponding to the input keys; detect the input key field and the input value field in the third target template file through the input key, the input value and the preset fourth mapping relationship, wherein the preset fourth mapping relationship includes the mapping relationship between the input key field and the input key, and the mapping relationship between the input value field and the input value; correct the input parameter field by replacing the field content of the input parameter field in the third target template file with the input key-value pair.
[0277] Each module in the object storage test device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0278] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as test scenario files and test extension files. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating an object storage test log is implemented.
[0279] Those skilled in the art will understand that Figure 7 The structure shown in the figure is a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0280] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0281] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0282] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0283] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0284] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0285] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.< / httpsamplerproxy> < / elementprop> < / setupthreadgroup> < / hashtree> < / testplan> < / hashtree> < / httpsamplerproxy> < / elementprop> < / hashtree> < / threadgroup> < / setupthreadgroup> < / testplan> < / hashtree>
Claims
1. A method for generating an object storage test log, characterized in that: The method comprises: Get the test scenario file and test extension file; Detecting object storage operation node information in an object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents test interface information corresponding to the test interface in the object storage operation node information; Based on the test scenario file, detecting a target template file from a preset template file, and based on the multi-tuple model and the test scenario file, correcting a test interface information field in the target template file; Merging the modified target template file into the test extension file to obtain the target test extension file; The target test extension file is executed to obtain an object storage test log.
2. The method according to claim 1, characterized in that The target template file includes a first target template file, a second target template file and a third target template file, the test interface information field includes a thread trigger parameter field, an entity information field and an input parameter field of the test interface, and based on the test scenario file, detecting the target template file from the preset template file, and based on the multi-tuple model and the test scenario file, correcting the test interface information field in the target template file, including: Based on the test scenario file, the first target template file, the second target template file and the third target template file are respectively detected from the preset template file, wherein the first target template file is a file matching the thread trigger parameter field, the second target template file is a file matching the entity information field, and the third target template file is a file matching the input parameter field; According to the multi-tuple model and the test scenario file, modifying the thread trigger parameter field in the first target template file; According to the multi-tuple model and the test scenario file, modifying the entity information field in the second target template file; The input parameter field in the third target template file is modified according to the multi-tuple model and the test scenario file.
3. The method according to claim 2, characterized in that Based on the test scenario file, detecting a first target template file from a preset template file includes: Obtaining thread type information of the test interface in the test scenario file and a template file identifier of a preset template file; Based on a preset first mapping relationship and the thread type information, detecting a first target template file identifier matching the thread type information from the template file identifier, wherein the preset first mapping relationship refers to a mapping relationship between the thread type information and the template file identifier; The template file corresponding to the first target template file identifier is used as the first target template file.
4. The method according to claim 2, characterized in that: The modifying the thread trigger parameter field in the first target template file according to the multi-tuple model and the test scenario file includes: Obtain thread trigger information in the test scenario file; Based on a preset second mapping relationship and the thread trigger information, detecting a thread trigger parameter field in the first target template file, wherein the preset second mapping relationship refers to a mapping relationship between the thread trigger information and the thread trigger parameter field; The thread trigger parameter field is modified by replacing the field content of the thread trigger parameter field with the thread trigger information.
5. The method according to claim 2, characterized in that: The modifying the entity information field in the second target template file according to the multi-tuple model and the test scenario file includes: Obtaining the test interface path in the test scenario file; According to the test interface path, query the target tuple model matching the test interface path from the tuple model, and obtain the test interface name character string and the test interface type of the target tuple model; Based on the test interface name character string, generate a test interface address and a test interface name; Based on the test interface address, the test interface name, the test interface type and a preset third mapping relationship, detect the test interface address field, the test interface name field and the test interface type field in the second target template file, wherein the preset third mapping relationship includes a mapping relationship between the test interface address and the test interface address field, a mapping relationship between the test interface name and the test interface name field, and a mapping relationship between the test interface type and the test interface type field; The test interface address field is corrected by replacing the field content of the test interface address field with the test interface address, the test interface name field is corrected by replacing the field content of the test interface name field with the test interface name, and the test interface type field is corrected by replacing the field content of the test interface type field with the test interface type.
6. The method according to claim 2, characterized in that The modifying the input parameter field in the third target template file according to the multi-tuple model and the test scenario file comprises: Obtaining an input key-value pair of the test interface in the test scenario file, and generating an input key and an input value corresponding to the input key based on the input key-value pair; Detecting the input key field and the input value field in the third target template file through the input key, the input value and the preset fourth mapping relationship, wherein the preset fourth mapping relationship includes a mapping relationship between the input key field and the input key, and a mapping relationship between the input value field and the input value; The input parameter field in the third target template file is modified by replacing the field content of the input parameter field with the input key-value pair.
7. An object storage test log generating device, characterized in that: The device comprises: File acquisition module, used to obtain test scenario files and test extension files; A multi-tuple conversion module, used for detecting object storage operation node information in an object storage process, and converting the object storage operation node information into a multi-tuple model, wherein the multi-tuple model represents the test interface information corresponding to the test interface in the object storage operation node information; A correction module, used for detecting a target template file from a preset template file based on the test scenario file, and correcting a test interface information field in the target template file based on the multi-tuple model and the test scenario file; A merging module, used for merging the modified target template file into the test extension file to obtain a target test extension file; The log generation module is used to execute the target test extension file to obtain the object storage test log.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. 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 method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.