An HTML report verification method, device, electronic device and storage medium

By generating test cases and parsing HTML reports to obtain report verification benchmarks, the problems of low efficiency and high maintenance costs of massive data automation verification in the existing technology are solved, and efficient HTML report verification is achieved.

CN115098401BActive Publication Date: 2025-06-27BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210863044.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-20
Publication Date
2025-06-27
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

When the existing technology automates the verification of massive data, it requires the design and development of a large number of test cases, resulting in large workloads and high maintenance costs, and the inability to effectively carry large amounts of data.

Method used

By obtaining the attribute data of the system to be tested, a test case is generated, and the HTML report is extracted. Then parse the HTML report to obtain the report verification benchmark, and finally perform fine-grained verification of the HTML report based on the benchmark to achieve automated verification.

Benefits of technology

Improves the efficiency of HTML report verification, reduces the demand for a large number of test cases, reduces maintenance costs, and can effectively carry large amounts of data verification tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098401B_ABST
    Figure CN115098401B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an HTML report verification method, apparatus, electronic device, and storage medium. Among them, the method includes: obtaining attribute data of a system to be tested; generating test cases according to the attribute data; extracting an HTML report from the test cases; parsing the HTML report to obtain a report verification benchmark; and performing fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result. Implementing the embodiments of the present application can perform automated verification on a large amount of data, reduce the workload, and lower the maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data analysis technology. Specifically, it relates to an HTML report verification method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] With the development of technology, more and more data needs to be updated and maintained. For example, in a knowledge base, as the knowledge in the knowledge base is updated and increased, the amount of knowledge that needs to be regression-verified surges. However, the efficiency of self-testing and sending knowledge versions for testing of multiple versions of the knowledge base that have already been tested is low, and it cannot bear such a large amount of testing tasks. Therefore, an HTML report verification is needed to achieve automated verification of knowledge.

[0003] However, the existing automated report verification methods require designing and developing a large number of test cases, resulting in a large amount of development work. Moreover, the data to be verified is in a continuous update process, and each update of the data will form a large number of automated scripts, requiring a high maintenance cost. Summary of the Invention

[0004] The purpose of the embodiments of this application is to provide an HTML report verification method, apparatus, electronic device, and computer-readable storage medium, which can perform automated verification on a large amount of data, reduce the workload, and lower the maintenance cost.

[0005] In a first aspect, the embodiments of this application provide an HTML report verification method, and the method includes:

[0006] Obtain the attribute data of the system to be tested;

[0007] Generate test cases according to the attribute data;

[0008] Extract the HTML report from the test cases;

[0009] Parse the HTML report to obtain a report verification benchmark;

[0010] Perform fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result.

[0011] In the above implementation process, generating test cases according to the attribute data, extracting the HTML report from the test cases, and then performing fine-grained verification on the HTML report can effectively improve the efficiency of HTML report verification, without the need for a large number of test cases, form automated verification, can handle a large amount of data, reduce the workload, and lower the maintenance cost.

[0012] Further, before the step of parsing the HTML report to obtain a report verification benchmark, it further includes:

[0013] Determine whether the HTML report is being parsed for the first time;

[0014] If not, directly obtain the existing report verification benchmark.

[0015] In the above implementation process, determine whether the HTML report is being parsed for the first time. If it is not the first parse, then obtain the report verification benchmark to avoid inefficiency caused by repeatedly obtaining the report verification benchmark and reduce duplicate work.

[0016] Further, the step of parsing the HTML report to obtain the report verification benchmark includes:

[0017] Obtain the report structure of the HTML report;

[0018] Establish a parsing template;

[0019] Parse the report structure according to the parsing template to obtain the report verification benchmark.

[0020] In the above implementation process, directly parsing the report structure of the HTML report according to the parsing template helps to improve the accuracy of verifying the HTML report, reduce the generation of errors, and make the obtained report verification benchmark more accurate.

[0021] Further, the step of performing fine-grained verification on the HTML report according to the report verification benchmark to obtain the verification result includes:

[0022] Obtain the benchmark report;

[0023] Obtain the fine-grained information in the report verification benchmark;

