CN107870854B - Method and device for testing data accuracy of chart library - Google Patents
Method and device for testing data accuracy of chart library Download PDFInfo
- Publication number
- CN107870854B CN107870854B CN201610854966.0A CN201610854966A CN107870854B CN 107870854 B CN107870854 B CN 107870854B CN 201610854966 A CN201610854966 A CN 201610854966A CN 107870854 B CN107870854 B CN 107870854B
- Authority
- CN
- China
- Prior art keywords
- data
- chart
- library
- request
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a chart database data accuracy testing method and a chart database data accuracy testing device with good feasibility and wide applicability. The method for testing the data accuracy of the chart database comprises the following steps: accessing a chart library display page, and positioning request information of chart data of the chart library by using a network bale plucking tool; sending a simulation request to a web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain source data information of the chart library; acquiring data to be displayed corresponding to a chart of a chart library from a client; data cleaning is carried out on the source data information according to the format of the data to be displayed, and cleaned source data are obtained; and comparing the cleaned source data with the data to be displayed, and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent.
Description
Technical Field
The invention relates to the technical field of computers and software thereof, in particular to a method and a device for testing the data accuracy of a chart library.
Background
With the advent of the big data age, data is visualized as one of the important choices in order to make better use of data resources. Echarts is a pure Javascript chart library, is compatible with most current browsers, and can provide visual, vivid, interactive and highly personalized customized data visualization charts.
The accuracy of the Echarts chart display data values can be tested by using a webdriver template of the self of an automatic test tool. The specific process of the prior art scheme is as follows: firstly, manually positioning a data value shown in a chart by using a mouse to obtain a coordinate node where the current mouse is located (for example, obtaining by using a Firebu); and then moving to the obtained coordinate node by using a selenium analog mouse to obtain the numerical information shown in the current chart. And finally, comparing the data to be displayed to verify the accuracy of the data.
However, the above prior art solutions are not well suited and become less desirable in some scenarios. For example: if the to-be-tested Echarts chart changes, the coordinate system of the chart also changes, and the data coordinate node displayed by the corresponding chart also needs to be obtained again. If the mouse positioning event is not added to the Echarts chart to be tested, the coordinate node of the numerical value to be acquired cannot be acquired directly through the Firebu. In addition, the Echarts chart elements are dynamic elements, which results in that the data values displayed by the current mouse cannot be acquired by using selenium.
Disclosure of Invention
In view of this, the invention provides a chart database data accuracy testing method and a chart database data accuracy testing device with good feasibility and wide applicability.
To achieve the above object, according to one aspect of the present invention, a method for testing the accuracy of chart database data is provided.
The method for testing the data accuracy of the chart database comprises the following steps: accessing a chart library display page, and positioning request information of chart data of the chart library by using a network bale plucking tool; sending a simulation request to a web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain source data information of the chart library; acquiring data to be displayed corresponding to a chart of a chart library from a client; performing data cleaning on the source data information according to the format of the data to be displayed to obtain cleaned source data; and comparing the cleaned source data with the data to be displayed, and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent.
Optionally, the chart library is an Echarts chart library.
Optionally, the request information includes: request method type, request address, request header, and request parameters.
Optionally, the response message is an html page, and the step of parsing the response message to obtain source data information of the chart library includes: and matching the source data information of the chart library chart by adopting a regular expression or a wildcard according to the response message.
According to another aspect of the invention, a chart library data accuracy testing device is provided.
The chart database data accuracy testing device comprises: the access positioning module is used for accessing a chart library display page and positioning request information of chart data of the chart library by using a network packet capturing tool; the first acquisition module is used for sending a simulation request to a web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain source data information of the chart library; the second acquisition module is used for acquiring data to be displayed corresponding to the chart of the chart library from the client; the data cleaning module is used for performing data cleaning on the source data information according to the format of the data to be displayed to obtain cleaned source data; and the data comparison module is used for comparing the cleaned source data with the data to be displayed and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent.
Optionally, the chart library is an Echarts chart library.
Optionally, the request information includes: request method type, request address, request header, and request parameters.
Optionally, the response message is an html page, and the first obtaining module is further configured to: and matching the source data information of the chart library chart by adopting a regular expression or a wildcard according to the response message.
According to the technical scheme of the invention, the crawler idea is adopted to automatically acquire the source data, so that the method has the advantage of high automation degree. In addition, the test method and the test device of the invention depend on the source data rather than the display result of the chart library, and have the advantages of good usability and wide applicability. The test method and the test device can obtain the target data only by simulating the web request once, and have the advantages of simplicity, convenience and practicability.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a chart library data accuracy testing method according to an embodiment of the invention;
FIG. 2 is a display of an inventory quantity of test objects according to one embodiment of the present invention;
FIG. 3 is a diagram of a request message for a locate according to one embodiment of the invention;
FIG. 4 is a schematic diagram of the main modules of the chart database data accuracy testing device according to the embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of the main steps of a chart database data accuracy testing method according to an embodiment of the invention. As shown in fig. 1, the method of the embodiment of the present invention may mainly include steps a to E as follows.
Step A: and accessing a chart library display page, and positioning request information of chart data of the chart library by using a network packet capturing tool. Wherein the chart library may be an Echarts chart library.
For example, an Echarts display page may be accessed using a firefox browser and then a Web view tool owned by the firefox browser is used to locate the requested information to the Echarts chart data the requested information may include ① request method type (post or get) ② request address ③ request header ④ request parameters.
And B: and sending a simulation request to the web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain the source data information of the chart in the chart library. If the response message is an html page, a regular expression or a wildcard can be adopted to match the data value of the chart base.
For example: in order to obtain the stock quantities of the commodities in different warehouses, the request information needs to include commodity SKUs and corresponding warehouse numbers. And if the response message is an html page, matching the stock of the request warehouse by adopting a regular expression. Examples may refer to fig. 2 and 3. The test object is the inventory quantity display graph in fig. 2, the located request message is a request of a gray selection part in fig. 3, and the response message is the data source of the inventory quantity display graph.
And C: and acquiring data to be displayed corresponding to the chart of the chart library from the client.
Step D: and performing data cleaning on the source data information according to the format of the data to be displayed to obtain cleaned source data. For example: the source data information may be formatted into a json string or list and then saved, with reference to the format of the data to be displayed.
Step E: and comparing the cleaned source data with the data to be displayed, and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent. If the two are not the same or not the same, it means that the data displayed by the chart of the chart library is wrong, and a prompt message indicating that the accuracy test of the data of the chart library fails should be sent.
Therefore, the chart database data accuracy testing method has the advantage of high automation degree because the crawler idea is adopted to automatically acquire the source data. In addition, the method depends on the source data rather than the display result of the chart in the chart library, and has the advantages of good usability and wide applicability. The method can obtain the target data by only simulating the web request once, and has the advantage of simplicity and convenience.
FIG. 4 is a schematic diagram of the main modules of the chart database data accuracy testing device according to the embodiment of the invention. As shown in FIG. 4, the chart library data accuracy test 40 of an embodiment of the present invention may include: the system comprises an access positioning module 41, a first acquisition module 42, a second acquisition module 43, a data cleaning module 44 and a data comparison module. Wherein the chart library may be an Echarts chart library.
For example, the access positioning module 41 may access the chart library display page using a firefox browser and then locate the requested information to the chart library chart data using the firefox browser's own web viewing tool.
The first obtaining module 42 is actually an interface for communicating with the web server. The method is used for sending a simulation request to the web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain the source data information of the chart library. If the response message is an html page, a regular expression or a wildcard can be adopted to match the data value.
For example: in order to obtain the stock quantities of the commodities in different warehouses, the request information needs to include commodity SKUs and corresponding warehouse numbers. And if the response message is an html page, matching the stock of the request warehouse by adopting a regular expression.
The data cleaning module 44 is configured to perform data cleaning on the source data information with reference to the format of the data to be displayed, so as to obtain cleaned source data. For example: the source data information may be formatted into a json string or list and then saved, with reference to the format of the data to be displayed.
The data comparison module 45 is configured to perform data comparison between the cleaned source data and the data to be displayed, and send out prompt information indicating that the accuracy test of the chart library data is passed if the cleaned source data and the data to be displayed are consistent. If the two are not the same or not the same, it means that the data displayed by the chart in the chart library is wrong, and the data comparison module 45 should send a prompt message indicating that the accuracy test of the chart library data is failed.
Therefore, the chart database data accuracy testing device provided by the embodiment of the invention has the advantage of high automation degree because the crawler thought is adopted to automatically acquire the source data. In addition, the device depends on the source data rather than the display result of the chart in the chart library, and has the advantages of good usability and wide applicability. The device can obtain the target data by only simulating one web request, and has the advantages of simplicity, convenience and easiness.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (8)
1. A method for testing the data accuracy of a chart library is characterized by comprising the following steps:
accessing a chart library display page, and positioning request information of chart data of the chart library by using a network bale plucking tool;
sending a simulation request to a web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain source data information of the chart library;
acquiring data to be displayed corresponding to a chart of a chart library from a client;
performing data cleaning on the source data information according to the format of the data to be displayed to obtain cleaned source data;
and comparing the cleaned source data with the data to be displayed, and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent.
2. The chart library data accuracy testing method of claim 1, wherein the chart library is an Echarts chart library.
3. The chart library data accuracy testing method according to claim 1, wherein the request information comprises: request method type, request address, request header, and request parameters.
4. The chart library data accuracy testing method according to claim 1, wherein the response message is an html page, and the step of parsing the response message to obtain source data information of the chart library chart comprises: and matching the source data information of the chart library chart by adopting a regular expression or a wildcard according to the response message.
5. A chart database data accuracy testing device is characterized by comprising:
the access positioning module is used for accessing a chart library display page and positioning request information of chart data of the chart library by using a network packet capturing tool;
the first acquisition module is used for sending a simulation request to a web server according to the request information, receiving a response message sent by the web server, and analyzing the response message to obtain source data information of the chart library;
the second acquisition module is used for acquiring data to be displayed corresponding to the chart of the chart library from the client;
the data cleaning module is used for performing data cleaning on the source data information according to the format of the data to be displayed to obtain cleaned source data;
and the data comparison module is used for comparing the cleaned source data with the data to be displayed and sending prompt information indicating that the accuracy test of the chart database data is passed under the condition that the cleaned source data and the data to be displayed are consistent.
6. The chart library data accuracy testing apparatus according to claim 5, wherein the chart library is an Echarts chart library.
7. The chart library data accuracy testing apparatus according to claim 5, wherein the request information includes: request method type, request address, request header, and request parameters.
8. The apparatus for testing accuracy of data in a chart repository of claim 5, wherein the response message is an html page, and the first obtaining module is further configured to: and matching the source data information of the chart library chart by adopting a regular expression or a wildcard according to the response message.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610854966.0A CN107870854B (en) | 2016-09-27 | 2016-09-27 | Method and device for testing data accuracy of chart library |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610854966.0A CN107870854B (en) | 2016-09-27 | 2016-09-27 | Method and device for testing data accuracy of chart library |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107870854A CN107870854A (en) | 2018-04-03 |
CN107870854B true CN107870854B (en) | 2020-06-30 |
Family
ID=61752119
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610854966.0A Active CN107870854B (en) | 2016-09-27 | 2016-09-27 | Method and device for testing data accuracy of chart library |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107870854B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112035336A (en) * | 2019-06-04 | 2020-12-04 | 北京京东尚科信息技术有限公司 | Test method, test device and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102214140A (en) * | 2011-06-21 | 2011-10-12 | 中兴通讯股份有限公司 | Method and system for automatic software testing |
CN102622292A (en) * | 2011-01-27 | 2012-08-01 | 中国人民解放军63928部队 | Web application function testing method based on standardized testing language |
EP2854065A1 (en) * | 2013-09-30 | 2015-04-01 | Kaspersky Lab, ZAO | A system and method for evaluating malware detection rules |
CN105868310A (en) * | 2016-03-25 | 2016-08-17 | 联想(北京)有限公司 | Data processing method and device and electronic device |
-
2016
- 2016-09-27 CN CN201610854966.0A patent/CN107870854B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102622292A (en) * | 2011-01-27 | 2012-08-01 | 中国人民解放军63928部队 | Web application function testing method based on standardized testing language |
CN102214140A (en) * | 2011-06-21 | 2011-10-12 | 中兴通讯股份有限公司 | Method and system for automatic software testing |
EP2854065A1 (en) * | 2013-09-30 | 2015-04-01 | Kaspersky Lab, ZAO | A system and method for evaluating malware detection rules |
CN105868310A (en) * | 2016-03-25 | 2016-08-17 | 联想(北京)有限公司 | Data processing method and device and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN107870854A (en) | 2018-04-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109302522B (en) | Test method, test device, computer system, and computer medium | |
US8745641B1 (en) | Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface | |
CN109408375B (en) | Method and device for generating interface document | |
CN108628748B (en) | Automatic test management method and automatic test management system | |
CN107918575B (en) | Page state monitoring method and device | |
CN105099811A (en) | Interface testing method and device | |
US20170343983A1 (en) | System and method for generating machining control data of numerical control machine tool | |
US20160306690A1 (en) | Integrated test design, automation, and analysis | |
CN109739725A (en) | Monitoring method, device and system based on browser and storage medium | |
CN110908890A (en) | Automatic test method and device for interface | |
CN108459850B (en) | Method, device and system for generating test script | |
CN108614742B (en) | Report data verification method, system and device | |
CN109840192B (en) | Method and device for automatic testing | |
CN107944005B (en) | Data display method and device | |
CN109408763B (en) | Method and system for managing resume of different templates | |
US9262550B2 (en) | Processing semi-structured data | |
CN110704476A (en) | Data processing method, device, equipment and storage medium | |
CN113312260B (en) | Interface test method, device, equipment and storage medium | |
CN113282488A (en) | Terminal test method and device, storage medium and terminal | |
CN110866205A (en) | Method and apparatus for storing information | |
CN108809896A (en) | A kind of information calibration method, device and electronic equipment | |
CN107870854B (en) | Method and device for testing data accuracy of chart library | |
KR102635847B1 (en) | Apparatus and method for application test automation | |
CN103365764B (en) | A kind of wireless page measurement techniques & apparatuses | |
CN109885472A (en) | Test and management method and system and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |