Excel-based automated testing method, electronic device, and readable storage medium
By converting user reports in XML format into JSON object format and combining them with expected test results in an Excel spreadsheet, standard test results are generated and compared. This solves the problems of time-consuming data processing, character limitations, and difficulty in validating dynamic values in existing Excel spreadsheet testing methods, and achieves efficient and accurate automated testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-02-16
- Publication Date
- 2026-04-28
AI Technical Summary
Existing testing methods based on Excel spreadsheets require manual processing of expected test results, which is time-consuming and prone to errors. Character length limitations and unordered dynamic values also make verification difficult.
By generating standard test results, the user reports in XML format are formatted into JSON object format, combined with the expected test results in the Excel spreadsheet to form standard test results, and compared with the actual test results to generate an automatic test report.
It improves testing efficiency, avoids oversights caused by manual processing, overcomes character length limitations, and ensures the accuracy and coverage of dynamic value verification.
Smart Images

Figure CN116225926B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to an automated testing method, apparatus, electronic device, and readable storage medium based on Excel. Background Technology
[0002] Current test comparison methods based on Excel spreadsheets improve testing efficiency and provide testers with more readable test reports by automating test cases and comparing them with expected test results. However, the expected test results have at least the following problems:
[0003] 1) All expected test results in Excel need to be manually compiled by the testers, which is not only time-consuming, but also prone to omissions due to manual compilation;
[0004] 2) Excel has a limit on the length of characters in a cell. When the content to be validated is very large, the goal of full validation cannot be achieved.
[0005] 3) If some fields of the content to be verified are dynamic values or the data structure is unordered, direct matching and comparison cannot be performed.
[0006] To address the aforementioned issues, there is an urgent need to provide an automated testing method based on Excel. Summary of the Invention
[0007] This invention provides an automated testing method, apparatus, electronic device, and computer-readable storage medium based on Excel. Its main purpose is to improve testing efficiency by generating standard test results and comparing them with pre-acquired actual test results to generate a test report.
[0008] To achieve the above objectives, the present invention provides an Excel-based automated testing method applied to electronic devices, the method comprising:
[0009] Send a target user query request. When a return message containing the target user name is received, extract the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0010] Format the XML-formatted user report into a JSON object-formatted user report;
[0011] The user report in JSON object format is combined with the solid and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result;
[0012] The standard test results are compared with the pre-acquired actual test results, and the comparison results are used to generate an automatic test report.
[0013] Optionally, if a return message without a target username is received, the expected test result of the test case will be read from a pre-set Excel spreadsheet as the standard test result.
[0014] Optionally, if no user report corresponding to the target user name exists in the preset baffle library, the default XML format user report is extracted and formatted into a JSON object format user report.
[0015] Optionally, formatting the XML-formatted user report into a JSON object format user report includes the following steps:
[0016] The extracted user reports in XML format corresponding to the target user names are formatted into user reports in JSON string format;
[0017] The user report in JSON string format is formatted as a user report in JSON object format.
[0018] Optionally, the dynamic fields in the expected test results are represented by regular expressions, wherein the dynamic fields represent the time and IP of the expected test results.
[0019] Optionally, the solid field in the expected test result is represented in a fixed SQL format, wherein the solid field represents an identifier indicating that the expected test result has been completed.
[0020] Optionally, the method for obtaining the actual test results includes the following steps:
[0021] Read test cases from the pre-set Excel spreadsheet. The test cases include user information, order parameters, query interface and expected test results.
[0022] Initialize the interface instance based on the user information in the test case;
[0023] The interface instance is invoked to perform the test based on the report parameters in the test case.
[0024] Based on the query interface in the test case, query the data related to the report parameters after the test is completed, so as to generate the actual test results.
[0025] To address the above problems, the present invention also provides an Excel-based automated testing device, the device comprising:
[0026] The XML format user report extraction module is used to send a target user query request. When a return information with the target user name is received, the module extracts the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0027] The user report format conversion module is used to format the XML format user report into a JSON object format user report.
[0028] The standard test result generation module is used to combine the user report in JSON object format with the fixed and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form standard test results;
[0029] The test report generation module is used to compare the standard test results with the pre-acquired actual test results and generate an automatic test report from the comparison results.
[0030] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0031] At least one processor; and,
[0032] A memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to perform the steps of the Excel-based automated testing method described above.
[0034] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the aforementioned Excel-based automated testing method.
[0035] This invention, through sending a target user query request, upon receiving a return message containing the target user's name, extracts the corresponding user report from a pre-set filter library based on the target user's name. The user report is in XML format. The XML user report is then formatted into a JSON object. This JSON object is combined with the fixed and dynamic fields from the expected test results of test cases read from a pre-set Excel spreadsheet to form a standard test result. The standard test result is compared with pre-acquired actual test results, and the comparison result generates an automatic test report. The purpose of this invention is to improve testing efficiency by generating a standard test result and comparing it with pre-acquired actual test results to generate an automatic test report. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating an Excel-based automated testing method according to an embodiment of the present invention.
[0037] Figure 2 A schematic diagram of an Excel-based automated testing device provided in an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of the internal structure of an electronic device that implements an Excel-based automated testing method according to an embodiment of the present invention.
[0039] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0040] In the following description, numerous specific details are set forth. However, it should be understood that embodiments of the invention may be implemented without these specific details. In other instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification. References to “one embodiment,” “embodiment,” “exemplary embodiment,” “various embodiments,” etc., indicate that the embodiment described in this invention may include a particular feature, structure, or characteristic, but not every embodiment must include that particular feature, structure, or characteristic. Furthermore, repeated use of the phrase “in one embodiment” does not necessarily refer to the same embodiment, although it may.
[0041] As used herein, unless otherwise specified, the use of ordinal adjectives such as “first,” “second,” “third,” etc., to describe a common object merely indicates that different instances of similar objects are being referenced, and is not intended to imply that the object described in this way must be in a given order, whether in time, space, sequence, or any other manner.
[0042] As used herein, unless otherwise specified, the terms “mobile device” and / or “device” generally refer to a wireless communication device, and more specifically to one or more of the following: portable electronic devices, telephones (e.g., cellular phones, smartphones), computers (e.g., laptops, tablets), portable media players, personal digital assistants (PDAs), or any other electronic devices with networking capabilities.
[0043] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0044] This invention provides an automated testing method based on Excel. (See reference...) Figure 1 The diagram shown is a flowchart illustrating an Excel-based automated testing method according to an embodiment of the present invention. This method can be executed by a device, which can be implemented in software and / or hardware.
[0045] In this embodiment, the Excel-based automated testing method includes:
[0046] S1: Send a target user query request. When a return message with the target user name is received, extract the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0047] S2: Format the XML-formatted user report into a JSON object-formatted user report;
[0048] S3: Combine the user report in JSON object format with the solid and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form standard test results;
[0049] S4: Compare the standard test results with the pre-obtained actual test results, and generate an automatic test report from the comparison results. In this embodiment of the invention, test case-driven testing is performed using an Excel spreadsheet. The Excel spreadsheet includes the test case name, interface query type, request parameters, expected test results, etc. The processing method for expected test results is improved. For example, when querying a personal credit report from the People's Bank of China (PBOC) via a web service interface, the report includes a report header, basic personal information, credit status, credit transactions, public information, declaration information, historically queried records, and report descriptions. It is necessary to check the correctness of the personal credit report parsing. Because the credit report involves many fields, and the returned JSON format contains dynamic field values that are unordered, simply using the expected test results as the standard test results is insufficient for a correctness comparison with the actual results. Therefore, this invention proposes an Excel-based automated testing method. It should be noted that the above is an example of querying a personal credit report from the PBOC. In practical applications, this method is not limited to specific agencies or institutions; any report query is applicable to the testing method provided by this invention.
[0050] In step S1, a request for the target user to query the user credit report is sent through the webservice interface. When a return message with the target user's name is received, the user report corresponding to the target user's name is extracted from the preset block library based on the target user's name, and the user report at this time is in XML format.
[0051] If the web service interface receives a return message without a target username, the expected test results of the test cases will be read from a pre-set Excel spreadsheet and used as the standard test results. These expected test results are set based on previous actual test results. If the previous actual test results are within the range of or meet the requirements of the previous expected test results, these results can be set in the test cases within the Excel spreadsheet as the expected test results.
[0052] In an embodiment of the present invention, if the webservice interface receives a return message without a target username, the pre-obtained actual test results are compared with the standard test results (the expected test results of the test cases read from a pre-set Excel spreadsheet are used as the standard test results).
[0053] For example, receiving a return message indicating no target username means that the queried target username does not match the username in the block database, or that the ID number of the queried target username does not exist. This indicates that there is no such person in the block database, or no user report for such a person. In this case, the expected test result of the test case will be directly read from the Excel spreadsheet as the standard test result and compared with the pre-obtained actual test result.
[0054] In an embodiment of the present invention, when extracting the user report corresponding to the target user name from a preset baffle library based on the target user name, if there is no user report corresponding to the target user name in the preset baffle library, then the default XML format user report is extracted, and the default XML format user report is formatted into a JSON object format user report.
[0055] The step of formatting the default XML format user report into a JSON object format user report is the same as the step of formatting the extracted user report corresponding to the target user name into a JSON object format user report.
[0056] In step S2, formatting the extracted user report in XML format corresponding to the target user name into a user report in JSON object format includes the following steps:
[0057] The extracted user reports in XML format corresponding to the target user names are formatted into user reports in JSON string format;
[0058] The user report in JSON string format is formatted as a user report in JSON object format.
[0059] In step S3, the solid fields and dynamic fields from the expected test results of the test cases read from the Excel spreadsheet, along with the user report in JSON object format, are combined to form the standard test results.
[0060] This process involves converting user reports from JSON strings into JSON objects. Tags are used to convert these into JSON object attributes, such as PIM.PB01.PB01A.PB01AD01. The converted JSON object user report provides a clear and straightforward comparison with the actual test results' user report content. This includes information such as report headers, basic personal information, credit status, credit transactions, public information, declarations, historical query records, and report descriptions. The object attributes clearly represent the content of the report, ensuring a clear comparison and preventing any omissions.
[0061] In an embodiment of the present invention, the dynamic fields in the expected test results are represented by regular expressions, wherein the dynamic fields in the expected test results represent the time and IP of the expected test results.
[0062] When a return message containing the target user name is received, the fixed fields in the expected test result, such as ID and time, are represented by regular expressions and included as part of the standard test result. The dynamic fields represent the time and IP of the expected test result.
[0063] For example, the time: "PA01AR01":"2020-01-10T17:28:37"
[0064] The regular expression is:
[0065] "PA01AR01":"^20\d{2}\-\d{2}\-\d{2}T\d{2}\:\d{2}\:\d{2}$"
[0066] For example, ID: "TASKID":"236801737"
[0067] Regular expression: "TASKID": "\d{9}".
[0068] In an embodiment of the present invention, the solid-state field in the expected test result is represented by a solidified method, wherein the solid-state field in the expected test result represents an identifier indicating that the expected test result is completed.
[0069] When a return message containing the target user's name is received, the solidified fields in the expected test results are represented in a solidified manner and included as part of the standard test results.
[0070] For example: Parameters and return values related to the request:
[0071] "REFID":"zn123","RESULTCODE":"5","RESULTINFO":"Split complete", etc.
[0072] In step S4, the actual test results are obtained in the following ways:
[0073] Read test cases from a pre-set Excel spreadsheet. The test cases include user information, order parameters, query interface, and expected test results.
[0074] Initialize the API (interface) instance based on the user information in the test case;
[0075] Based on the report parameters in the test case, the API (interface) instance is called to perform the test;
[0076] The testing system uses the query interface in the test case to query the data related to the report parameters after the test is completed, so as to generate the actual test results.
[0077] In an embodiment of the present invention, comparing the standard test result with the pre-acquired actual test result includes:
[0078] The user report in JSON object format of the standard test results is compared with the content of the user report of the pre-acquired actual test results for consistency.
[0079] The solid-state fields of the standard test results are compared with the solid-state fields of the pre-acquired actual test results for consistency.
[0080] The dynamic fields of the standard test results are compared with the dynamic fields of the pre-acquired actual test results for consistency.
[0081] If the comparison is consistent, then the actual test results meet the standard requirements;
[0082] If the comparison is inconsistent, the actual test results do not meet the standard requirements.
[0083] In an embodiment of the present invention, the standard test result is compared with the pre-obtained actual test result to determine if they are consistent. If they are consistent, the test is successful; if they are not consistent, the test is unsuccessful. Regardless of whether the test is successful or unsuccessful, the comparison result between the standard test result and the actual test result is output, and a test report is generated.
[0084] In other words, the comma-separated key-value pairs of the dynamic value field and the comma-separated key-value pairs of the solid value field in the JSON object are compared with the actual test results for complete consistency. If the comparison is consistent, it is considered a success; otherwise, it is considered a failure.
[0085] In this embodiment of the invention, during comparative testing, when the expected number of test results is large and contains dynamic values and unordered structures, an automatic test report is generated by comparing the standard test results with the actual test results. This eliminates the need for testers to manually organize and verify the data, greatly improving testing efficiency. Simultaneously, it avoids the truncation of characters due to Excel cell character length limitations, thus improving coverage. Dynamic values are validated using regular expressions, improving test accuracy. Furthermore, since the data structure of the content to be validated is unordered, user reports in JSON object format are compared with the actual test results in an unordered manner, further enhancing test accuracy.
[0086] This invention, through sending a target user query request, upon receiving a return message containing the target user's name, extracts the corresponding user report from a pre-set filter library based on the target user's name. The user report is in XML format. The XML user report is then formatted into a JSON object. This JSON object is combined with the fixed and dynamic fields from the expected test results of test cases read from a pre-set Excel spreadsheet to form a standard test result. The standard test result is compared with pre-acquired actual test results, and the comparison result generates an automatic test report. The purpose of this invention is to improve testing efficiency by generating a standard test result and comparing it with pre-acquired actual test results to generate an automatic test report.
[0087] like Figure 2 The diagram shown is a functional block diagram of the Excel-based automated testing device of the present invention. The Excel-based automated testing device 100 of the present invention can be installed in an electronic device. Depending on the functions implemented, the Excel-based automated testing device 100 may include: an XML format user report extraction module 101, a user report format conversion module 102, a user report format conversion module 103, and a test report generation module 104. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and are stored in the memory of the electronic device.
[0088] In this embodiment, the functions of each module / unit are as follows:
[0089] The XML format user report extraction module 101 is used to send a target user query request. When a return information with the target user name is received, the module extracts the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0090] User report format conversion module 102 is used to format the XML format user report into a JSON object format user report;
[0091] The user report format conversion module 103 is used to combine the user report in JSON object format with the solid fields and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result;
[0092] The test report generation module 104 is used to compare the standard test results with the pre-acquired actual test results and generate an automatic test report from the comparison results.
[0093] Test report generation module 104 includes:
[0094] The test case reading module is used to read test cases from the pre-set Excel spreadsheet. The test cases include user information, order parameters, query interface and expected test results.
[0095] The initialization module is used to initialize the interface instance based on the user information in the test case;
[0096] The testing module is used to call the interface instance to perform testing based on the report parameters in the test case;
[0097] The actual test result generation module is used to query data related to the report parameters after the test is completed, based on the query interface in the test case, in order to generate actual test results.
[0098] This invention, through sending a target user query request, upon receiving a return message containing the target user's name, extracts the corresponding user report from a pre-set filter library based on the target user's name. The user report is in XML format. The XML user report is then formatted into a JSON object. This JSON object is combined with the fixed and dynamic fields from the expected test results of test cases read from a pre-set Excel spreadsheet to form a standard test result. The standard test result is compared with pre-acquired actual test results, and the comparison result generates an automatic test report. The purpose of this invention is to improve testing efficiency by generating a standard test result and comparing it with pre-acquired actual test results to generate an automatic test report.
[0099] like Figure 3 The diagram shown is a structural schematic of an electronic device that implements an Excel-based automated testing method according to the present invention.
[0100] The electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as an Excel-based automated test program 12.
[0101] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 1. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of a data auditing program, but also to temporarily store data that has been output or will be output. The memory can store content that can be displayed by the electronic device or sent to other devices (e.g., headphones) for display or playback. The memory can also store content received from other devices. The content from other devices may be displayed, played, or used by the electronic device to perform any necessary tasks or operations that can be performed by a computer processor or other components in the electronic device and / or wireless access point.
[0102] The processor 10 may be composed of integrated circuits in some embodiments, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., data audit programs) stored in the memory 11 and calling data stored in the memory 11. The electronic device may also include a chipset (not shown) for controlling communication between one or more processors and one or more other components of the user device. In certain embodiments, the electronic device may be based on... Architecture or The architecture, and the processor and chipset can come from A family of processors and chipsets. The one or more processors 104 may also include one or more application-specific integrated circuits (ASICs) or application-specific standard products (ASSPs) for handling specific data processing functions or tasks.
[0103] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0104] In addition, the network and I / O interfaces may include one or more communication interface or network interface devices to provide data transmission between electronic devices and other devices (e.g., web servers) via a network (not shown). Communication interfaces may include, but are not limited to: Human Area Network (BAN), Personal Area Network (PAN), Wired Local Area Network (LAN), Wireless Local Area Network (WLAN), Wireless Wide Area Network (WWAN), etc. User equipment 102 may be coupled to the network via a wired connection. However, the wireless system interface may include hardware or software for broadcasting and receiving messages, using the Wi-Fi Direct standard and / or the IEEE 802.11 wireless standard, Bluetooth standard, Bluetooth Low Energy standard, Wi-Gig standard, and / or any other wireless standard and / or combinations thereof.
[0105] Wireless systems may include transmitters and receivers or transceivers capable of operating within a wide range of operating frequencies governed by the IEEE 802.11 wireless standard. Communication interfaces may utilize acoustic, radio frequency, optical, or other signals to exchange data between electronic devices and other devices such as access points, hosts, servers, routers, reading devices, and the like. Networks may include, but are not limited to: the Internet, private networks, virtual private networks, wireless wide area networks, local area networks, metropolitan area networks, telephone networks, etc.
[0106] The display may include, but is not limited to, liquid crystal displays, light-emitting diode displays, or E-Ink™ displays manufactured by E Ink Corp. of Cambridge, Massachusetts, USA. The display may be used to show content to a user in the form of text, images, or video. In certain instances, the display may also operate as a touchscreen display, allowing the user to initiate commands or operations by touching the screen using certain fingers or gestures.
[0107] Figure 3 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 3The structure shown does not constitute a limitation on the electronic device 3, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0108] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0109] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.
[0110] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0111] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0112] The Excel-based automated testing program 12 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When run in the processor 10, it can achieve the following:
[0113] Send a target user query request. When a return message containing the target user name is received, extract the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0114] Format the XML-formatted user report into a JSON object-formatted user report;
[0115] The user report in JSON object format is combined with the solid and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result;
[0116] The standard test results are compared with the pre-acquired actual test results, and the comparison results are used to generate an automatic test report. Specifically, the specific implementation method of the processor 10 for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here. It should be emphasized that, in order to further ensure the privacy and security of the similarity semantic processing results of each group of semantic units to be processed, the similarity semantic processing results of each group of semantic units to be processed can also be stored in a blockchain node.
[0117] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0118] In an embodiment of the present invention, a computer-readable storage medium is used, wherein at least one instruction is stored therein, the at least one instruction being executed by a processor in an electronic device to implement the steps of the Excel-based automated testing method described above, the specific method being as follows:
[0119] Send a target user query request. When a return message containing the target user name is received, extract the user report corresponding to the target user name from a preset baffle library based on the target user name. The user report is in XML format.
[0120] Format the XML-formatted user report into a JSON object-formatted user report;
[0121] The user report in JSON object format is combined with the solid and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result;
[0122] The standard test results are compared with the pre-acquired actual test results, and the comparison results are used to generate an automatic test report.
[0123] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0124] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0125] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0126] The above description of certain embodiments of the present invention with reference to block diagrams and flowcharts of systems, methods, and / or computer program products according to exemplary embodiments of the present invention has described certain embodiments. It should be understood that one or more blocks in the block diagrams and flowcharts, as well as combinations of blocks in the block diagrams and flowcharts, can be implemented by computer-executable program instructions, respectively. Similarly, according to some embodiments of the present invention, some blocks in the block diagrams and flowcharts may not necessarily be executed in the order presented, or may even not be required to be executed at all.
[0127] These computer-executable program instructions can be loaded onto a general-purpose computer, special-purpose computer, processor, or other programmable data processing apparatus to produce a particular machine, such that the instructions, which execute on the computer, processor, or other programmable data processing apparatus, create components for implementing one or more functions specified in the flowchart blocks or blocks. These computer program products can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of writing comprising instruction components for implementing one or more functions specified in the flowchart blocks or blocks. For example, embodiments of the invention may provide a computer program product comprising a computer-usable medium containing computer-readable program code or program instructions adapted to be executed to implement one or more functions specified in the flowchart blocks or blocks. The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus such that a series of operational elements or steps are executed on the computer or other programmable apparatus to produce a computer-implementable program, such that the instructions, which execute on the computer or other programmable apparatus, provide elements or steps for implementing the functions specified in the flowchart blocks or blocks.
[0128] Accordingly, the blocks in a block diagram or flowchart support combinations of components used to perform a specified function, combinations of elements or steps used to perform a specified function, and combinations of program instruction components used to perform a specified function. It should also be understood that each block in a block diagram and flowchart, as well as combinations of blocks in block diagrams and flowcharts, can be implemented by a dedicated hardware-based computer system that performs the specified function, element, or step, or by a combination of dedicated hardware or computer instructions.
[0129] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0130] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0131] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0132] While certain embodiments of the invention have been described in conjunction with what are presently considered to be the most practical and varied embodiments, it should be understood that the invention is not limited to the disclosed embodiments, but is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims. Although specific terminology is used herein, it is used only in a general and descriptive sense and not for limiting purposes.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. An Excel-based automated testing method applied to electronic devices, characterized in that, The method includes: A target user query request is sent. When a return message containing the target user name is received, the user report corresponding to the target user name is extracted from a preset block library based on the target user name. The user report is in XML format. If no user report corresponding to the target user name is found in the preset block library, a default XML format user report is extracted and formatted into a JSON object format user report. The user report in XML format is formatted into a user report in JSON object format, wherein the extracted user report in XML format corresponding to the target user name is formatted into a user report in JSON string format; Format the user report in JSON string format into a user report in JSON object format; The user report in JSON object format is combined with the solid and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result; The standard test results are compared with the pre-acquired actual test results, and the comparison results are used to generate an automatic test report.
2. The Excel-based automated testing method as described in claim 1, characterized in that, If a return message without a target username is received, the expected test result of the test case will be read from the pre-set Excel spreadsheet and used as the standard test result.
3. The Excel-based automated testing method as described in claim 1, characterized in that, The dynamic fields in the expected test results are represented using regular expressions, where, The dynamic field represents the time and IP of the expected test result.
4. The Excel-based automated testing method as described in claim 1, characterized in that, The solid-state field in the expected test results is represented in a solidified manner, wherein, The solid field indicates that the expected test result has been completed.
5. The Excel-based automated testing method as described in claim 1, characterized in that, The method for obtaining the actual test results includes the following steps: Read test cases from the pre-set Excel spreadsheet. The test cases include user information, order parameters, query interface, and expected test results. Initialize the interface instance based on the user information in the test case; The interface instance is invoked to perform the test based on the report parameters in the test case. Based on the query interface in the test case, query the data related to the report parameters after the test is completed, so as to generate the actual test results.
6. An automated testing device based on Excel, characterized in that, The device includes: An XML format user report extraction module is used to send a target user query request. When a return information with the target user name is received, the module extracts the user report corresponding to the target user name from a preset block library. The user report is in XML format. If no user report corresponding to the target user name is found in the preset block library, the module extracts a default XML format user report and formats the default XML format user report into a JSON object format user report. The user report format conversion module is used to format the XML format user report into a JSON object format user report, wherein the extracted XML format user report corresponding to the target user name is formatted into a JSON string format user report; The user report in JSON string format is formatted into a user report in JSON object format; the standard test result generation module is used to combine the user report in JSON object format with the fixed fields and dynamic fields in the expected test results of the test cases read from a pre-set Excel spreadsheet to form a standard test result; The test report generation module is used to compare the standard test results with the pre-acquired actual test results and generate an automatic test report from the comparison results.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the steps of the Excel-based automated testing method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the Excel-based automated testing method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Automatic test method and system for object-oriented communication protocol
CN112231222A
Test comparison method and system based on Excel table
CN114443468A
HTML (Hypertext Markup Language) report verification method and device, electronic equipment and storage medium
CN115098401A