[0024] Verify the benchmark report and the HTML report according to the fine-grained information to obtain the verification result.

[0025] In the above implementation process, compare and verify the benchmark report and the HTML report according to the fine-grained information summarized in the report verification benchmark, so that the obtained verification result can achieve accurate verification of the HTML report and shorten the verification time.

[0026] In a second aspect, an embodiment of the present application further provides an HTML report verification device, and the device includes:

[0027] An acquisition module, configured to acquire attribute data of a system under test;

[0028] A generation module, configured to generate test cases according to the attribute data;

[0029] An extraction module, configured to extract the HTML report in the test cases;

[0030] A parsing module, configured to parse the HTML report to obtain a report verification benchmark;

[0031] A verification module, configured to perform fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result.

[0032] In the above implementation process, generating test cases according to attribute data, extracting the HTML report in the test cases, and then performing fine-grained verification on the HTML report can effectively improve the efficiency of verifying the HTML report, without the need for a large number of test cases, forming an automated verification, which can carry a large amount of data, reduce the workload, and lower the maintenance cost.

[0033] Further, the apparatus further includes a judgment module, configured to:

[0034] Judge whether the HTML report is parsed for the first time;

[0035] If not, directly obtain the existing report verification benchmark.

[0036] In the above implementation process, judging whether the HTML report is parsed for the first time. If it is not the first parsing, then obtaining the report verification benchmark can avoid the low efficiency caused by repeatedly obtaining the report verification benchmark and reduce the repeated work.

[0037] Further, the parsing module is further configured to:

[0038] Obtain the report structure of the HTML report;

[0039] Establish a parsing template;

[0040] Parse the report structure according to the parsing template to obtain the report verification benchmark.

[0041] In the above implementation process, directly parsing the report structure of the HTML report according to the parsing template helps to improve the accuracy of verifying the HTML report, reduce the generation of errors, and make the obtained report verification benchmark more accurate.

[0042] Further, the verification module is further configured to:

[0043] Obtain a benchmark report;

[0044] Obtain the fine-grained information in the report verification benchmark;

[0045] Verify the benchmark report and the HTML report according to the fine-grained information to obtain the verification result.

[0046] In the above implementation process, the benchmark report and the HTML report are compared and verified according to the fine-grained information summarized by the report verification benchmark, so that the obtained verification result can achieve accurate verification of the HTML report and shorten the verification time.

[0047] In a third aspect, an electronic device provided by an embodiment of the present application includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method according to any one of the first aspects are implemented.

[0048] In a fourth aspect, a computer-readable storage medium provided by an embodiment of the present application has instructions stored thereon. When the instructions are run on a computer, the computer is caused to execute the method according to any one of the first aspects.

[0049] In a fifth aspect, a computer program product provided by an embodiment of the present application, when run on a computer, causes the computer to execute the method according to any one of the first aspects.

[0050] Other features and advantages of the present disclosure will be described in the following description, or some features and advantages can be inferred from the description without doubt, or can be learned by implementing the above technologies of the present disclosure.

[0051] And it can be implemented according to the content of the description. The following will be described in detail with reference to the preferred embodiments of the present application and the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0053] Figure 1 It is a schematic flowchart of the HTML report verification method provided by an embodiment of the present application;

[0054] Figure 2 It is a schematic structural composition diagram of the HTML report verification device provided by an embodiment of the present application;

[0055] Figure 3 It is a schematic structural composition diagram of the electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0056] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

[0057] It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present application, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.

[0058] The following will further describe in detail the specific implementation manners of the present application in conjunction with the drawings and embodiments. The following embodiments are used to illustrate the present application but are not intended to limit the scope of the present application.

[0059] Embodiment 1

[0060] Figure 1 is a schematic flowchart of an HTML report verification method provided by an embodiment of the present application. As Figure 1 shown, the method includes:

[0061] S1, obtaining attribute data of a system to be tested;

[0062] S2, generating test cases according to the attribute data;

[0063] S3, extracting the HTML report in the test cases;

[0064] S4, parsing the HTML report to obtain a report verification benchmark;

[0065] S5, performing fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result.

[0066] In the above implementation process, generating test cases according to the attribute data, extracting the HTML report in the test cases, and then performing fine-grained verification on the HTML report can effectively improve the efficiency of HTML report verification, without the need for a large number of test cases, form automated verification, can carry a large amount of data, reduce the workload, and lower the maintenance cost.

[0067] In S1, specifically, obtaining the attribute data of the system under test or the target to be verified means determining the test data for test execution. In the embodiments of this application, it is necessary to verify the HTML report of the system under test, and the attribute data of the target to be verified is the data that can enable the system under test to generate an HTML report recording the operation results of the business functions of the system under test through the functions of one or more business modules after receiving these data. For example, compared with the baseline inspection system or the vulnerability scanning system, the attribute data of the target to be verified is the attribute data of the target to be scanned, such as the device type (Windows2008), IP, port, management protocol, username, password, etc. of a Windows host. To ensure the effectiveness of the subsequent established baseline report, the environment of the target under test needs to be stable to a certain extent for the business functions of the system under test. When the business of the system under test does not change, for the task of generating reports by running the same target twice, the report content should be consistent to a certain extent. If the report content changes due to a change in the target environment for some reason, the corresponding baseline report needs to be updated to ensure the effectiveness of the subsequent verification results.

[0068] In S2, generating test cases according to the attribute data means automatically generating one or a set of test cases that can inject the attribute data into the system under test and automatically execute the relevant business functions to generate reports according to the attribute data through the test case generation module.

[0069] Exemplarily, the test cases can be webui test cases or interface test cases or a combination of both. According to the implementation method and business characteristics of the system under test, the most convenient method is selected for implementation. If it is an interface test case, the automation degree and flexibility of the subsequent test case execution are increased by designing fields such as timeout, dynamic parameter extraction and replacement, and test case screening in the structure of the test case.

[0070] Optionally, in the embodiments of this application, by capturing packets, interface test cases for creating a scanning task and executing the scan to generate a verification report are constructed, and interface test cases for the scanning task service are automatically generated. In addition to the conventional interface test case fields, the test cases also include content such as timeout, dynamic parameter extraction, dynamic parameter reference, and verification information.

[0071] Dynamic parameter extraction refers to sharing data during the test process. For example, the sessionid for login needs to reference this parameter value in most operations after login; another example is that the taskID for creating a scanning task also needs to be referenced. The extraction of dynamic parameters supports regular expressions, json field references, custom functions, and custom operations.

[0072] Dynamic parameter replacement means that before the test case is actually executed, the variable references need to be replaced with the dynamic parameters that have been obtained in the system. For example, the variable reference ${JSESSIONID} in the subsequent request cookie needs to be replaced with the actual value.

[0073] The timeout is for some time-consuming operations. For example, when checking the task execution process, it is necessary to wait until the check task is completed before downloading the HTML report. Therefore, in the subsequent test case, a certain timeout needs to be set, and the execution pauses here waiting for the business function of the system under test to complete.

[0074] Further, before the step of parsing the HTML report to obtain the report verification benchmark, it also includes:

[0075] Judging whether the HTML report is the first parsing;

[0076] If not, directly obtain the existing report verification benchmark.

[0077] In the above implementation process, judging whether the HTML report is the first parsing. If it is not the first parsing, then obtain the report verification benchmark, avoiding the inefficiency caused by repeatedly obtaining the report verification benchmark and reducing the repetitive work.

[0078] Optionally, the report verification benchmark is usually stable for a period of time. However, when the environment changes or there are problems that require expansion or modification, the existing report verification benchmark may not correctly predict the results, and the report verification benchmark needs to be updated.

[0079] In S3, execute the test case to generate an HTML report. The test case execution module automatically executes the test cases in sequence, causing the relevant business functions of the system under test to generate an HTML report.

[0080] Optionally, it is also necessary to filter the test cases, that is, support filtering by product, module, and whether to execute fields.

[0081] Further, S4 includes:

[0082] Obtain the report structure of the HTML report;

[0083] Establish a parsing template;

[0084] Parse the report structure according to the parsing template to obtain the report verification benchmark.

[0085] In the above implementation process, directly parsing the report structure of the HTML report according to the parsing template helps to improve the accuracy of the HTML report verification, reduce the generation of errors, and make the obtained report verification benchmark more accurate.

[0086] By establishing a parsing template to guide the parsing module to perform parsing and convert it into JSON format. The purpose of parsing is to filter out the format and code content in the HTML report, extract the data content to be verified in the HTML report, and convert the data content to be verified into structured data that is easy to process, so as to obtain the report verification benchmark. Optionally, a verified structured report can be used to set the verification benchmark for subsequent verification. The parsing of the HTML report is completed by defining a parsing template and specifying the regular expressions or tag structure values for extracting each content item, and is based on the parsing template using regular expressions and the BeautifulSoup library.

[0087] Furthermore, S5 includes:

[0088] Obtain a benchmark report;

[0089] Obtain the fine-grained information in the report verification benchmark;

[0090] Verify the benchmark report and the HTML report according to the fine-grained information to obtain the verification result.

[0091] In the above implementation process, the benchmark report and the HTML report are compared and verified according to the fine-grained information summarized in the report verification benchmark, so that the obtained verification result can achieve accurate verification of the HTML report and shorten the verification time.

[0092] By comparing the HTML report with the benchmark report, suspicious problems in the HTML report (such as errors, local content changes, local content deletions, etc.) are found. Exemplarily, for example, the CPU utilization rate. In the benchmark report, it is 70%, and the result during verification is 75%. However, since both of these values meet the requirement that the system CPU utilization rate is lower than 80%. Therefore, fuzzy processing needs to be done through regular expressions to ensure that the verification result will not be an incorrect result. This should be fully considered in the comparison engine, and consistency judgment is made through the fuzzy comparison rules set in the report verification benchmark to avoid a large number of correct inconsistencies from interfering with testers in discovering problems.

[0093] Perform a fine-grained information comparison and verification between the HTML report and the benchmark report, including comparison of report basic information: such as scores, total number of inspection items, compliance rate, compliant items, non-compliant items, exception items, device naming, device address, device type; comparison of fine-grained information: including inspection item titles, compliance results, inspection methods, configuration steps, inspection sub-item titles, inspection sub-item compliance results, inspection sub-item data extraction results, inspection sub-item verification rules.

[0094] Since the display order of inspection items and sub-items in different scan reports for the same target may change, the comparison content is searched by title keywords. The comparison similarity of the result fields of the inspection sub-items is used to find the comparison benchmark. For the comparison of sub-item results where some inspection values may change (such as CPU utilization rate, process number, etc.), first, the most similar comparison benchmark is found through text similarity, and then the predefined fuzzy comparison rules are used for comparison.

[0095] An automatic error correction function is introduced for the configuration steps and inspection method fields to prompt misspelled words and obvious grammar problems.

[0096] Optionally, the information in the result verification is used to automatically judge whether the test case execution is successful. Currently, three methods are supported: whether the status code, keyword, and dynamic parameter are extracted successfully.

[0097] Exemplarily, the information in the verification result is used to automatically judge whether the test case execution is successful. For example, the "expected result" field of the test case is {"status_code":200,"keyword":'task name',"atributes":["taskID"]}, which means that the status code of the response is 200, and the response data contains the keyword "task name", and the dynamic parameter taskID is set. The dynamic parameter needs to be cleared in time, otherwise, if the dynamic parameter is verified later, the result judgment may be incorrect due to the remaining parameter.

[0098] Optionally, after obtaining the verification result, the verification result can be displayed. The displayed content also includes the execution result of each test case, which is automatically verified through the verification field of the test case.

[0099] Exemplarily, the method of this application embodiment can be applied to the self-test verification framework for checking knowledge in the baseline management system. The framework integrates webui and web interface verification methods. It contains hundreds of devices and tens of thousands of pieces of inspection knowledge. With the update and maintenance of the inspection knowledge, the amount of knowledge waiting for regression verification has increased sharply. For the self-test of the knowledge that has been tested in multiple versions and the submission of knowledge versions for testing, the efficiency of knowledge verification is low, and such a large amount of test tasks cannot be borne. The method of this application embodiment can quickly verify the inspection knowledge.

