Test system, test method, readable storage medium and computer program product
By automatically replacing and verifying the requested data in software interface tests, the accuracy and efficiency problems caused by manual writing are solved, and efficient and accurate test results are achieved.
Patent Information
- Application Number
- CN202411178146.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-20
AI Technical Summary
During the software development life cycle, manual writing of requested data required for software interface tests is prone to missed or misprogrammed, which affects the accuracy of the test results and reduces the testing efficiency.
By automatically replacing the first sub-data in the pre-acquisitioned request data with the pre-configured second sub-data, and performing data checksum based on the replaced request data, avoiding manual writing process, improving testing efficiency and accuracy.
It realizes automatic verification of data accuracy, ensures the accuracy and efficiency of test results, reduces errors caused by manual writing, and improves the level of test automation.
Smart Images

Figure CN119166500A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of automated testing technology, and in particular to a testing system, a testing method, a readable storage medium, and a computer program product. Background Art
[0002] In the software development life cycle, the testing phase plays a key role in ensuring product quality. In related technologies, testers are required to manually write the request data required for software interface testing. However, if omissions or errors occur during the manual writing process, the accuracy of the test results will be affected, and manual writing will lead to low test efficiency. Summary of the invention
[0003] In order to solve one of the above technical problems, the present disclosure provides a testing system, a testing method, a readable storage medium and a computer program product.
[0004] According to one aspect of the present disclosure, a test system is provided, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the computer program and the processor perform the following process: replacing first sub-data in pre-collected request data with pre-configured second sub-data; inputting the replaced request data into a test object, and obtaining response data of the test object for the replaced request data; performing data verification on the response data based on the replaced request data to obtain a data verification result; and generating a test report according to the replaced request data, the response data and the data verification result.
[0005] According to at least one embodiment of the present disclosure, replacing the first sub-data in the pre-collected request data with the pre-configured second sub-data includes: matching the first identifier with the identifier of the sub-data in the pre-collected request data and the identifier of the pre-configured sub-data, respectively; using the sub-data corresponding to the identifier in the request data that matches the first identifier as the first sub-data; using the pre-configured sub-data corresponding to the identifier that matches the first identifier as the second sub-data; and replacing the first sub-data in the request data with the second sub-data.
[0006] According to at least one embodiment of the present disclosure, the performing data verification on the response data based on the replaced request data includes: in response to the type of the second sub-data being the first type, performing data verification on the response data based on the replaced request data to obtain the data verification result.
[0007] According to at least one embodiment of the present disclosure, the data verification of the response data based on the replaced request data includes: determining a target data verification script corresponding to the field content of the target field in the response data according to a mapping relationship between the field content and the data verification script; and running the target data verification script based on the response data and the replaced request data, wherein the target data verification script is used to perform data verification on the response data.
[0008] According to at least one embodiment of the present disclosure, the field content of the target field includes completion of a product order, the replaced request data includes the requested order quantity, the response data includes the actual order quantity, the product inventory quantity before the order, and the product inventory quantity after the order, and running the target data verification script based on the response data and the replaced request data includes: calculating the difference between the product inventory quantity before the order and the requested order quantity; verifying whether the product inventory quantity after the order is the same as the difference; and checking whether the actual order quantity is the same as the requested order quantity.
[0009] According to at least one embodiment of the present disclosure, it also includes: in response to the commodity inventory quantity after the order is placed being the same as the difference, and the actual order quantity is the same as the requested order quantity, determining that the data verification result is passed; and in response to the commodity inventory quantity after the order is placed being different from the difference, or the actual order quantity is different from the requested order quantity, determining that the data verification result is failed.
[0010] According to at least one embodiment of the present disclosure, after obtaining the response data of the test object to the replaced request data, it also includes: in response to the type of the second sub-data being the second type, generating the test report according to the replaced request data and the response data.
[0011] According to at least one embodiment of the present disclosure, generating the test report based on the replaced request data and the response data includes: determining business rule data corresponding to the request data; and performing data analysis on the replaced request data and the response data based on the business rule data to obtain the test report.
[0012] According to at least one embodiment of the present disclosure, it also includes: in response to the identifier of the second sub-data including the second identifier, determining that the type of the second sub-data is the first type; and in response to the identifier of the second sub-data not including the second identifier, determining that the type of the second sub-data is the second type.
[0013] According to at least one embodiment of the present disclosure, generating a test report based on the replaced request data, the response data and the data verification result includes: determining the business rule data corresponding to the request data; and performing data analysis on the replaced request data, the response data and the data verification result based on the business rule data to obtain the test report.
[0014] According to at least one embodiment of the present disclosure, the method further includes: when the data verification result is failed, a direct reason for the failure is prompted.
[0015] According to another aspect of the present disclosure, a testing method is provided, comprising: replacing first sub-data in pre-collected request data with pre-configured second sub-data; inputting the replaced request data into a test object, and obtaining response data of the test object to the replaced request data; performing data verification on the response data based on the replaced request data to obtain a data verification result; and generating a test report based on the replaced request data, the response data and the data verification result.
[0016] According to another aspect of the present disclosure, a readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the above method.
[0017] According to another aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it is at least used to implement the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0019] Figure 1 It is a schematic diagram of an application scenario of a test system according to an embodiment of the present disclosure.
[0020] Figure 2 It is a flowchart of a testing method according to an embodiment of the present disclosure.
[0021] Figure 3 It is a schematic diagram of a process of processing collected request data according to an embodiment of the present disclosure.
[0022] Figure 4 It is a schematic diagram of a process of storing partial sub-data according to an embodiment of the present disclosure.
[0023] Figure 5 It is a schematic diagram of the data verification process according to an embodiment of the present disclosure.
[0024] Figure 6 It is a schematic block diagram of the structure of a test system using a hardware implementation of a processor according to an embodiment of the present disclosure.
[0025] Figure 7 is another schematic flow chart of a testing method according to an embodiment of the present disclosure.
[0026] Figure 8 It is a schematic diagram of a process of replacing first sub-data according to an embodiment of the present disclosure.
[0027] Fig. 9 It is another flow chart of the testing method according to the embodiment of the present disclosure.
[0028] Fig.10 is another schematic diagram of the data verification process according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] The present disclosure is further described in detail below in conjunction with the accompanying drawings and examples. It is understood that the specific examples described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0030] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0031] When the software provides services to users, online traffic data can be collected during the operation of the software. Online traffic data may include request data. Since some sub-data in the request data comes from the real online environment, and the sub-data of the online environment (such as user name, product name, etc.) may not be used in the test environment or cannot be reproduced in the test environment, the request data collected online cannot be directly used for testing. If the request data for testing is rewritten manually, it is inevitable that data will be missed or wrongly compiled, which will lead to poor accuracy of the test results and low test efficiency.
[0032] In order to solve the above problems, the present invention automatically replaces the first sub-data in the pre-collected request data, and uses the replaced request data for testing, thereby avoiding the need to write request data on hand and improving test efficiency. At the same time, during the test process, data verification and test report generation steps are added, which can automatically verify data accuracy, thereby ensuring the accuracy of the test results.
[0033] Figure 1 The application scenario of the test system of the embodiment of the present disclosure is shown. In this application scenario, a test system 1000, a first electronic device 2000, a second electronic device 3000 and a database 4000 may be included. The test system 1000 can communicate with the first electronic device 2000 and the second electronic device 3000 respectively, and the test system 1000 can access the database 4000, in which the pre-configured second sub-data are stored. The first electronic device may be provided with a target object, and the test system 1000 can collect request data triggered during the user's use of the target object on the first electronic device 2000. The test system may be provided with a test object, and the test object and the target object are the same object, but the target object is used in an online real environment, and the test object is used in an offline test environment. The tester can send a test instruction to the test system 1000 through the second electronic device 3000. When the test system 1000 receives the test instruction, it replaces the first sub-data in the pre-collected request data with the second sub-data in the database 4000, and tests the test object based on the replaced request data, and sends the test report to the second electronic device 3000 when a test report is generated, so that the tester can learn the test results through the second electronic device 3000. In the present disclosure, the first electronic device 2000 and the second electronic device 3000 include but are not limited to mobile phones, tablet computers, laptops, personal computers, wearable devices, ATMs, etc. respectively. The test object includes but is not limited to interfaces or software. The test system 1000 can be a server, and the server can be a server with a physical form or a cloud server. The present disclosure does not limit the type of server.
[0034] Figure 2 A flow chart of the testing method according to an embodiment of the present disclosure is shown. Figure 2 The detailed description is for a clearer understanding of the technical solution of the present disclosure and should not be considered as a limitation of the protection scope of the present disclosure. In the process of implementing the technical idea of the present disclosure, one or some steps may be omitted, or other alternatives may be adopted.
[0035] In step S201, the request data of the target object is collected in advance to obtain real online traffic data, providing an effective data environment for subsequent tests. For example, technical tools in related technologies (such as Nginx technology) can be used to "monitor" and store the actual operations of users in the software (i.e., the target object), such as browsing products, adding to shopping carts, placing orders, etc. These actual operations are captured and saved so that these user behaviors can be reproduced in subsequent tests to ensure that the test scenario is as close to the real world as possible. Please combine Figure 3After collecting the request data of the target object, the collected request data can be subjected to data persistence processing, data cleaning processing and data labeling processing in turn. The collected request data can be stored in the first database through data persistence processing, undesirable data in the collected request data can be removed through data cleaning processing, and the collected request data can be better identified through data labeling processing to facilitate subsequent calls.
[0036] It is understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, scope of use, and usage scenarios of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. For example, in response to receiving the user's active request, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require the acquisition and use of the user's personal information. Thus, the user can autonomously choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operation of the technical solution of the present disclosure according to the prompt message. As an optional but non-limiting implementation method, in response to receiving the user's active request, the method of sending the prompt message to the user can be, for example, a pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understood that the above notification and the process of obtaining user authorization are only illustrative and do not constitute a limitation on the implementation method of the present disclosure. Other methods that meet relevant laws and regulations can also be applied to the implementation method of the present disclosure. At the same time, it is understandable that the data involved in the technical solution of the present disclosure (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0037] In step S202, when the test instruction is received, the first sub-data in the pre-collected request data is replaced with the pre-configured second sub-data. The test instruction may include a target request data identifier, and the target request data identifier may be matched with the identifier of the request data stored in the first database, and then the request data whose identifier matches the target request data identifier is used for testing. The first sub-data can be understood as data in a real online environment, and the second sub-data can be understood as data in a test environment. By replacing the first sub-data with the second sub-data, the test on the request data can be smoothly carried out, which is conducive to improving the accuracy of the test results and the test efficiency. Exemplarily, the first identifier is matched with the identifier of the sub-data in the pre-collected request data and the identifier of the pre-configured sub-data respectively; the sub-data corresponding to the identifier matching the first identifier in the request data is used as the first sub-data; the pre-configured sub-data corresponding to the identifier matching the first identifier is used as the second sub-data; and the first sub-data in the request data is replaced with the second sub-data. In this way, the first sub-data in the request data is accurately replaced by the first identifier. The first identifier can be set in advance by relevant personnel according to the sub-data that needs to be replaced. The type of the first identifier can be one or more. For example, the first identifier can include a user name, a product name, etc. The similarity between the first identifier and the identifier of the sub-data can be calculated. If the similarity is greater than or equal to a similarity threshold, it is determined that the first identifier matches the corresponding sub-data identifier; if the similarity is less than the similarity threshold, it is determined that the first identifier does not match the corresponding sub-data identifier. The pre-configured sub-data is stored in the second database, which is conducive to the generation and management of sub-data. The storage process of some sub-data is as follows: Figure 4 As shown. The pre-configured sub-data may include detailed information of multiple "sub-objects" (such as users, products, orders, etc.) in the target object. The detailed information includes but is not limited to the attributes of the sub-objects (such as the user's name, the name of the product, the price of the product, the inventory quantity of the product, etc.) and the business rules that these attributes should follow (such as the price cannot be a negative number). In this way, the sub-data in the second database is used to replace the first sub-data in the request data, which can ensure that the replaced request data is both true and complies with business rules. The data in the second database can be dynamically updated, and then the test scenario can be adjusted according to the request data and the latest sub-data in the second database. In this way, various possible user operations can be covered, ensuring that the test is both comprehensive and efficient. The first sub-data and the second sub-data can be metadata, so the request data contains metadata information.
[0038] In step S203, the replaced request data is input into the test object, and the response data of the test object to the replaced request data is obtained. Test cases can be automatically generated based on the replaced request data. Test cases are a series of test scenarios used to check whether the test object can work as expected. After the test case is generated, the test is automatically executed, for example, using an automation tool to simulate the user's operation, such as automatically clicking a button, filling out a form, etc., so as to obtain the response data of the test object to the replaced request data. This process can be automatically implemented, thereby saving a lot of time and manpower.
[0039] In step S204, it is determined whether to perform data verification. If so, step S205 is executed; if not, step S207 is executed. Whether to perform data verification can be determined based on the second identifier and the identifier of the second sub-data. For example, when the identifier of the second sub-data includes the second identifier, it is determined that the type of the second sub-data is the first type, that is, data verification is required; when the identifier of the second sub-data does not include the second identifier, it is determined that the type of the second sub-data is the second type, that is, no data verification is required. In this way, according to the second identifier and the identifier of the second sub-data, it is possible to accurately determine whether the second sub-data needs to be verified. The identifier of the second sub-data may include multiple identifiers. Therefore, even if one identifier of the second sub-data matches the first identifier, it is possible to continue to determine whether other identifiers of the second sub-data match the second identifier. The second identifier can be pre-set by relevant personnel. The second identifier can be the identifier of the sub-data that needs to be verified (for example, the sub-data that is prone to errors). In this way, data verification is performed only when the identifier of the second sub-data includes the second identifier, which ensures accuracy while improving test efficiency. In other embodiments of the present disclosure, data verification judgment may not be performed, and data verification is performed directly on all data, thereby maximizing the accuracy of the test results.
[0040] In step S205, the response data is verified based on the replaced request data to obtain a data verification result. In this way, it is possible to check whether the response of the test object meets expectations, and timely discover situations where the response data is consistent with the business rules, such as inconsistent order status, incorrect order amount calculation, etc. Exemplarily, when the type of the second sub-data is the first type, the response data is verified based on the replaced request data to obtain a data verification result. Further, according to the mapping relationship between the pre-stored field content and the data verification script, the target data verification script corresponding to the field content of the target field in the response data is determined; and the target data verification script is run based on the response data and the replaced request data, wherein the target data verification script is used to perform data verification on the response data, so that the response data can be automatically verified, thereby improving the test efficiency. The target field can be pre-set by relevant personnel. The mapping relationship between the field content and the data verification script can be pre-generated and stored in a designated storage area by relevant personnel, and the data verification script can also be pre-generated and stored in a designated storage area by relevant personnel, so as to facilitate calling during the test process. In one example, the field content of the target field includes the completion of the order of the goods, the replaced request data includes the requested order quantity, the response data includes the actual order quantity, the inventory quantity of the goods before the order is placed, and the inventory quantity of the goods after the order is placed. The target data verification script is run based on the response data and the replaced request data, including: calculating the difference between the inventory quantity of the goods before the order is placed and the requested order quantity; verifying whether the inventory quantity of the goods after the order is placed is the same as the difference; and verifying whether the actual order quantity is the same as the requested order quantity. In this way, the accuracy of the test results is improved through data consistency verification. In response to the fact that the inventory quantity of the goods after the order is placed is the same as the difference, and the actual order quantity is the same as the requested order quantity, the data verification result is determined to be passed. At this time, it can be considered that the reaction of the test object is basically in line with expectations. As for whether it really meets expectations, it should be further identified. In response to the fact that the inventory quantity of the goods after the order is placed is different from the difference, or the actual order quantity is different from the requested order quantity, the data verification result is determined to be failed. At this time, it can be considered that the reaction of the test object does not meet expectations. If the data verification result fails, the direct reason for the failure can be prompted, such as prompting that the inventory quantity of the goods after the order is placed is different from the difference, or the actual order quantity is different from the requested order quantity. Since the test object may call other objects during the work process, the response data may include the response data of multiple objects. The formats of the response data of multiple objects may be different. Accordingly, please combine Figure 5 Before determining the target data verification script, it also includes: standardizing the response data, converting the format of the response data into a standard format through standardization, so as to facilitate the smooth execution of the subsequent test process. In the case that the data verification result fails, error processing can also be performed to try to correct the error.
[0041] In step S206, a test report is generated according to the replaced request data, response data and data verification results. According to the mapping relationship between the request data identifier and the business rule data, the business rule data corresponding to the request data is determined; based on the business rule data, the replaced request data, response data and data verification results are analyzed to obtain a test report. In this way, it is possible to further determine whether the response of the test object meets expectations based on the business rule data. Exemplarily, the replaced request data, response data and data verification results can be input into a pre-trained machine learning model, the business rule data corresponding to the request data can be determined by the machine learning model, and the replaced request data, response data and data verification results are analyzed based on the business rule data to obtain a test report. In this way, the machine learning model can provide intelligent data analysis and test report generation functions, improve test efficiency and test report quality. The machine learning model can be trained using pre-annotated business rule data, data verification results, request data, response data and test reports. The trained machine learning model can analyze multiple factors, such as the complexity of the test case, the integrity of the data, the response time, etc., and then determine the root cause of the test failure, and output a detailed test report. The test report may include information about passed test cases, failed test cases, detailed analysis of failed test cases, etc. The detailed analysis of failed test cases may include the root cause of data verification failure or test failure and recommended improvement measures. For example, it may prompt that the test failed because of a problem with the value setting of a certain parameter, and it is recommended to change the value of the parameter to another value; or it may prompt that the test failed because the data input does not conform to the business logic; or it may prompt that the test failed because the response data is inconsistent with expectations. After the output test report is checked and confirmed by relevant personnel, it can be added to the training set of the machine learning model, and the machine learning model can be trained again using the changed training set, which is conducive to improving the accuracy of the machine learning model. In addition, the machine learning model can also provide intelligent test case writing functions, thereby improving the efficiency of test case writing.
[0042] In step S207, a test report is generated based on the replaced request data and response data. In this way, a test report can be generated based on the replaced request data and response data without the need for data verification, thereby saving the time required for testing and improving test efficiency. Exemplarily, when the type of the second sub-data is the second type, a test report is generated based on the replaced request data and response data. The replaced request data and response data can be input into a pre-trained machine learning model, the business rule data corresponding to the request data can be determined by the machine learning model, and the replaced request data and response data can be analyzed based on the business rule data to obtain a test report. In this way, the machine learning model can provide intelligent data analysis and test report generation functions, thereby improving test efficiency and test report quality. The machine learning model in step S207 may be the same as the machine learning model in step S206, and will not be repeated here for the sake of brevity.
[0043] In step S208, the test report is output, for example, the test report is sent to the issuer of the test instruction or the target person, so that the issuer of the test instruction or the target person can timely understand the test situation, quickly find and solve the problems of the test object, and ensure the quality and stability of the test object.
[0044] According to a further embodiment of the present disclosure, a test system is also provided. The test system may be a server, for example, a cloud server or a physical server.
[0045] Figure 6The schematic diagram of the test system is shown. The hardware structure of the test system 1000 of the present disclosure can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300 and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc. The bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 1100 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one connecting line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory 1300 stores a computer program. When the processor 1200 executes the computer program, the computer program and the processor 1200 can perform the following process.
[0046] S710 : replacing the first sub-data in the pre-collected request data with the pre-configured second sub-data. This process can be implemented by the data collection module 1002 .
[0047] S720 : Inputting the replaced request data into the test object, and obtaining the response data of the test object to the replaced request data. This process can be implemented by the data transmission module 1004 .
[0048] S730: Perform data verification on the response data based on the replaced request data to obtain a data verification result. This process can be implemented by the data verification module 1006.
[0049] S740: Generate a test report according to the replaced request data, response data and data verification results. This process can be implemented by the report generation module 1008.
[0050] For contents related to the test system, please refer to the above description, which will not be repeated here for the sake of brevity.
[0051] According to a further embodiment of the present disclosure, a testing method is also provided. Figure 6 The test system shown is implemented in Figure 7 1 shows a flow chart of a testing method according to the present disclosure. Figure 7As shown, the test method M700 may include step S710, step S720, step S730 and step S740.
[0052] S710: Replace the first sub-data in the pre-collected request data with the pre-configured second sub-data.
[0053] S720: Input the replaced request data into the test object, and obtain response data of the test object to the replaced request data.
[0054] S730: Perform data verification on the response data based on the replaced request data to obtain a data verification result.
[0055] S740: Generate a test report based on the replaced request data, response data and data verification results.
[0056] Please combine Figure 8 In some embodiments, step S710 may include: S711, matching the first identifier with the identifier of the sub-data in the pre-collected request data and the identifier of the pre-configured sub-data respectively; S712, using the sub-data corresponding to the identifier in the request data that matches the first identifier as the first sub-data; S713, using the pre-configured sub-data corresponding to the identifier that matches the first identifier as the second sub-data; and S714, replacing the first sub-data in the request data with the second sub-data.
[0057] Please combine Fig. 9 In some implementations, step S730 may include: S731. In response to the type of the second sub-data being the first type, performing data verification on the response data based on the replaced request data to obtain a data verification result.
[0058] Please combine Fig.10In some embodiments, step S730 may include: S732, determining the target data verification script corresponding to the field content of the target field in the response data according to the mapping relationship between the field content and the data verification script; and S733, running the target data verification script based on the response data and the replaced request data, wherein the target data verification script is used to perform data verification on the response data. Exemplarily, the field content of the target field includes the completion of the order of the product, the replaced request data includes the requested order quantity, the response data includes the actual order quantity, the inventory quantity of the product before the order is placed, and the inventory quantity of the product after the order is placed. Accordingly, step S733 includes: calculating the difference between the inventory quantity of the product before the order is placed and the requested order quantity; verifying whether the inventory quantity of the product after the order is placed is the same as the difference; and verifying whether the actual order quantity is the same as the requested order quantity. Step S733 also includes: in response to the fact that the inventory quantity of the goods after the order is placed is the same as the difference, and the actual order quantity is the same as the requested order quantity, determining that the data verification result is passed; and in response to the fact that the inventory quantity of the goods after the order is placed is different from the difference, or the actual order quantity is different from the requested order quantity, determining that the data verification result is failed.
[0059] In some embodiments, after step S720, the method further includes: in response to the type of the second sub-data being the second type, generating a test report according to the replaced request data and response data. Exemplarily, generating a test report according to the replaced request data and response data includes: determining the business rule data corresponding to the request data; and performing data analysis on the replaced request data and response data based on the business rule data to obtain a test report.
[0060] In some embodiments, the testing method further includes: in response to the identifier of the second sub-data including the second identifier, determining that the type of the second sub-data is the first type; and in response to the identifier of the second sub-data not including the second identifier, determining that the type of the second sub-data is the second type.
[0061] In some implementations, step S740 includes: determining business rule data corresponding to the request data; and performing data analysis on the replaced request data, response data, and data verification results based on the business rule data to obtain a test report.
[0062] In some implementations, the testing method further includes: in the case where the data verification result is a failure, indicating a direct reason for the failure.
[0063] For details about the test method, please refer to the above description, which will not be repeated here for the sake of brevity.
[0064] The present disclosure also provides a readable storage medium, in which a computer program is stored, and the computer program is used to implement the above method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0065] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part.
[0066] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.
[0067] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure 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 code.
[0068] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of 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 device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing 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.
[0069] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising 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.
[0070] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0071] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.
[0072] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0073] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A testing system, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, the computer program and the processor perform the following process: Replacing the first sub-data in the pre-collected request data with the pre-configured second sub-data; Inputting the replaced request data into the test object, and obtaining response data of the test object to the replaced request data; Performing data verification on the response data based on the replaced request data to obtain a data verification result; as well as A test report is generated according to the replaced request data, the response data and the data verification result.
2. The test system according to claim 1, characterized in that: The replacing the first sub-data in the pre-collected request data with the pre-configured second sub-data includes: Matching the first identifier with the identifier of the sub-data in the request data collected in advance and the identifier of the pre-configured sub-data respectively; taking the sub-data corresponding to the identifier matching the first identifier in the request data as the first sub-data; using the pre-configured sub-data corresponding to the identifier matching the first identifier as the second sub-data; and The first sub-data in the request data is replaced by the second sub-data.
3. The test system according to claim 1, characterized in that: The performing data verification on the response data based on the replaced request data includes: In response to the type of the second sub-data being the first type, performing data verification on the response data based on the replaced request data to obtain the data verification result.
4. The test system according to claim 1 or 3, characterized in that: The performing data verification on the response data based on the replaced request data includes: Determining a target data verification script corresponding to the field content of the target field in the response data according to a mapping relationship between the field content and the data verification script; and The target data verification script is run based on the response data and the replaced request data, wherein the target data verification script is used to perform data verification on the response data.
5. The test system according to claim 4, characterized in that: The field content of the target field includes that the order of the product is completed, the replaced request data includes the requested order quantity, the response data includes the actual order quantity, the inventory quantity of the product before the order is placed, and the inventory quantity of the product after the order is placed, and the running of the target data verification script based on the response data and the replaced request data includes: Calculate the difference between the inventory quantity of the product before placing the order and the requested order quantity; Verifying whether the inventory quantity of the product after the order is placed is the same as the difference; and Check whether the actual order quantity is the same as the requested order quantity.
6. The test system according to claim 5, characterized in that: Also includes: In response to the post-order commodity inventory quantity being the same as the difference, and the actual order quantity being the same as the requested order quantity, determining that the data verification result is passed; as well as In response to the post-order commodity inventory quantity being different from the difference, or the actual order quantity being different from the requested order quantity, determining that the data verification result is failed.
7. The test system according to claim 1, characterized in that: The generating a test report according to the replaced request data, the response data and the data verification result includes: Determining business rule data corresponding to the request data; and The replaced request data, the response data and the data verification result are analyzed based on the business rule data to obtain the test report.
8. A testing method, characterized in that: include: Replacing the first sub-data in the pre-collected request data with the pre-configured second sub-data; Inputting the replaced request data into the test object, and obtaining response data of the test object to the replaced request data; Performing data verification on the response data based on the replaced request data to obtain a data verification result; as well as A test report is generated according to the replaced request data, the response data and the data verification result.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and the computer program is used to implement the method according to claim 8 when executed by a processor.
10. A computer program product, characterized in that The computer program product comprises a computer program, which is used to implement at least the method according to claim 8 when executed by a processor.
