Product testing method, device, electronic equipment and storage medium
By obtaining and parsing business record data in product testing and generating test cases, problems that are difficult to reproduce during product testing are solved, and rapid problem solving and testing efficiency improvement are achieved.
Patent Information
- Application Number
- CN202211519875.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-11-30
AI Technical Summary
During product testing, it is difficult to reproduce the test process to identify and resolve problems, especially due to the contingency of the test process and the challenges caused by insufficient recording data.
By obtaining the business record data of the product to be tested, a test case is generated so that the test product is tested again, including parsing the command package and recording the data, calculating the use case execution interval, sending and receiving the command package, and updating the use case status according to the response package.
It realizes complete reproduction of the product testing process, quickly finds and solves problems, improves testing efficiency, and avoids the need to write test cases manually.
Smart Images

Figure CN115967797B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of testing technology, and in particular to a product testing method, a product testing device, an electronic device, and a storage medium. Background Art
[0002] For products that are about to be released, testers need to test the products and record the test results after the test is completed. Problems may occur during the product testing process due to various reasons. In order to quickly identify the problem, the product testing process can be reproduced based on the recorded test results. However, the occurrence of problems during the test process is accidental, and it is difficult to identify the problem based solely on the recorded test results.
[0003] Therefore, how to reproduce the product testing process to determine the problems existing during product testing and then quickly solve the problems is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a product testing method, a product testing device, an electronic device and a storage medium that overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problems, an embodiment of the present invention discloses a product testing method, which includes:
[0006] Acquire business record data of the product to be tested; wherein the business record data is generated when the product to be tested is tested, and the business record data at least includes a command package and record data corresponding to the command package;
[0007] A test case is generated according to the business record data, so as to test the product to be tested again according to the test case.
[0008] Optionally, the recorded data at least includes a parsing protocol type, and before generating a test case according to the business recorded data, the method further includes:
[0009] Parsing the command packet according to the protocol rule corresponding to the parsing protocol type to obtain a parsing result of the command packet;
[0010] Generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data;
[0011] The test case is displayed; wherein the test case allows deletion, disabling and editing operations.
[0012] Optionally, the product to be tested includes at least a command sender and a command receiver; the business record data is generated by parsing the command packet sent by the command sender to the command receiver after the command sender copies the command packet when the business record function is turned on, and / or the command sender captures the command packet according to a pre-set data packet capture tool and then parses the generated data.
[0013] Optionally, the test case includes at least a business code, and the presenting of the test case includes:
[0014] Convert the service code into a corresponding service function name;
[0015] The corresponding test cases are displayed according to the business function names.
[0016] Optionally, the test case includes at least the command packet and a service identifier of the command packet, a parsing protocol type, a command recipient address, an execution number, and a command packet sending time, and generating the test case according to the service record data includes:
[0017] Calculate the use case execution interval time between each of the command packages according to the command package sending time;
[0018] Sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution numbers and the execution interval of the test case and the protocol rule corresponding to the parsed protocol type;
[0019] Receive a response packet sent by the command receiver in response to the command packet; wherein the response packet includes a service identifier of the command packet.
[0020] Optionally, the test case includes at least a case state, and after sending the command packet in the test case to the command recipient corresponding to the command recipient address in the order of the execution numbers and the sending time interval, the method further includes:
[0021] When the response packet sent by the command receiver to the command packet is not received within the specified timeout period, the use case status is updated to an execution failure status, and corresponding exception information is recorded in the test case.
[0022] Optionally, after receiving a response packet sent by the command recipient in response to the command packet, the method further includes:
[0023] When receiving a response packet sent by the command receiver to the command packet within a specified timeout period, if the response packet cannot be parsed using the specified protocol rule, the response packet is discarded; if the response packet can be parsed using the specified protocol rule, the response packet is parsed according to the protocol rule corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure;
[0024] The use case status is updated according to the business response result.
[0025] The embodiment of the present invention further discloses a product testing device, the device comprising:
[0026] An acquisition module, used for acquiring business record data of the product to be tested; wherein the business record data is generated when the product to be tested is tested, and the business record data at least includes a command packet and record data corresponding to the command packet;
[0027] The testing module is used to generate a test case according to the business record data, so as to test the product to be tested again according to the test case.
[0028] Optionally, the device further comprises a display module, which is used to:
[0029] Parsing the command packet according to the protocol rule corresponding to the parsing protocol type to obtain a parsing result of the command packet;
[0030] Generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data;
[0031] The test case is displayed; wherein the test case allows deletion, disabling and editing operations.
[0032] Optionally, the product to be tested includes at least a command sender and a command receiver; the business record data is generated by parsing the command packet sent by the command sender to the command receiver after the command sender copies the command packet when the business record function is turned on, and / or the command sender captures the command packet according to a pre-set data packet capture tool and then parses the generated data.
[0033] Optionally, the test case includes at least a business code, and the display module is specifically used to:
[0034] Convert the service code into a corresponding service function name;
[0035] The corresponding test cases are displayed according to the business function names.
[0036] Optionally, the test case includes at least the command packet and the service identifier of the command packet, the parsing protocol type, the command recipient address, the execution number and the command packet sending time, and the test module is specifically used to:
[0037] Calculate the use case execution interval time between each of the command packages according to the command package sending time;
[0038] Sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution numbers and the execution interval of the test case and the protocol rule corresponding to the parsed protocol type;
[0039] Receive a response packet sent by the command receiver in response to the command packet; wherein the response packet includes a service identifier of the command packet.
[0040] Optionally, the test case at least includes a test case state, and the device further includes an updating module, which is used to:
[0041] When the response packet sent by the command receiver to the command packet is not received within the specified timeout period, the use case status is updated to an execution failure status, and corresponding exception information is recorded in the test case.
[0042] Optionally, the update module is used to:
[0043] When receiving a response packet sent by the command receiver to the command packet within a specified timeout period, if the response packet cannot be parsed using the specified protocol rule, the response packet is discarded; if the response packet can be parsed using the specified protocol rule, the response packet is parsed according to the protocol rule corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure;
[0044] The use case status is updated according to the business response result.
[0045] The embodiments of the present invention include the following advantages:
[0046] The embodiment of the present invention obtains the business record data of the product to be tested, wherein the business record data is generated when the product to be tested is tested, and the business record data at least includes a command package and record data corresponding to the command package. Then, a test case can be generated according to the business record data, so that the product to be tested is tested again according to the test case. The embodiment of the present invention can generate business record data when the product to be tested is tested. Subsequently, if there is an abnormality during the test process of the product to be tested, the business record data of the product to be tested can be obtained, and the test case can be generated according to the business record data to test the product to be tested again. Since the test is performed again after the test case is generated according to the business record data generated when the product to be tested is tested, the problems existing when the product to be tested is tested can be fully reproduced, and the problems can be quickly found and solved. In addition, when testing the product to be tested, there is no need to manually write test cases, thereby improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flowchart of steps of an embodiment of a product testing method of the present invention;
[0048] Figure 2 It is a schematic diagram of an implementation environment of a product test of the present invention;
[0049] Figure 3 It is a schematic diagram of a process of capturing data packets based on the wireshark tool of the present invention;
[0050] Figure 4 It is a schematic diagram of a process of product testing by a use case generation system of the present invention;
[0051] Figure 5 It is a structural block diagram of an embodiment of a product testing device of the present invention. DETAILED DESCRIPTION
[0052] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] Reference Figure 1 , shows a flowchart of a product testing method embodiment of the present invention, which may specifically include the following steps:
[0054] Step 101: Acquire business record data of a product to be tested; wherein the business record data is generated when the product to be tested is tested, and the business record data at least includes a command package and record data corresponding to the command package.
[0055] Among them, the product can be a product with other functions such as video conferencing, and the product to be tested can be a product that needs to be tested again after the test. As a specific example, the product can at least include a command sender (client) and a command receiver (server). Taking the video conferencing product in the visual network as an example, the video conferencing product can include a client and a server (such as a management server and a core server, etc.). The client can initiate a service request (command packet) to the server to request the server to process the command packet. After the server completes the processing, it can return the corresponding response packet to the client.
[0056] Among them, the business record data is generated based on the command packet of the command sender, and the business record data may at least include the command packet and the record data corresponding to the command packet. The record data may at least include the execution number, the address of the command receiver (IP address + port / MAC address, etc.), the data source (0 means obtained from the product, 1 means obtained by the data packet capture tool), the parsing protocol type (0 means parsing according to the visual network protocol, 1 means parsing according to the private protocol of the conference server, 2 means parsing according to the private protocol of other products, 3...), the command packet sending time, etc. As an optional example, the data packet capture tool may be Wireshark, an open source data packet capture tool that supports user-defined plug-in functions.
[0057] In practice, when the tester needs to use the officially released product for the first time, the product can be tested according to the test case document (it can be either automatic or manual). In the process of testing the product, the corresponding business record data can be recorded, and after all test cases are tested according to the test case document, the business record data is saved as a business record data file in a local specified path or other location of the product. Later, if the product needs to be tested again, the product can be used as a product to be tested, and the business record data corresponding to the product to be tested can be obtained from the specified path. Since the embodiment of the present invention collects the corresponding business record data in the final draft of the product testing process, and the business record data includes the command packets that have been sent in the previous testing process, the previous product testing situation can be reproduced based on the business record data.
[0058] Specifically, the business record data may be obtained through the product itself or through a data packet capture tool. Optionally, the business record data is generated by the command sender copying the command packet sent by the command sender to the command receiver when the business record function is turned on, and / or the command sender captures the command packet according to a preset data packet capture tool and then parses the generated data.
[0059] 1) The process of obtaining business record data through the product itself is:
[0060] In the embodiment of the present invention, after the tester has deployed the test environment, before testing the product, the command initiator service recording function of the product can be enabled (the prerequisite for generating a test case is that all products in the test environment have been running and are available). The command initiator service recording function is mainly used to record the service record data related to the service request initiated by the command initiator to the command receiver.
[0061] For example, take the case where the video network's conference control client initiates a control request to the conference management server: the conference control client sends a conference control command to the conference management server to test conference-related functions, and the business record function of the conference control client needs to be enabled. For another example, take the case where the video network's client initiates a login request to the conference management server: after the client is started, a login interface pops up, and the user login request command is encapsulated according to the user name and password entered by the user. The command packet of the login request command is sent to the packet sending queue to initiate a login to the conference management server. The client sends a login command to the conference management server to test conference login-related functions, and the business record function of the client needs to be enabled.
[0062] After the command sender turns on the business record function, before the command sender sends the command package to the command receiver, it can determine whether the locally configured business record function is started. If not, the business operation is performed according to the original business process; if started, the command package sent to the command receiver is copied, and the command package is parsed to obtain the business record data, where the business record data is saved in the following format: execution number, command receiver address (IP address + port / MAC address, etc.), command package details (that is, the command package saved intact), data source (0 means obtained from the product, 1 means obtained by the wireshark tool), parsing protocol type (0 means parsing according to the visual network protocol, 1 means parsing according to the private protocol of the conference management server, 2 means parsing according to the private protocol of other products, 3...), command package sending time, etc.
[0063] The execution number is the sequence number of multiple command packets sent by the command sender to the command receiver, for example, it can be 1, 2, 3, 4, etc. The detailed content of the command packet is the entire content of the command packet sent by the command sender to the command receiver, for example, the content may include:
[0064]
[0065] Json data is: {'code':'Business code','data_len':'Data length','data':{'user_name':
[0066] 'zhangsan','pwd':'tjsbsnc4gAAAAQUMxRjZCNzk1NDcz',....}}.
[0067] 2) The process of obtaining business record data through the data packet capture tool is as follows:
[0068] 2.1) If the product does not have a business record function or the confidentiality level of the product does not allow the capture of certain command packets, the wireshark tool provided by the use case generation system can be used to capture the command packets and parse the command packets to obtain business record data.
[0069] The data packets captured by the wireshark tool (data packets can include command packets and response packets) can be conditionally filtered. Testers can configure the provided wireshark tool according to current test requirements. For example, the settings that need to be configured are type, value, and protocol. Specifically:
[0070] type=TCP,value=IP:Indicates that only all TCP (Transmission Control Protocol) data packets that match the specified IP address are analyzed. If value is empty, all TCP protocol packets are analyzed.
[0071] type=v2v, value=MAC address: means only analyzing command packets that match the specified MAC address. If value is empty, all data packets that match the MAC address will be analyzed.
[0072] If type is empty, it means analyzing all data packets;
[0073] protocol = 0 or other values: 0 means parsing according to the visual network protocol, 1 means parsing according to the private protocol of the management server, 2 means parsing according to the private protocol of other products, 3...
[0074] It should be noted that type and value can be configured in combination, and protocol is mainly used in special scenarios.
[0075] After capturing the data packet, the wireshark tool can parse the captured data packet to obtain the data protocol format (TCP or MAC, etc.). If the data protocol format does not match the type and value configured by the wireshark tool, the next data packet is parsed. If the data protocol format matches the type and value configured by the wireshark tool, the packet data of the data packet is obtained and compared with the protocol value configured by the wireshark tool, the protocol rules corresponding to the protocol value are obtained for data parsing to determine whether it meets the corresponding protocol value. If it does, the data packet and the packet data of the data packet are obtained as business record data and written into the local data record file. The storage format of the business record data is: execution number, command recipient address (IP address + port / MAC address, etc.), command packet details, data source (0 means obtained from the product, 1 means obtained by the wireshark tool), parsing protocol type (0 means parsing according to the visual network protocol, 1 means parsing according to the private protocol of the conference management server, 2 means parsing according to the private protocol of other products, 3...), command packet sending time, etc.
[0076] The specific data analysis of the wireshark service capture plug-in is as follows. Taking the video networking protocol as an example, the video networking protocol header can be:
[0077]
[0078] For example, a data packet filtered by IP address is:
[0079] 21 00 01 01 00 00 01 00 0a ba 05 00 03ba 30 00 01 0a 0b 00 0c00......
[0080] The wireshark tool first intercepts the first two bytes of data (21 00) to determine whether it belongs to the business message type in the visual network (all businesses in the visual network have defined fixed values). If not, it returns to parse the next data packet;
[0081] If it is a business message type belonging to the visual networking, the third bit (01) is intercepted to see whether the transmission protocol conforms to the visual networking protocol (00 connection protocol, 01 unicast protocol, 02 multicast protocol). If it does not conform, the next data packet is returned for parsing;
[0082] If the transmission protocol conforms to the visual networking protocol, the 4th bit (01) response bit is intercepted to see if it conforms to the visual networking protocol (00 response packet, 01 command packet). If it does not conform or the value is 00 (only the command packet sent is recorded, and the response packet returned by the server is not recorded), then the next data packet is returned for parsing;
[0083] If the response bit conforms to the visual networking protocol, the length type of the fifth bit (00) is intercepted to see if it conforms to the visual networking protocol (00 means 64 bytes, 01 means 280 bytes, and 02 means 1050 bytes). If it does not conform, the next data packet is returned for parsing;
[0084] If the length type conforms to the visual network protocol, it means that the data packet is a command packet of the visual network. The wireshark tool obtains the entire content of the data packet as business record data and writes it into the local business record data file. The format of the business record data is: execution number, command recipient address (IP address + port / MAC address, etc.), command packet details (21 00 01 01 00 00 01 00 0a ba05 00 03ba 30 00 01 0a 0b 00 0c 00...), data source (0 means obtained from the product, 1 means obtained by the wireshark tool), parsing protocol type (0 means parsing according to the visual network protocol, 1 means parsing according to the private protocol of the conference management server, 2 means parsing according to the private protocol of other products, 3...), command packet sending time, etc.
[0085] Of course, the business record data can also be obtained by using the business record function of the product itself or other methods other than the data packet capture tool, and the embodiment of the present invention does not need to be limited to this. In addition, the product testing method of the embodiment of the present invention can be applied to various network environments besides the visual network, such as the Internet, Ethernet, IP network or hybrid network, etc., and the embodiment of the present invention also does not need to be limited to this.
[0086] Step 102: Generate a test case according to the business record data, so as to test the product to be tested again according to the test case.
[0087] In the embodiment of the present invention, after obtaining the business record data of the product to be tested, a test case can be generated according to the business record data, and then the product to be tested can be tested again according to the test case. It should be noted that since the test case during the retest is generated based on the business record data generated during the previous test, the test environment during the previous test can be completely reproduced, and the anomaly can be found and resolved more quickly.
[0088] Reference Figure 2, is a schematic diagram of an implementation environment of a product test of the present invention. The embodiment of the present invention can be applied to a use case generation system. When a product needs to be tested, the use case generation system can import the business record data of the product to be tested from the product to be tested, and then generate a test case based on the business record data, so that the product to be tested can be tested again using the test case. For example, the use case generation system can send a command packet to a command receiver that sends the product to be tested in the same sending order and time interval.
[0089] In the above-mentioned product testing method, business record data can be generated when testing the product to be tested. Subsequently, if there is an abnormality during the testing process of the product to be tested, the business record data of the product to be tested can be obtained to generate test cases based on the business record data to test the product to be tested again. Since the test cases are generated based on the business record data generated when the product to be tested is tested again, the problems existing when testing the product to be tested can be reproduced, and the problems can be quickly found and solved. In addition, when testing the product to be tested, there is no need to manually write test cases, thereby improving the testing efficiency.
[0090] In a preferred embodiment of the present invention, the step 101 of obtaining the business record data of the product to be tested includes:
[0091] In response to the selection request, selecting a product to be tested from a number of products;
[0092] The corresponding business record data is obtained locally from the product to be tested.
[0093] In the specific implementation, there can be multiple products that store business record data. The tester can send a selection request to the use case generation system. The use case generation system can obtain the product to be tested from multiple products according to the selection request, and then obtain the corresponding business record data from the local of the product to be tested. For example, the product may include a management server, a core server, etc. The tester can select the product corresponding to the management server or the core server as the product to be tested according to the needs, and then click to import the business record data corresponding to the product to be tested, and then the use case generation system can automatically generate a test case based on the imported business record data.
[0094] In the above embodiment, the tester can select the corresponding product to be tested according to actual needs, and then obtain the business record data of the product to be tested to generate a test case, so as to test the product to be tested according to the test case, thereby improving the test efficiency of the tester.
[0095] In a preferred embodiment of the present invention, the recorded data at least includes a parsing protocol type. Before the step 102 of generating a test case according to the business recorded data, the method further includes:
[0096] Parsing the command packet according to the protocol rule corresponding to the parsing protocol type to obtain a parsing result of the command packet;
[0097] Generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data;
[0098] The test case is displayed; wherein the test case allows deletion, disabling and editing operations.
[0099] In an embodiment of the present invention, after obtaining the business record data of the product to be tested, the use case generation system obtains the parsing protocol type in each business record for each piece of business record data, parses according to the protocol rules corresponding to the parsing protocol type, and obtains the parsing result, wherein the parsing result may at least include the business message type (a data packet of a visual network or other network) or the business code (1 for scheduling a meeting, 2 for starting a meeting, 3 for stopping a meeting...), a business identifier (used to uniquely identify the corresponding data packet), and then, based on the parsing result of the command packet and the record data of the business record data, a test case corresponding to the business record data can be generated and saved in a specified use case database.
[0100] As a specific example, the content of the test case may at least include: the name of the product under test, the address of the command recipient (IP address + port / MAC address, etc.), execution number, business code, business identification, data source, parsing protocol type, detailed content of the command packet, command packet sending time, use case status (not executed / in business / successful / failed), execution start time, time consumed, exception information, etc.
[0101] Furthermore, the test cases can be displayed to the testers in the case generation system, and the testers can delete, disable and edit the test cases according to actual needs. Specifically, the case generation system displays the generated test cases, and the testers can delete or disable invalid test cases. In addition, in order to make the test cases adapt to various environments, the testers can also edit the selected test cases. Specifically, the editing operation of the test cases can at least include: 1) the command receiver address of a single test case or all test cases can be modified with one click; 2) a parameter of a single test case can be replaced: the case generation system obtains the detailed data of the test case, parses each value in the command package according to the protocol rules corresponding to the parsing protocol type, and displays it in the parameter editing interface, and the testers can modify and save it; 3) the specified single or multiple attribute parameters can be modified with one click (such as user_name, token_id attributes, etc.): parse the business packages (command packages) of all test cases one by one, and find out whether there are attribute names that need to be modified in the content of the business package according to the protocol, and if there are, replace them with the values modified by the testers.
[0102] In the above embodiment, the command packet is parsed according to the protocol rules corresponding to the parsing protocol type to obtain the parsing result of the command packet, and then the test case corresponding to the business record data can be generated and displayed according to the parsing result of the command packet and the record data in the business record data, wherein the generated test case allows the tester to perform deletion operations, disabling operations and editing operations, so that the product testing can be better completed according to the actual situation and the testing efficiency can be improved.
[0103] In a preferred embodiment of the present invention, the test case includes at least a business code, and the presenting of the test case includes:
[0104] Convert the service code into a corresponding service function name;
[0105] The corresponding test cases are displayed according to the business function names.
[0106] In a specific implementation, each test case has its corresponding business function, which is identified by a business code in the test case, for example, 1 represents booking a meeting, 2 represents starting a meeting, 3 represents stopping a meeting, and so on.
[0107] In an embodiment of the present invention, the business code can be converted into the corresponding business function name, i.e., scheduling a meeting, starting a meeting or stopping a meeting, etc., and then the corresponding test cases are displayed in the use case generation system according to the business function name, so that testers can better perform product testing according to the business functions of the test cases.
[0108] In the above embodiment, the business code of the test case is converted into the corresponding business function name, and the corresponding test case is displayed according to the business function name, so that the tester can quickly confirm the business function of each test case, thereby improving the testing efficiency.
[0109] In a preferred embodiment of the present invention, the test case includes at least the command packet and the service identifier of the command packet, the parsing protocol type, the command recipient address, the execution number and the command packet sending time, and the step 102 of generating the test case according to the service record data includes:
[0110] Calculate the use case execution interval time between each of the command packages according to the command package sending time;
[0111] Sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution numbers and the execution interval of the test case and the protocol rule corresponding to the parsed protocol type;
[0112] Receive a response packet sent by the command receiver in response to the command packet; wherein the response packet includes a service identifier of the command packet.
[0113] In an embodiment of the present invention, the test cases stored in the use case database are read, and the execution numbers of the test cases are sorted in ascending order. Then, the use case execution interval of each test case is calculated according to the command packet sending time in the test case (i.e., after a test case is executed, how long to wait before executing the next test case, where the use case execution interval can also be customized by the tester).
[0114] The command receiver address and command packet in the test case are obtained. The case generation system determines whether there is a connection with the server based on the command receiver address. If there is no connection, a communication connection is created based on the command receiver address (such as creating a TCP socket communication connection based on the IP address and port). If there is a connection, the command packet in the test case is sent to the command receiver corresponding to the command receiver address using the existing communication connection. Among them, the case generation system can obtain the business identifier in the test case. The case generation system can send the command packet containing the business identifier in the test case to the corresponding command receiver through the communication connection created with the command receiver. After receiving the command packet, the command receiver performs corresponding processing and returns a response packet corresponding to the command packet to the case generation system, wherein the response packet includes the business identifier of the command packet.
[0115] In the embodiment of the present invention, after the test case is executed, a test case execution report of the test case is generated, wherein the test case execution report may at least include information such as the execution result and time consumption of the test case.
[0116] In the above embodiment, after generating a test case based on the business record data, it is possible to determine how to send the command package in the test case to the command recipient based on the business identifier of the test case, the parsing protocol type, the command recipient address, the execution number and the command packet sending time. Since the command package can be sent to the command recipient under the same conditions as in the previous test, the process of the previous test can be replicated, and problems with the product can be quickly found and solved.
[0117] In a preferred embodiment of the present invention, the test case includes at least a case state, and after sending the command packet in the test case to the command recipient corresponding to the command recipient address in the order of the execution numbers and the sending time interval, the method further includes:
[0118] When the response packet sent by the command receiver to the command packet is not received within the specified timeout period, the use case status is updated to an execution failure status, and corresponding exception information is recorded in the test case.
[0119] In an embodiment of the present invention, the use case generation system records the sending time of the command packet in the test case corresponding to the business identifier. If it is determined based on the sending time that the response packet corresponding to the command packet returned by the command receiver is not received within the specified timeout period (the default is 10s), indicating that the command receiver has failed to process the response packet, the use case generation system records the use case status of the test case as an execution failure status, and records the error information (exceptional information) of the test case as: waiting for response timeout.
[0120] In the above embodiment, the use case status of the corresponding test case can be updated according to the execution status of the command package of the test case by the command recipient. For example, if the command recipient response package is not received within the specified timeout period, the corresponding use case status can be updated to an execution failure status, and the exception information of the test case can be recorded to facilitate subsequent finding of existing problems or continued testing.
[0121] In a preferred embodiment of the present invention, after receiving the response packet sent by the command recipient in response to the command packet, the method further includes:
[0122] When receiving a response packet sent by the command receiver to the command packet within a specified timeout period, if the response packet cannot be parsed using the specified protocol rule, the response packet is discarded; if the response packet can be parsed using the specified protocol rule, the response packet is parsed according to the protocol rule corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure;
[0123] The use case status is updated according to the business response result.
[0124] In an embodiment of the present invention, if it is determined based on the sending time that the response packet sent by the command receiver to the command packet is received within the specified timeout period, the use case generation system can further process the response packet to determine the use case execution status of the corresponding test case. Specifically, the use case generation system commands the response packet returned by the receiver within the specified timeout period, and then performs a matching check according to the protocol rules corresponding to the parsing protocol type stored in the use case generation system (such as the visual network protocol, the private protocol of the management server, the private protocol of other products, etc.), and if the response packet does not meet all protocol rules, it is discarded and not processed. If it meets a certain protocol rule, the response packet is parsed according to the protocol rule to obtain a business response result, wherein the business response result may include a business type, a business identifier, and a business response result. If the result field in the business response result (or other fields in the protocol that can determine the business processing result) is 0, it indicates that the business operation is successful, and if the result field is other values, it indicates that the business operation fails. If the business operation fails, the returned exception information can be obtained.
[0125] Subsequently, the use case generation system finds the corresponding test case according to the business identifier, changes the use case status of the test case, and records the use case execution result information of the test case. For example, if the business response result is that the business operation is successful, the use case status of the test case is updated to the use case execution success; if the business response result is that the business operation fails, the use case status of the test case is updated to the use case execution failure.
[0126] In the above embodiment, the use case status of the corresponding test case can be updated according to the execution status of the command package of the test case by the command recipient. For example, if the command recipient response package is received within the specified timeout period and the business response result obtained by parsing the response package is a successful business operation, the corresponding use case status is updated to execution failure. If the command recipient response package is received within the specified timeout period and the business response result obtained by parsing the response package is a business operation failure, the corresponding use case status is updated to execution failure, which makes it easier for testers to understand the execution status of the test case.
[0127] In order to enable those skilled in the art to better understand the technical solutions of the embodiments of the present invention, specific examples are given below for illustrative purposes.
[0128] Reference Figure 3, is a flow chart of capturing data packets based on the wireshark tool of the present invention. When the tester tests the product for the first time, the business recording function of the product can be enabled, or the command packet can be captured through the wireshark tool. If the command packet is captured through the wireshark tool, the wireshark tool can be configured so that the wireshark tool can obtain qualified command packets from multiple data packets for subsequent generation of test cases.
[0129] Specifically, assuming that the wireshark tool is configured to capture command packets of the visual network, the process of the wireshark tool capturing data packets may include:
[0130] The data packet captured by the Wireshark tool is then filtered according to specified conditions (such as IP address, port / mac address), etc.; according to the visual networking protocol, it is determined whether the data packet is a visual networking data packet. If the data packet is not a visual networking data packet, it is continued to be determined whether the next data packet is a visual networking data packet according to the visual networking protocol; if the data packet is a visual networking data packet, it is determined whether the data packet is a command packet. If the data packet is not a command packet, it is continued to be determined whether the next data packet is a visual networking data packet according to the visual networking protocol. If the data packet is a command packet, the command packet can be parsed to obtain the corresponding business record data.
[0131] Reference Figure 4 , is a schematic diagram of a process of a use case generation system of the present invention for testing a product. Specifically, the use case generation system can be mainly divided into three modules, namely, a use case generation module, a use case package issuing module, and a use case execution result analysis module, wherein:
[0132] Use case generation module: mainly parses the loaded business record data and generates test cases;
[0133] Use case packet sending module: mainly used to send command packets to the corresponding command receiver according to the test case when executing the test case;
[0134] Use case execution result analysis module: mainly collects the response package of each test case, parses the response package according to the protocol rules, obtains the business response results and error details, and records them in the use case database.
[0135] Specifically, the implementation contents of each module in the use case generation system include:
[0136] 1) Use case generation module: After the tester selects the product corresponding to the generated business record file (such as the management server, core server, etc.), clicks the Import Business Record File button, and the use case generation system automatically generates test cases based on the imported business record file. The test case generation process is as follows:
[0137] a. Read each business record data in the business record file, obtain the parsing protocol type of each business record data, obtain the business message type or business code, business identifier of the command package in the business record data according to the corresponding protocol rules, and translate the business code into the corresponding business function name (such as scheduling a meeting or ending a meeting, etc.), and then store these data in the use case database as test cases, including: the name of the product under test, the address of the command recipient (IP address + port / MAC address, etc.), execution number, business code, business identifier, data source, parsing protocol type, detailed content of the command package, command package sending time, use case status (not executed / in business / successful / failed), execution start time, time consumption, exception information, etc.
[0138] b. Display the generated test cases. Testers can delete invalid test cases or disable other operations such as erasing them.
[0139] c. In order to adapt the test cases to various environments, testers can also edit the selected test cases.
[0140] 2) The use case package module mainly executes the following contents on the generated test cases:
[0141] a. Read the use case list saved in the use case database, sort the execution numbers of the test cases in the use case list in ascending order, and obtain the parameters of each test case according to the execution number sequence, i.e., the service identifier, command packet sending time, command receiver address, command packet, etc.;
[0142] b. Calculate the test case execution interval between each test case based on the command packet sending time;
[0143] c. Send the command packet in the test case to the command receiver corresponding to the command receiver address;
[0144] 3) Use case execution result analysis module:
[0145] a. Receive the response packet returned by the command recipient, and perform a matching check according to the stored protocol rules (such as the visual networking protocol). If the response packet does not comply with the visual networking protocol, it is discarded and not processed;
[0146] b. If it complies with the visual networking protocol and the response package is received within the specified timeout period, the business type, business identifier and business response result are obtained according to the visual networking protocol, and the corresponding test case in the use case list is found according to the business identifier, and the use case status of the test case is changed (execution success status or execution failure status).
[0147] c. If the visual networking protocol is met but the response packet is not received within the specified timeout period, it means that the command receiver has failed to process the command. In this case, the test case status is updated to the execution failure status, and the error details are recorded: Waiting for response timeout.
[0148] d. Generate a test case execution report, which includes the test case execution results, time consumption and other information.
[0149] The embodiment of the present invention can reproduce the problems existing in the previous product test through the same operation, and the tester does not need to manually write test cases when testing the product again, thereby improving the test efficiency.
[0150] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0151] Reference Figure 5 , shows a structural block diagram of an embodiment of a product testing device of the present invention, which may specifically include the following modules:
[0152] The acquisition module 501 is used to acquire the business record data of the product to be tested; wherein the business record data is generated when the product to be tested is tested, and the business record data at least includes a command package and record data corresponding to the command package;
[0153] The testing module 502 is used to generate a test case according to the business record data, so as to test the product to be tested again according to the test case.
[0154] In a preferred embodiment of the present invention, the product to be tested includes at least a command sender and a command receiver; the business record data is generated by parsing the command packet sent by the command sender to the command receiver after the command sender copies the command packet when the business record function is turned on, and / or the command sender captures the command packet according to a preset data packet capture tool and then generates the data by parsing.
[0155] In a preferred embodiment of the present invention, the acquisition module 501 specifically includes:
[0156] In response to the selection request, selecting a product to be tested from a number of products;
[0157] The corresponding business record data is obtained locally from the product to be tested.
[0158] In a preferred embodiment of the present invention, the device further comprises a display module, which is used for:
[0159] Parsing the command packet according to the protocol rule corresponding to the parsing protocol type to obtain a parsing result of the command packet;
[0160] Generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data;
[0161] The test case is displayed; wherein the test case allows deletion, disabling and editing operations.
[0162] In a preferred embodiment of the present invention, the test case includes at least a business code, and the display module is specifically used for:
[0163] Convert the service code into a corresponding service function name;
[0164] The corresponding test cases are displayed according to the business function names.
[0165] In a preferred embodiment of the present invention, the test case includes at least the command packet and the service identifier of the command packet, the parsing protocol type, the command recipient address, the execution number and the command packet sending time, and the test module 502 is specifically used to:
[0166] Calculate the use case execution interval time between each of the command packages according to the command package sending time;
[0167] Sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution numbers and the execution interval of the test case and the protocol rule corresponding to the parsed protocol type;
[0168] Receive a response packet sent by the command receiver in response to the command packet; wherein the response packet includes a service identifier of the command packet.
[0169] In a preferred embodiment of the present invention, the test case at least includes a test case state, and the device further includes an updating module for:
[0170] When the response packet sent by the command receiver to the command packet is not received within the specified timeout period, the use case status is updated to an execution failure status, and corresponding exception information is recorded in the test case.
[0171] In a preferred embodiment of the present invention, the update module is used to:
[0172] When receiving a response packet sent by the command receiver to the command packet within a specified timeout period, if the response packet cannot be parsed using the specified protocol rule, the response packet is discarded; if the response packet can be parsed using the specified protocol rule, the response packet is parsed according to the protocol rule corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure;
[0173] The use case status is updated according to the business response result.
[0174] The embodiment of the present invention can generate business record data when testing the product to be tested. Subsequently, if there is an abnormality during the test process of the product to be tested, the business record data of the product to be tested can be obtained to generate test cases based on the business record data to test the product to be tested again. Since the test case is generated based on the business record data generated when the product to be tested is tested again, the problem existing when the product to be tested is tested can be reproduced, and the problem can be quickly found and solved. In addition, when testing the product to be tested, there is no need to manually write test cases, thereby improving the test efficiency.
[0175] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0176] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0177] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0178] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0179] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0182] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0183] The product testing method, product testing device, electronic device and storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A product testing method, characterized in that: The method comprises: Acquire business record data corresponding to the product to be tested locally; wherein the business record data is generated when the product to be tested is previously tested, and the business record data at least includes a command packet and record data corresponding to the command packet; the record data at least includes a parsing protocol type, and the business record data is generated based on the command packet; Parsing the command packet according to the protocol rule corresponding to the parsing protocol type to obtain a parsing result of the command packet; Generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data; the test case at least includes the command packet and the business identifier of the command packet, the parsing protocol type, the command recipient address, the execution number and the command packet sending time; Displaying the test case; wherein the test case allows deletion, disabling and editing operations; Calculate the use case execution interval time between each of the command packages according to the command package sending time; Sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution numbers and the execution interval of the test case and the protocol rule corresponding to the parsed protocol type; receiving a response packet sent by the command receiver in response to the command packet; wherein the response packet includes a service identifier of the command packet; When receiving a response packet sent by the command receiver to the command packet within a specified timeout period, if the response packet cannot be parsed using the specified protocol rule, the response packet is discarded; if the response packet can be parsed using the specified protocol rule, the response packet is parsed according to the protocol rule corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure; Update the use case status according to the business response result; The product to be tested is tested again according to the test case to reproduce the test environment when the product to be tested is tested previously.
2. The method according to claim 1, characterized in that The product to be tested includes at least a command sender and a command receiver; the business record data is generated by the command sender copying the command packet sent by the command sender to the command receiver when the business record function is turned on, and / or the command sender captures the command packet according to a preset data packet capture tool and then parses the generated data.
3. The method according to claim 1, characterized in that The test case includes at least a business code, and the presenting of the test case includes: Convert the service code into a corresponding service function name; The corresponding test cases are displayed according to the business function names.
4. The method according to claim 1, characterized in that The test case at least includes a case state. After sending the command packet in the test case to the command recipient corresponding to the command recipient address in the order of the execution numbers and the sending time interval, the method further includes: When the response packet sent by the command receiver to the command packet is not received within the specified timeout period, the use case status is updated to an execution failure status, and corresponding exception information is recorded in the test case.
5. A product testing device, characterized in that: The device comprises: An acquisition module is used to acquire business record data corresponding to the product to be tested from the local device of the product to be tested; wherein the business record data is generated when the product to be tested is previously tested, and the business record data at least includes a command packet and record data corresponding to the command packet; the record data at least includes a parsing protocol type, and the business record data is generated based on the command packet; A display module is used to parse the command packet according to the protocol rules corresponding to the parsing protocol type to obtain the parsing result of the command packet; generate a test case corresponding to the business record data according to the parsing result of the command packet and the record data in the business record data; the test case at least includes the command packet and the business identifier of the command packet, the parsing protocol type, the command recipient address, the execution number and the command packet sending time; and display the test case; wherein the test case allows deletion, disabling and editing operations; A test module, used for calculating the use case execution interval between each command package according to the command package sending time; sending the command package in the test case to the command receiver corresponding to the command receiver address according to the order of the execution number and the use case execution interval and the protocol rule corresponding to the parsing protocol type; receiving a response package sent by the command receiver for the command package; wherein the response package includes the service identifier of the command package; testing the product to be tested again according to the test case to reproduce the test environment of the product to be tested when it was previously tested; An update module is used for, when receiving a response packet sent by the command recipient to the command packet within a specified timeout period, discarding the response packet if the response packet cannot be parsed using the specified protocol rules; if the response packet can be parsed using the specified protocol rules, parsing the response packet according to the protocol rules corresponding to the parsing protocol type corresponding to the business identifier of the response packet to obtain the business response result of the test case; wherein the business response result includes a business operation success or a business operation failure; and updating the use case status according to the business response result.
6. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the apparatus to perform the product testing method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer program stored therein enables the processor to execute the product testing method as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Automatic test system
CN111309533A
Automatic test method and device, computer device and storage medium
CN112631911A
Firmware testing method, server and computer readable storage medium
CN113127338A
Interface testing method and device
CN113312259A
Equipment testing method and device, terminal equipment and storage medium
CN113794602A