[0100] The embodiments of the present application have completed the fine-grained automated comparison verification of HTML reports containing a large number of verification points. When the number of reports to be verified is relatively large, the workload and complexity of manual verification are effectively reduced. It can be used in the regression testing of such reports to improve work efficiency. Since the parsed report is used as the verification benchmark, the stability of the verification method is improved. When the target environment is damaged and rebuilt or changed, only the test cases need to be re-run to rebuild the benchmark report, and then the subsequent verification tasks can be continued without modifying the code or changing the test cases. The execution process of the test cases has great flexibility and adaptability. When it needs to be applied to other systems under test, only the test case generation module and the report parsing module need to be adapted for quick porting and application.

[0101] Embodiment 2

[0102] In order to execute the method corresponding to Embodiment 1 above to achieve the corresponding functions and technical effects, the following provides an HTML report verification device, as Figure 2 shown. The device includes:

[0103] An acquisition module 1, configured to acquire the attribute data of the system under test;

[0104] A generation module 2, configured to generate test cases according to the attribute data;

[0105] An extraction module 3, configured to extract the HTML report in the test cases;

[0106] A parsing module 4, configured to parse the HTML report to obtain a report verification benchmark;

[0107] A verification module 5, configured to perform fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result.

[0108] In the above implementation process, generating test cases according to the attribute data, extracting the HTML report in the test cases, and then performing fine-grained verification on the HTML report can effectively improve the efficiency of verifying the HTML report, without the need for a large number of test cases, forming an automated verification, which can carry a large amount of data, reduce the workload, and lower the maintenance cost.

[0109] Further, the device further includes a judgment module, configured to:

[0110] Judge whether the HTML report is parsed for the first time;

[0111] If not, directly obtain the existing report verification benchmark.

[0112] In the above implementation process, judging whether the HTML report is parsed for the first time. If it is not the first parsing, then obtaining the report verification benchmark can avoid the low efficiency caused by repeatedly obtaining the report verification benchmark and reduce the repetitive work.

[0113] Further, the parsing module 4 is further configured to:

[0114] Obtain the report structure of the HTML report;

[0115] Establish a parsing template;

[0116] Parse the report structure according to the parsing template to obtain a report verification benchmark.

[0117] In the above implementation process, directly parsing the report structure of the HTML report according to the parsing template helps to improve the accuracy of the HTML report verification, reduce the generation of errors, and make the obtained report verification benchmark more accurate.

[0118] Further, the verification module 5 is further configured to:

[0119] Obtain a benchmark report;

[0120] Obtain the fine-grained information in the report verification benchmark;

[0121] Verify the benchmark report and the HTML report according to the fine-grained information to obtain a verification result.

[0122] In the above implementation process, comparing and verifying the benchmark report and the HTML report according to the fine-grained information summarized in the report verification benchmark enables the obtained verification result to achieve precise verification of the HTML report and shortens the verification time.

[0123] The above HTML report verification device can implement the method of Embodiment 1. The optional items in Embodiment 1 also apply to this embodiment and will not be elaborated here.

[0124] The remaining content of the embodiments of the present application may refer to the content of Embodiment 1 and will not be repeated in this embodiment.

[0125] Embodiment 3

[0126] The embodiment of the present application provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the HTML report verification method of Embodiment 1.

[0127] Optionally, the above electronic device may be a server.

[0128] Please refer to Figure 3 , Figure 3Schematic diagram of the structural composition of the electronic device provided by the embodiment of the present application. The electronic device may include a processor 31, a communication interface 32, a memory 33, and at least one communication bus 34. Among them, the communication bus 34 is used to realize the direct connection and communication of these components. Among them, the communication interface 32 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The processor 31 may be an integrated circuit chip with signal processing capabilities.

[0129] The above-mentioned processor 31 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor 31 may also be any conventional processor, etc.

[0130] The memory 33 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory 33 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 31, the device can execute the above Figure 1 Each step involved in the method embodiment.

