CN110795494A - Automatic testing method and device for synchronous and asynchronous cache data - Google Patents

Automatic testing method and device for synchronous and asynchronous cache data Download PDF

Info

Publication number
CN110795494A
CN110795494A CN201810782831.7A CN201810782831A CN110795494A CN 110795494 A CN110795494 A CN 110795494A CN 201810782831 A CN201810782831 A CN 201810782831A CN 110795494 A CN110795494 A CN 110795494A
Authority
CN
China
Prior art keywords
database
data
compared
query result
cache system
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.)
Pending
Application number
CN201810782831.7A
Other languages
Chinese (zh)
Inventor
朱媛媛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810782831.7A priority Critical patent/CN110795494A/en
Publication of CN110795494A publication Critical patent/CN110795494A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses an automatic testing method and device for cache data synchronization and asynchronization, and relates to the technical field of computers. One embodiment of the method comprises: inquiring a database field to be inquired to obtain an inquiry result; acquiring data to be compared from a cache system according to the query result; and comparing the query result with the data to be compared to determine a test result. The implementation mode can automatically complete data comparison, saves time and labor and has high efficiency; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronization problems in the least time consumption, ensures the normal and stable operation of the online project, and can adapt to various asynchronization test scenes.

Description

Automatic testing method and device for synchronous and asynchronous cache data
Technical Field
The invention relates to the technical field of computers, in particular to an automatic testing method and device for cache data synchronization and asynchronization.
Background
The introduction of caching in a distributed system may improve performance, but the data may exist in two copies, one in the database and one in the cache. If any of the updates cause inconsistencies in the data, the integrity of the data is destroyed. Therefore, it is very important to synchronize data in the cache and the database.
At present, a data synchronization mechanism between a cache and a database generally adopts an asynchronous queue mode to reduce time consumption, and message production and consumption can be processed by adopting message middleware such as kafka and the like. For example, a Binlog Event (Binlog Event) acquired by an application instance (instance) is published to Topic (message Topic) of Kafka, an actual service application only needs to subscribe and consume the corresponding Topic, the Binlog Event can be obtained in real time, and the obtained Binlog Event can be processed in subsequent service logic. The Binlog is a file in binary format, and is used for recording SQL (structured query language) statement information updated on the database by a user.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the manual comparison is easy to have errors, the reliability is low, the compared data is limited, the problems can not be found, the test accuracy is poor, and great risks are caused to the quality of the project; if accuracy is to be achieved, a large range of data must be covered, which is time consuming, labor intensive, inefficient, and costly.
Disclosure of Invention
In view of this, embodiments of the present invention provide an automatic test method and apparatus for synchronous and asynchronous cache data, which can automatically complete data comparison, save time and labor, and have high efficiency; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronization problems in the least time consumption, ensures the normal and stable operation of the online project, and can adapt to various asynchronization test scenes.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided an automated testing method for cache data synchronization and asynchronization, including: a database field to be queried to obtain a query result; acquiring data to be compared from a cache system according to the query result; and comparing the query result with the data to be compared to determine a test result.
Optionally, querying a database field to be queried to obtain a query result includes: and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
Optionally, according to the query result, obtaining data to be compared from the caching system includes: determining keys from the query result according to a preset assembly rule; and in a cache system, determining a value corresponding to the key, and taking the value as data to be compared.
Optionally, querying a database field to be queried to obtain a query result includes: inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
according to the query result, obtaining the data to be compared from the cache system comprises the following steps: and acquiring a plurality of data to be compared from the cache system according to the list object.
Optionally, before querying the database field to be queried, the method further includes: acquiring database connection information and cache system connection information according to the extensible markup language file; establishing connection with a database based on the database connection information; and establishing connection with the cache system based on the cache system connection information.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an automatic test apparatus for cache data synchronization and asynchronization, including: the result acquisition module is used for inquiring the database field to be inquired so as to obtain an inquiry result; the data to be compared acquisition module is used for acquiring data to be compared from the cache system according to the query result; and the comparison module is used for comparing the query result with the data to be compared and determining a test result.
Optionally, the result obtaining module is further configured to: and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
Optionally, the data to be compared obtaining module is further configured to: determining keys from the query result according to a preset assembly rule; and in a cache system, determining a value corresponding to the key, and taking the value as data to be compared.
Optionally, the result obtaining module is further configured to: inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
the data to be compared acquisition module is further used for: and acquiring a plurality of data to be compared from the cache system according to the list object.
Optionally, the apparatus further comprises a connection module configured to: acquiring database connection information and cache system connection information according to the extensible markup language file; establishing connection with a database based on the database connection information; and establishing connection with the cache system based on the cache system connection information.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the automatic test method for cache data synchronization and asynchronization of the embodiment of the invention.
To achieve the above object, according to yet another aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program, which when executed by a processor, implements an automated testing method for cache data synchronization and asynchronization of the embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: because the database field to be queried is queried to obtain a query result; acquiring data to be compared from a cache system according to the query result; the technical means of comparing the query result with the data to be compared and determining the test result can automatically test the synchronous and asynchronous cached data, and is time-saving, labor-saving and high in efficiency; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronization problems in the least time consumption, ensures the normal and stable operation of the online project, and can adapt to various asynchronization test scenes.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
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 a main flow of an automated testing method for cache data synchronization and asynchronization according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a main flow of an automated testing method for cache data synchronization and asynchronization according to another embodiment of the invention;
FIG. 3 is a schematic diagram of the main modules of an automated test equipment for synchronous and asynchronous caching of data according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an 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 as merely exemplary. 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 a main flow of an automated testing method for cache data synchronization and asynchronization according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step S101: inquiring a database field to be inquired to obtain an inquiry result;
step S102: acquiring data to be compared from a cache system according to the query result;
step S103: and comparing the query result with the data to be compared to determine a test result.
In an embodiment of the invention, the database may be a Mysql database. The Mysql database is a relational database, which stores data in different tables, has high reliability, and is generally used for persistent storage. The caching system may be a Redis database. Redis is an open source, log-type, Key-Value database written in ANSIC language, supporting network, based on memory and persistent, and belongs to a non-relational database. The database fields to be queried may be preconfigured in an extensible markup language file (xml file), where xml refers to extensible markup language, designed to transmit and store data.
In addition, related connection information of the Mysql database and the Redis database, a field name of the database to be queried, a table name of the database to be queried, a key assembly rule and a comparison rule can be configured in the xml file in advance, wherein the related connection information can comprise a configuration file name of the database and a configuration file name of the Redis database.
For step S101, the database fields refer to columns of the table, each field containing information of a certain topic.
As a specific example, the process of querying a database field to be queried to obtain a query result may include the following steps:
and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
Wherein the field name is used to represent the field. And determining the storage position of the database field to be queried according to the name of the database table to be queried. According to the field name of the database to be queried and the table name of the database to be queried, a database query statement (namely SQL statement) can be assembled, and then the database query statement is executed to obtain a query result. The query result may include the name of the database field to be queried and the value corresponding to the field name. Among them, SQL (Structured Query Language) is a database Query and programming Language for accessing data and querying, updating, and managing a relational database system. The field of the database to be queried and the table of the database to be queried can be flexibly set according to the test scene, and the invention is not limited herein.
For step S102, the specific process may include the following steps:
determining keys from the query result according to a preset assembly rule;
and in a cache system, determining a value corresponding to the key, and taking the value as data to be compared.
The preset assembly rule specifies which fields in the query result are assembled into keys (keys) according to a certain sequence. According to the assembly rule, the values of the specified fields in the query result can be assembled into a key capable of querying Redis, then the Redis is queried, and the corresponding value (value) under the key is obtained, wherein the value (value) is the data to be compared.
For step S103, the data to be compared and the query result may be compared according to a preset comparison rule, that is, the value is compared with the value corresponding to the database field to be queried, so as to obtain a comparison result. The comparison results may be equal, may be inclusive, etc., which are set by the comparison rules. The comparison rule can be flexibly set according to the application scene, and the invention does not limit the rule.
In an alternative embodiment, querying the database field to be queried to obtain the query result includes: inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
according to the query result, obtaining the data to be compared from the cache system comprises the following steps: and acquiring a plurality of data to be compared from the cache system according to the list object.
In practical applications, in order to improve efficiency, a whole column is queried at one time during query, that is, a plurality of items to be queried in a database table to be queried are queried, and a query result set is obtained, where the query result set may include a unique identifier (e.g., ID) of each item to be queried and a value corresponding to the item to be queried. The query result set is then converted to a list object. And acquiring data to be compared from a cache system according to the list object. Wherein ResultSet: the data tables of the database result set are typically generated by executing statements that query the database. The list object (list object) refers to a sequence of results obtained after the data query statement is executed.
In this embodiment, the conversion of the data result set into a list object is to facilitate reading the data.
In an alternative embodiment, before performing step S101, the method further comprises:
acquiring database connection information and cache system connection information according to the extensible markup language file;
establishing connection with a database based on the database connection information;
and establishing connection with the cache system based on the cache system connection information.
Wherein, the extensible markup language file refers to an xml file. xml refers to extensible markup language, designed to transmit and store data. In this embodiment, the relevant connection information of the Mysql database and the Redis database, the field name of the database to be queried, the table name of the database to be queried, the key assembly rule and the comparison rule may be configured in the xml file in advance, where the relevant connection information may include the configuration file name of the database and the configuration file name of the Redis database. Further, the corresponding field type and data type of the key may be preset.
And reading the information of the database according to the configuration file name of the database in the xml file, and establishing database connection. And then assembling an SQL statement according to the configured field name of the database to be queried and the table name of the database to be queried, and executing the SQL statement to obtain a query result set.
According to the configuration file name of the Redis database in the xml file, the fragment connection information of the Redis database can be read, and Redis database connection is established. And then, according to the key assembly rule, obtaining the value of the designated field from the query result set, assembling according to the assembly rule to obtain a plurality of keys capable of querying Redis, and obtaining a plurality of values (values) corresponding to the plurality of keys.
And comparing the query result with the value (value) in sequence to obtain a test result.
The automatic testing method for the synchronous and asynchronous cache data can automatically complete data comparison, is time-saving and labor-saving, and is high in efficiency; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronization problems in the least time consumption, ensures the normal and stable operation of the online project, and can adapt to various asynchronization test scenes.
In order to better illustrate the testing method for cache data synchronization and asynchronization in the embodiment of the invention, the sku shelf-loading and shelf-unloading states in the Mysql database and the Redis database are compared as an example for explanation, wherein sku refers to a product, and each sku has one sku, so that the product is convenient to identify. Such as: a product with multiple colors has multiple skus, for example: a piece of clothes has red, white, blue, and the product that each color corresponds to is a sku. The configuration information in the xml file is as follows:
<test>
properties database name database configuration file name
< tableName > b2b _ ware _ main [ -table name
<sqlParams>
<sqlParam>
< columnName skuid > -field name skuid to be queried
Data type enumeration of < columnType >1</columnType > - -skiuid
</sqlParam>
<sqlParam>
< columnName skustate > -field name skustate to be queried
Data type enumeration of < columnType >1</columnType > -skustate
</sqlParam>
</sqlParams>
< cacheParam > -cache fetch configuration
Properties cache-cache configuration file name
< key > "b2b. ware. skust." + skiid-key assembly rule
< KeyType >1</KeyType > -data type enumeration
</cacheParam>
< expectValue > - -matching rule
< columnName skustate > - - - - -taking the corresponding value of the database field
< checkWay >5</checkWay > -comparison rules (equal, inclusive, etc.)
</expectValue>
</test>
As shown in fig. 2, the implementation process is as follows:
acquiring a configuration file name of a database from a dataSource node of an xml file, reading a corresponding configuration file to acquire connection information of the database, then establishing database connection, acquiring database field names skiid and skustate to be inquired from a plurality of nodes of sqlParam, acquiring a table name of the database to be inquired from a tableName node, and then splicing an SQL statement: and (3) selecting a skuid, skustate from b2b _ ware _ main, executing the SQL statement to obtain a query result set of 2 fields of skuid and skustate, and then unloading the result set ResultSet into a list object. For example, the query result set is shown in Table 1 below:
table 1:
skuid skustate query results
102196 State1 102196-State1
102197 State2 102197-State2
N StateN N-StateN
Acquiring a configuration file name of Redis from a cachesource node of an xml file, reading fragment connection information that a corresponding configuration file can take to Redis, then establishing Redis connection, and acquiring an assembly rule of a key of Redis from the key node, wherein the assembly rule in the program code is 'b 2 b.ware.skust.' + skuid, namely a connection string of a character string 'b 2 b.ware.skust.' and skuid, circularly traverses the whole list object, reads a value corresponding to a skuid field, then assembles the value corresponding to the b2b.ware.skust character string, for example, reads a value corresponding to a first element skuid field of the list, and finally assembles the result of the key is b2 b.ware.skust.196, and then acquires the value corresponding to the key in the Redis. For example, keys and values may be as shown in Table 2 below:
table 2:
skuid skustate query results key value
102196 State1 102196-State1 b2b.ware.skustate.102196 value1
102197 State2 102197-State2 b2b.ware.skustate.102197 value2
N StateN N-StateN b2b.ware.skustate.N valueN
And acquiring a database field name needing to be compared with a key from a columnName child node in the expectValue node, and taking values corresponding to the field name to be sequentially compared with a value, wherein the comparison result can be equal to or not equal to, contains and the like and is determined by an enumeration value of a checkWay. For example, the comparative results are shown in table 3 below:
table 3:
Figure BDA0001733010430000101
the method provided by the embodiment of the invention can cover large-batch test data without manual intervention, automatically completes data comparison, can find many problems ignored by human eyes, is time-saving and labor-saving, has high reliability, finds the most asynchronous problems with the least time consumption, is flexible in configuration, and can adapt to various asynchronous test scenes, such as synchronization of a database and Redis, synchronization of the database and ES (Elastic Search, which is a Search server based on Lucene), and the like.
Fig. 3 is a schematic diagram of main modules of an automatic test device for synchronous and asynchronous cache data according to an embodiment of the present invention, as shown in fig. 3, the device 300 includes:
a result obtaining module 301, configured to query a database field to be queried to obtain a query result;
a to-be-compared data obtaining module 302, configured to obtain data to be compared from the cache system according to the query result;
a comparison module 303, configured to compare the query result with the data to be compared, and determine a test result.
Optionally, the result obtaining module 301 is further configured to: and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
Optionally, the to-be-compared data obtaining module 302 is further configured to: determining keys from the query result according to a preset assembly rule; and in a cache system, determining a value corresponding to the key, and taking the value as the data to be compared.
Optionally, the result obtaining module 301 is further configured to: inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
the to-be-compared data obtaining module 302 is further configured to: and acquiring a plurality of data to be compared from the cache system according to the list object.
Optionally, the apparatus further comprises a connection module configured to: acquiring database connection information and cache system connection information according to the extensible markup language file; establishing connection with a database based on the database connection information; and establishing connection with the cache system based on the cache system connection information.
The automatic testing device for the synchronous and asynchronous cache data can automatically complete data comparison, is time-saving and labor-saving, and is high in efficiency; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronization problems in the least time consumption, ensures the normal and stable operation of the online project, and can adapt to various asynchronization test scenes.
The device can execute the method provided by the embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
Fig. 4 illustrates an exemplary system architecture 400 of an automated testing method for cache data synchronization and asynchronization or a testing apparatus for cache data synchronization and asynchronization to which embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various communication client applications installed thereon, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 401, 402, and 403. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., target push information and product information) to the terminal device.
It should be noted that the automated testing method for cache data synchronization and asynchronization provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the automated testing apparatus for cache data synchronization and asynchronization is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not in some cases constitute a limitation on the unit itself, and for example, the sending module may also be described as a "module that sends a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
inquiring a database field to be inquired to obtain an inquiry result;
acquiring data to be compared from a cache system according to the query result;
and comparing the query result with the data to be compared to determine a test result.
According to the technical scheme of the embodiment of the invention, data comparison can be automatically completed, time and labor are saved, and the efficiency is high; the method can cover mass data, does not need manual intervention, has high reliability, finds the most asynchronous problems with least time consumption, and ensures the normal and stable operation of the online project. And the method can be suitable for various asynchronous test scenes.
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 (12)

1. An automated testing method for cache data synchronization and asynchronization is characterized by comprising the following steps:
inquiring a database field to be inquired to obtain an inquiry result;
acquiring data to be compared from a cache system according to the query result;
and comparing the query result with the data to be compared to determine a test result.
2. The method of claim 1, wherein querying a database field to be queried to obtain a query result comprises:
and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
3. The method of claim 1, wherein obtaining the data to be compared from the caching system according to the query result comprises:
determining keys from the query result according to a preset assembly rule;
and in a cache system, determining a value corresponding to the key, and taking the value as data to be compared.
4. The method of claim 1, wherein querying a database field to be queried to obtain a query result comprises:
inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
according to the query result, obtaining the data to be compared from the cache system comprises the following steps: and acquiring a plurality of data to be compared from the cache system according to the list object.
5. The method according to any of claims 1-4, wherein prior to querying the database field to be queried, the method further comprises:
acquiring database connection information and cache system connection information according to the extensible markup language file;
establishing connection with a database based on the database connection information;
and establishing connection with the cache system based on the cache system connection information.
6. An automated testing device for synchronous and asynchronous cache data, comprising:
the result acquisition module is used for inquiring the database field to be inquired so as to obtain an inquiry result;
the data to be compared acquisition module is used for acquiring data to be compared from the cache system according to the query result;
and the comparison module is used for comparing the query result with the data to be compared and determining a test result.
7. The apparatus of claim 6, wherein the result obtaining module is further configured to:
and obtaining a database query statement according to the field name of the database to be queried and the table name of the database to be queried, and executing the database query statement to obtain a query result.
8. The apparatus of claim 6, wherein the data to be compared acquisition module is further configured to:
determining keys from the query result according to a preset assembly rule;
and in a cache system, determining a value corresponding to the key, and taking the value as data to be compared.
9. The apparatus of claim 6, wherein the result obtaining module is further configured to: inquiring a plurality of items to be inquired under the field of a database to be inquired to obtain an inquiry result set; converting the query result set into a list object;
the data to be compared acquisition module is further used for: and acquiring a plurality of data to be compared from the cache system according to the list object.
10. The apparatus according to any one of claims 6-9, further comprising a connection module for:
acquiring database connection information and cache system connection information according to the extensible markup language file;
establishing connection with a database based on the database connection information;
and establishing connection with the cache system based on the cache system connection information.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201810782831.7A 2018-07-17 2018-07-17 Automatic testing method and device for synchronous and asynchronous cache data Pending CN110795494A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810782831.7A CN110795494A (en) 2018-07-17 2018-07-17 Automatic testing method and device for synchronous and asynchronous cache data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810782831.7A CN110795494A (en) 2018-07-17 2018-07-17 Automatic testing method and device for synchronous and asynchronous cache data

Publications (1)

Publication Number Publication Date
CN110795494A true CN110795494A (en) 2020-02-14

Family

ID=69425066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810782831.7A Pending CN110795494A (en) 2018-07-17 2018-07-17 Automatic testing method and device for synchronous and asynchronous cache data

Country Status (1)

Country Link
CN (1) CN110795494A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782667A (en) * 2020-06-22 2020-10-16 成都校精灵科技有限公司 MongoDB updating data driving method, system and storage medium
CN112269807A (en) * 2020-11-09 2021-01-26 浪潮软件股份有限公司 Configurable credit file retrieval method and system based on Elasticissearch technology
CN113742247A (en) * 2021-09-23 2021-12-03 四川新网银行股份有限公司 Data acquisition test optimization method for sqoop

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782667A (en) * 2020-06-22 2020-10-16 成都校精灵科技有限公司 MongoDB updating data driving method, system and storage medium
CN112269807A (en) * 2020-11-09 2021-01-26 浪潮软件股份有限公司 Configurable credit file retrieval method and system based on Elasticissearch technology
CN113742247A (en) * 2021-09-23 2021-12-03 四川新网银行股份有限公司 Data acquisition test optimization method for sqoop
CN113742247B (en) * 2021-09-23 2023-04-18 四川新网银行股份有限公司 Data acquisition test optimization method for sqoop

Similar Documents

Publication Publication Date Title
CN110019350B (en) Data query method and device based on configuration information
CN107451109B (en) Report generation method and system
CN107256206B (en) Method and device for converting character stream format
CN107729399B (en) Data processing method and device
US10216556B2 (en) Master database synchronization for multiple applications
CN110019263B (en) Information storage method and device
CN110795494A (en) Automatic testing method and device for synchronous and asynchronous cache data
US20180081940A1 (en) Remote query optimization in multi data sources
CN111666293A (en) Database access method and device
CN110909022A (en) Data query method and device
US20170032052A1 (en) Graph data processing system that supports automatic data model conversion from resource description framework to property graph
CN112818026A (en) Data integration method and device
CN113760948A (en) Data query method and device
CN111435406A (en) Method and device for correcting database statement spelling errors
CN112100168A (en) Method and device for determining data association relationship
US10366060B2 (en) Augmenting database schema using information from multiple sources
CN111125163A (en) Method and apparatus for processing data
CN113760240A (en) Method and device for generating data model
US10114864B1 (en) List element query support and processing
CN110704481B (en) Method and device for displaying data
CN113268488B (en) Method and device for data persistence
CN113760695A (en) Method and device for positioning problem code
CN110109919B (en) Method and device for determining logic information
CN111177183B (en) Method and device for generating database access statement
CN110866002A (en) Method and device for processing sub-table data

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