[0131] Optionally, the electronic device may further include a storage controller and an input / output unit. The memory 33, the storage controller, the processor 31, the peripheral interface, and the input / output unit are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 34. The processor 31 is used to execute the executable module stored in the memory 33, such as the software function module or computer program included in the device.

[0132] The input / output unit is used to enable the user to create tasks and create an optional start period or a preset execution time for the tasks, so as to realize the interaction between the user and the server. The input / output unit can be, but is not limited to, a mouse, a keyboard, etc.

[0133] It can be understood that Figure 3 The structure shown is only schematic, and the electronic device may further include more or fewer components than those shown Figure 3 in the figure, or have a different configuration from that shown Figure 3 in the figure. Figure 3 Each component shown in the figure can be implemented by hardware, software, or a combination thereof.

[0134] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the HTML report verification method of Embodiment 1 is implemented.

[0135] An embodiment of the present application further provides a computer program product. When the computer program product runs on a computer, the computer is enabled to execute the method described in the method embodiment.

[0136] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based device for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0137] In addition, in each embodiment of the present application, the functional modules may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0138] When the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0139] The above are only the embodiments of this application and are not used to limit the protection scope of this application. For those skilled in the art, this application can have various changes and modifications. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included in the protection scope of this application. It should be noted that similar reference numerals and letters in the following drawings represent similar items. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0140] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by this application and should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

[0141] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

Claims

1. An HTML report verification method, characterized in that, The method includes: Obtaining attribute data of the system to be tested; Generating test cases according to the attribute data; Extracting the HTML report from the test cases; Parsing the HTML report to obtain a report verification benchmark; Performing fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result; The step of parsing the HTML report to obtain a report verification benchmark includes: Obtaining the report structure of the HTML report; Establishing a parsing template; Parsing the report structure according to the parsing template to obtain the report verification benchmark; Parsing into a json format by establishing a parsing template, filtering out the format and code content in the HTML report, extracting the data content to be verified in the HTML report, and converting the data content to be verified into structured data that is easy to process to obtain a report verification benchmark.

2. The HTML report verification method according to claim 1, wherein Before the step of parsing the HTML report to obtain a report verification benchmark, it further includes: Judging whether the HTML report is the first parsing; If not, directly obtaining the existing report verification benchmark.

3. The HTML report verification method according to claim 1, characterized in that The step of performing fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result includes: Obtaining a benchmark report; Obtaining the fine-grained information in the report verification benchmark; Verifying the benchmark report and the HTML report according to the fine-grained information to obtain the verification result.

4. An HTML report verification device, characterized in that, The device includes: An obtaining module for obtaining attribute data of the system to be tested; A generating module for generating test cases according to the attribute data; An extracting module for extracting the HTML report from the test cases; A parsing module for parsing the HTML report to obtain a report verification benchmark; A verifying module for performing fine-grained verification on the HTML report according to the report verification benchmark to obtain a verification result; The parsing module is further used for: Obtaining the report structure of the HTML report; Establishing a parsing template; Parsing the report structure according to the parsing template to obtain the report verification benchmark; Parsing into a json format by establishing a parsing template, filtering out the format and code content in the HTML report, extracting the data content to be verified in the HTML report, and converting the data content to be verified into structured data that is easy to process to obtain a report verification benchmark.

5. The HTML report verification device according to claim 4, characterized in that The device further includes a judging module for: Judging whether the HTML report is the first parsing; If not, directly obtaining the existing report verification benchmark.

6. The HTML report verification device according to claim 4, characterized in that, The verifying module is further used for: Obtaining a benchmark report; Obtaining the fine-grained information in the report verification benchmark; Verifying the benchmark report and the HTML report according to the fine-grained information to obtain the verification result.

7. An electronic device, characterized in that, Including a memory and a processor, the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic device to execute the HTML report verification method according to any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that, It stores a computer program, and when the computer program is executed by the processor, it implements the HTML report verification method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Software testing method and device, medium and electronic equipment

    CN114116501A

  • Machine learning based test case prediction and automation leveraging the HTML document object model

    US20200356466A1