CN116431494A - Positioning method and positioning device for test data, target equipment and target server - Google Patents

Positioning method and positioning device for test data, target equipment and target server Download PDF

Info

Publication number
CN116431494A
CN116431494A CN202310363208.9A CN202310363208A CN116431494A CN 116431494 A CN116431494 A CN 116431494A CN 202310363208 A CN202310363208 A CN 202310363208A CN 116431494 A CN116431494 A CN 116431494A
Authority
CN
China
Prior art keywords
query
target
data
test data
test
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
CN202310363208.9A
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.)
Peoples Insurance Company of China
Original Assignee
Peoples Insurance Company of China
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 Peoples Insurance Company of China filed Critical Peoples Insurance Company of China
Priority to CN202310363208.9A priority Critical patent/CN116431494A/en
Publication of CN116431494A publication Critical patent/CN116431494A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a positioning method and device for test data, target equipment and a target server, and belongs to the field of testing. The method comprises the following steps: the target device sends a query command to a service database, wherein the query command comprises a command written by using a structured query language, and the service database is used for storing service data; the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data.

Description

Positioning method and positioning device for test data, target equipment and target server
Technical Field
The application belongs to the field of computers, and particularly relates to a positioning method and device for test data, target equipment and a target server.
Background
With the development of computer technology, testers often need to find test data corresponding to a scene.
In the prior art, since data based on an application that provides a query service to the outside often exists in a plurality of large data components (e.g., a column database, a search engine, etc.), the entire query logic of test data needs to be completed depending on the plurality of components. Taking a plurality of components including a column database and a search engine as an example, in the process of finding out test data, the search engine is utilized to finish mapping from a non-primary key of the search engine to a primary key, and then the column database is utilized to acquire the test data based on detail data of the primary key.
As can be seen from the above, the test data acquisition process in the prior art needs to correlate and locate the test data in multiple components, which results in low efficiency of locating the required test data and is not beneficial to the progress of the test work.
Disclosure of Invention
The embodiment of the application provides a positioning method, a positioning device, target equipment and a target server for test data, which can solve the problem that in the prior art, the test data are required to be positioned in a plurality of components in an associated manner in the process of acquiring the test data, so that the efficiency of positioning the required test data is low.
In a first aspect, an embodiment of the present application provides a method for positioning test data, where the method includes:
the target device sends a query command to a service database, wherein the query command comprises a command written by using a structured query language, and the service database is used for storing service data;
the target equipment receives a query result which is returned by the service database and corresponds to the query command;
wherein the conditions of the structured query language and the query results together serve as test data.
As an optional implementation manner, the target device uses the test data to test the target interface, so as to obtain a test result;
Wherein the target interface comprises an interface to a target database comprising a database for providing a query service.
As an optional implementation manner, the testing the target interface by using the test data by the target device to obtain a test result includes:
the target equipment acquires an interface return result, wherein the interface return result is obtained by inquiring through the target interface by utilizing the condition of the structured inquiry language;
under the condition that the query result is consistent with the interface return result, the test result is that the target interface passes the test;
and under the condition that the query result is inconsistent with the interface return result, the test result is that the target interface fails the test.
As an optional implementation manner, the target device obtaining interface returns a result, including:
the target device sends a test command to a query service node through the target interface, wherein the test command comprises the condition of the structured query language;
and the target equipment receives an interface return result sent by the query service node.
In a second aspect, an embodiment of the present application provides a method for positioning test data, where the method includes:
The method comprises the steps that a target server receives a query command of target equipment, wherein the query command comprises a command written by using a structured query language, and a service database is arranged on the target server and is used for storing service data;
the target server returns a query result corresponding to the query command to the target device;
wherein the conditions of the structured query language and the query results together serve as test data.
In a third aspect, an embodiment of the present application provides a positioning device for test data, including:
the system comprises a sending module, a service database and a processing module, wherein the sending module is used for sending query commands to the service database, the query commands comprise commands written by using a structured query language, and the service database is used for storing service data;
the receiving module is used for receiving a query result which is returned by the service database and corresponds to the query command;
wherein the conditions of the structured query language and the query results together serve as test data.
In a fourth aspect, an embodiment of the present application provides a positioning device for test data, including:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a query command of target equipment, the query command comprises a command written by using a structured query language, and a service database is arranged on a target server and is used for storing service data;
The sending module is used for returning a query result corresponding to the query command to the target equipment;
wherein the conditions of the structured query language and the query results together serve as test data.
In a fifth aspect, embodiments of the present application provide a target device, including: a memory and a processor, the memory storing a computer program which, when executed, is capable of implementing a method as described in the first aspect.
In a sixth aspect, an embodiment of the present application provides a target server, including: a memory and a processor, the memory storing a computer program which, when executed, is capable of carrying out the method as described in the second aspect.
In a seventh aspect, embodiments of the present application provide a readable storage medium, wherein a program or instructions are stored on the readable storage medium, which when executed by a processor, implement the steps in the method as described in the first or second aspect.
In the embodiment of the application, the target device sends a query command to a service database, wherein the query command comprises a command written by using a structured query language, and the service database is used for storing service data; the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data. Therefore, the target equipment directly sends the query command to the service database, the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated way among a plurality of big data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an exemplary implementation environment of a method for locating test data provided by embodiments of the present application;
FIG. 2 is a flowchart of a method for locating test data according to an embodiment of the present application;
FIG. 3 is a flow chart of another method for locating test data provided by an embodiment of the present application;
FIG. 4 is a flow chart of another method for locating test data provided by an embodiment of the present application;
FIG. 5 is a flowchart of another method for locating test data according to an embodiment of the present application;
FIG. 6 is a flowchart of another method for locating test data according to an embodiment of the present application;
FIG. 7 is a block diagram of a positioning device for test data according to an embodiment of the present application;
FIG. 8 is a block diagram of another test data positioning device according to an embodiment of the present application;
FIG. 9 is a block diagram of a target device according to an embodiment of the present application;
fig. 10 is a block diagram of a target server according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type and not limited to the number of objects, e.g., the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Before introducing the method for positioning test data provided by the embodiment of the application, some terms possibly related to the method for positioning test data provided by the embodiment of the application are explained.
The service database refers to a related service set for providing data persistence service for the service system, the service data often occur in the service database, and the common service database is a relational database supporting transactions, such as MySQL, oracle, and the like.
Relational databases, which are databases that employ a relational model to organize data, store data in rows and columns for ease of user understanding, a series of rows and columns of the relational database are referred to as tables, and a set of tables forms the database. The user retrieves the data in the database by querying, which is an executable code that defines certain areas in the database. A relational model can be understood simply as a two-dimensional tabular model, and a relational database is a data organization consisting of two-dimensional tables and relationships between them.
The structured query language (Structured Query Language), abbreviated as SQL, is a special purpose programming language, a database query and programming language, for accessing data and querying, updating and managing relational database systems.
The log file is a file used for recording various running information of the service system and user operation, and is used for storing the user operation received by the service system and the record of feedback operation or information corresponding to the user operation.
Message middleware is a supportive software system that provides synchronous or asynchronous, reliable message transmission for application systems in a network environment based on queue and message passing techniques. The system comprises a topic and a partition, wherein the topic is unit measurement for classifying messages in a message middleware, a producer is responsible for sending the messages to a specific topic, and a consumer is responsible for subscribing the topic and consuming; the producer is the party sending the message. The producer is responsible for creating the message and then delivering it to the message middleware; the consumer is the party receiving the message. The consumer connects to the message middleware and receives the message, and then carries out corresponding business logic processing.
The topic is a logical concept, messages in message middleware are categorized in topic units, a producer is responsible for sending messages to a specific topic, and a consumer is responsible for subscribing to the topic and consuming.
The partition is a classification unit of the theme under the logic concept, the theme can be further subdivided into a plurality of partitions, one partition only belongs to a single theme, and the partitions are also called as theme partitions in many cases. Messages contained in different partitions under the same subject are different, the partition can be regarded as an appendable log file at the storage level, and the messages are distributed with a specific offset when being appended to the partition log file.
The elastic search is a very powerful open source search engine, has very powerful functions, and can help us to quickly find needed contents from mass data.
The column database is a database for data storage by a column related storage architecture, and is mainly suitable for batch data processing and instant query, and is commonly used as HBase, vertica. The concept of Rowkey is identical to the main key in the relational database, hbase uses Rowkey to uniquely distinguish data of a certain row, and HBase is very suitable for inquiring single record according to Rowkey.
The business system refers to a system for providing service for each business line in an organization, such as a system for underwriting, claiming, paying and the like in the insurance industry, and is a system for business data birth in the organization.
The big data system refers to a system for providing service based on the big data component, and the data in the service database are usually synchronized to the big data system in a synchronous mode by the system data, so that the retrieval and statistical analysis service of massive service data are provided based on the synchronized service data.
Fig. 1 is a schematic diagram of an exemplary implementation environment of a positioning method of test data according to an embodiment of the present application. An exemplary implementation environment of the test data positioning method provided in the embodiment of the present application is described below with reference to fig. 1.
The example implementation environment shown in fig. 1 involves three parts: service system end, data synchronization and big data system end. The service system end can comprise a service system, a service database and a log file. The business system refers to a system for providing service for each business line in an organization, such as a system for underwriting, claiming, paying and the like in the insurance industry, and is a system for business data birth in the organization.
Fig. 1 illustrates the process from the processing of a service request to the final provision of query services to the outside with large data components as data bases. As shown in FIG. 1, the business system persists the generated business data into a business database as the business logic is processed, and records the operations in the process into a log file. The data synchronization tool is used for synchronizing the change (addition, deletion and modification) of the service data into the message middleware 1 in a mode of analyzing the service database log, and the synchronization tool is used for distinguishing different topics according to the table under the general condition when the analyzed service data is produced into the message middleware 1 according to the identity of a producer, and producing different table messages into corresponding table-level topics. The big data system synchronizes the data needed by the big data system to the columnar database by developing the synchronous application to the identity of the consumer, and generates the data successfully synchronized to the columnar database to the message middleware 2, and also synchronizes the message in the message middleware 2 to the search engine in a mode of developing the synchronous application to provide the query of the non-primary key scene. The query clusters are provided with real-time and multi-dimensional high-concurrency queries based on synchronized business data and big data persistence components (e.g., hbase, elasticsearch) in an interface manner.
It should be understood that the service database and the log file shown in fig. 1 may be distributed on the same server, or may be distributed on different servers, and the message middleware may be on one server or may be on different servers. The columnar database may be located on one server, the search engine may be located on one server, and one query service node may correspond to one server. A querying party (e.g., a terminal device) may query the big data persistence component (e.g., hbase, elasticsearch) for the required information via a querying service node.
At the big data system side shown in fig. 1, since data based on an application providing a query service to the outside exists in a column database (Hbase) and a search engine (elastic search), the related art needs to rely on the column database (Hbase) and the search engine (elastic search) to complete the entire query logic of the test data. Specifically, in the process of finding out test data, the mapping from the non-primary key to the primary key of the search engine needs to be completed by using the search engine, and then the test data is acquired by using the column database based on the detail data of the primary key. This test data acquisition process requires the positioning of test data in association among multiple components, which can result in inefficient positioning of the required test data, which is detrimental to the advancement of test work.
For example, the big data system provides an interface with a function of inquiring elements such as corresponding insurance policy number, insurance starting date and final insurance date according to the insurance policy number, when testing the interface function, the insurance policy number needs to be positioned according to the insurance policy number in the elastic search, and then the elements such as corresponding insurance policy number, insurance starting date and final insurance date are positioned in the Hbase according to the insurance policy number, after the two steps are completed, the positioning work of the whole interface test data can be completed, and the externally exposed inquiry modes of big data components such as the elastic search and the Hbase are often different and complex.
According to the positioning method of the test data, the target equipment directly sends the query command to the service database, so that the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. For testers, the complete test flow often involves simultaneous positioning of data in multiple large data assemblies, and the workload is large. Based on the scheme, the tester directly locates the test data based on the service database, and the tester only needs to care about one data source of the service database, thereby omitting the work of correlation searching and locating among a plurality of big data components. For example, the query logic of the test data positioning method based on the big data component is that the test coverage from the insured person license number to the insuring list number needs to be completed in the elastic search, and after the insuring list number is positioned, the test coverage from the insuring list number to the insuring list number, the start insuring date, the final insuring date and the insuring amount is completed in the Hbase. These two phases need to be associated by applying a policy number.
Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Moreover, the data positioning based on the big data component can only solve the problem that the test data positioning of the query interface can not cover the link of synchronous application of synchronous data in the big data system, because the test data is positioned based on the big data component (Elasticsearch, hbase, etc.). In the scheme, the tester directly locates test data based on the service database, so that end-to-end test data location between the data synchronization end of the big data system and the two ends of the interface providing end is realized, the test data locating method in the scheme can cover the whole flow from data synchronization to data query of the big data system end, and end-to-end test data coverage can be realized; the test data positioning based on the big data component can only cover the query logic, but cannot cover the data synchronization stage.
In addition, the big data system based on the logic topology shown in fig. 1 provides real-time and multidimensional massive data high concurrency inquiry on the premise of guaranteeing zero perception of the service system, but has higher requirements for corresponding testers. Specifically, data based on applications that provide external query services exist in various different big data components (Hbase, elasticsearch, etc.), and a tester is required to be skilled in using a plurality of big data components to find corresponding test data, but the query manners of the different big data components often have great variability, which puts a great demand on the tester. The positioning method of the test data can realize the positioning of the test data of the big data system at the downstream of the service system based on the service database and the structured query language which are used by the testers, and the positioning work of the test data can be more efficiently and conveniently completed without higher requirements on the testers.
It should be appreciated that the positioning method of test data provided in the embodiment of the present application may be applied to the implementation environment shown in fig. 1. The service database is used for acquiring test data, and the big data persistence component (for example, hbase, elasticsearch) can provide real-time and multidimensional massive data high concurrency query.
Fig. 2 is a schematic flowchart of a positioning method of test data according to an embodiment of the present application. As shown in fig. 2, the positioning method of test data provided in the embodiment of the present application may include:
step 210: the target device sends a query command to a business database, the query command comprising a command written in a structured query language, the business database for storing business data.
The target device may be any electronic device that can send a query command to the service database, including a fixed terminal and a mobile terminal. Examples of mobile terminals may include notebooks, tablets, cell phones, and the like. The service database may be located on a target server, which may be a server or a server cluster.
The query commands include commands written in a structured query language. The structured query language (Structured Query Language), abbreviated as SQL, is a special purpose programming language, and is also a database query and programming language, generally used for accessing data and querying, updating and managing relational database systems, and the grasping of the structured language is often one of the necessary skills of information system practitioners.
The service database is a database for storing service data. The service database refers to a related service set for providing data persistence service for the service system, and a common service database is a relational database and a non-relational database, and the embodiment mainly relates to a relational database supporting transactions, such as MySQL, oracle and the like.
The service database in step 210 may be a service database in a test environment.
Step 220: the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data.
In the embodiment of the application, the target device sends a query command to a service database, wherein the query command comprises a command written by using a structured query language, and the service database is used for storing service data; the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data. Therefore, the target equipment directly sends the query command to the service database, the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated way among a plurality of big data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Fig. 3 is a schematic flowchart of a positioning method of test data according to an embodiment of the present application.
As shown in fig. 3, the positioning method of test data provided in the embodiment of the present application may include:
step 310: the target device sends a query command to a business database, the query command comprising a command written in a structured query language, the business database for storing business data.
Step 320: the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data.
The relevant explanation of steps 310 and 320 may be referred to the explanation of steps 210 and 220 in the embodiment shown in fig. 2.
Step 330: and the target equipment tests the target interface by using the test data to obtain a test result.
Wherein the target interface comprises an interface to a target database. The target database includes a database for providing a query service. The target interface may be, for example, a query interface to a target database.
For example, a structured query language is written according to the interface query logic, and it is assumed that the table structure of the service database is a policy master table (cmain) including a policy number (pro-savno), a policy number (polisyno), a start date (startdate), a final date (enddate) and a policy (amountj), and the primary key is the policy number; the insurance policy insured table (cindured) contains an insurance policy number (proposalno), a serial number (serial no) and a insured license number (identifyno), and the primary key is a combined primary key of the insurance policy number and the serial number (because of the situation that a plurality of insured persons are under one insurance policy). The insurance policy number can be a policy number when the insurance policy is applied, and the insurance policy number can be a policy number after the insurance policy takes effect.
The structured query language corresponding to the above table structure is (xxx is the entry of the interface, and the field following the select is the return list of the interface):
select
cmain.policyno,cmain.startdate,cmain.enddate,cmain.amount
from cmain inner join cinsured
on cmain.proposalno=cinsured.proposalno and cinsured.identifyno='xxx'
xxx in the code is the entry of the interface. The entry of the interface may be a query condition in the structured language. In addition, the field following the select is the back list of interfaces.
In this step, the target interface includes an interface to a target database, i.e., a query interface to the target database. The target database includes a database for providing a query service, and it should be noted that the target database is not the same database as the business database in fig. 2. The target database in this embodiment is a database at the big data system end, i.e. a big data persistence component (e.g. Hbase, elasticsearch, etc.).
The big data persistence component provides searching and statistical analysis service for the mass service data based on the synchronized service data, and the problems of synchronization delay, synchronization dislocation and the like possibly occur in the process of data synchronization, so that functional errors occur on an interface for providing the query service based on the synchronized service data, and therefore, a target interface of the query service based on a big data system needs to be tested.
In the process of testing the target interface, the target device can acquire an interface return result, wherein the interface return result is obtained by inquiring through the target interface by utilizing the condition of the structured inquiry language. The big data system generally has the capability of externally exposing in the mode of inquiring the interface, but when the big data system externally provides the capability, two steps of inquiring the application itself and synchronizing the data are needed, and errors can occur in the two steps, and any error can be exposed in the returned result of the interface. Therefore, whether the query service of the big data system has errors can be simply tested by an interface test mode.
In the embodiment of the application, the target equipment directly sends the query command to the service database, so that the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component. Moreover, by testing the target interface by using the test data, a test result is obtained, and whether the target interface providing the query service has errors can be conveniently known.
Fig. 4 is a schematic flowchart of a positioning method of test data according to an embodiment of the present application.
As shown in fig. 4, the positioning method of test data provided in the embodiment of the present application may include:
step 410: the target device sends a query command to a business database, the query command comprising a command written in a structured query language, the business database for storing business data.
Step 420: and the target equipment receives a query result which is returned by the service database and corresponds to the query command, wherein the condition of the structured query language and the query result are used as test data together.
The explanation of step 410 and step 420 may be referred to the discussion of the corresponding steps in fig. 2.
Step 430: and the target equipment acquires an interface return result, wherein the interface return result is obtained by inquiring through the target interface by utilizing the condition of the structured inquiry language.
And the target equipment can acquire an interface return result in a mode that the target interface sends a test command to the query service node. The target device may also directly receive the interface return result, for example, the third party device obtains the interface return result by sending a test command to the query service node through the target interface, and transmits the interface return result to the target device.
Step 440: and under the condition that the query result is consistent with the interface return result, the test result is that the target interface passes the test.
And the query result is a service database return result obtained by the target equipment sending a query command to the service database. The interface return result may be a result of querying a target database for providing a query service using the target interface. Specifically, the interface return result may be a return result obtained by taking at least a part of conditions of the structured query language as an entry of the big data system query interface.
For example, the operation result of the structured query language in the service database is obtained, and it is assumed that the operation result is shown in the following table:
number of insurance policy Date of start-up Date of final insurance Deposit
P3302 2011-01-01 2012-01-01 100
P1101 2013-01-01 2014-01-01 200
P4401 2015-01-01 2016-01-01 300
If the query result of the service database is compared with the query result of the interface, and the obtained interface return result is consistent with the query result of the service database under the condition of the same structured query language, the interface test is passed.
Step 450: and under the condition that the query result is inconsistent with the interface return result, the test result is that the target interface fails the test.
If the query result of the service database is compared with the interface return result, and the obtained interface return result is inconsistent with the query result of the service database, the defect of interface query logic or data synchronization is indicated, and the corresponding developer is required to further check.
In the embodiment of the application, the target equipment directly sends the query command to the service database, so that the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component. And the target interface is tested by utilizing the test data to obtain a test result, wherein the test result is that the target interface passes the test under the condition that the query result is consistent with the interface return result, and the test result is that the target interface fails the test under the condition that the query result is inconsistent with the interface return result, so that whether the target interface passes the test or fails the test can be timely obtained through comparison of the results, and the development of subsequent work is facilitated.
Fig. 5 is a schematic flowchart of a positioning method of test data according to an embodiment of the present application.
As shown in fig. 5, the positioning method of test data provided in the embodiment of the present application may include:
step 510: the target device sends a query command to a business database, the query command comprising a command written in a structured query language, the business database for storing business data.
Step 520: the target equipment receives a query result which is returned by the service database and corresponds to the query command; wherein the conditions of the structured query language and the query results together serve as test data.
The explanation of steps 510 and 520 may be referred to the description of the corresponding steps as in fig. 2-4.
Step 530: and the target equipment sends a test command to the query service node through the target interface, wherein the test command comprises the condition of the structured query language.
Step 535: and the target equipment receives an interface return result sent by the query service node.
Step 540: and under the condition that the query result is consistent with the interface return result, the test result is that the target interface passes the test.
Step 550: and under the condition that the query result is inconsistent with the interface return result, the test result is that the target interface fails the test.
As shown in FIG. 1, the query service node is part of a large data system that includes a plurality of query service nodes. The target interfaces provided by the service nodes may be tested, taking the three query service nodes shown in fig. 1 as an example, comparing the interface return result of the service database with the return result obtained by the query service node 1, comparing the interface return result of the service database with the return result obtained by the query service node 2, comparing the interface return result of the service database with the return result obtained by the query service node 3.
In the embodiment of the application, the target equipment directly sends the query command to the service database, so that the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component. And the target device sends a test command to the query service node through the target interface, wherein the test command comprises the condition of the structured query language, the test result is that the target interface passes the test under the condition that the query result is consistent with the interface return result, and the test result is that the target interface fails the test under the condition that the query result is inconsistent with the interface return result, so that the interface return result can be directly obtained through the target device, and meanwhile, whether the target interface passes the test or fails the test can be timely obtained through the comparison of the results, so that the development of subsequent work is facilitated.
Corresponding to the positioning method of the test data shown in fig. 1. Fig. 6 is a flowchart of a positioning method of test data according to an embodiment of the present application. As shown in fig. 6, the positioning method of test data provided in the embodiment of the present application may include:
step 610: the target server receives a query command for the target device. The query command comprises a command written by using a structured query language, and the target server is provided with a service database for storing service data.
The target device may be any electronic device that can send a query command to the service database, including a fixed terminal and a mobile terminal. Examples of mobile terminals may include notebooks, tablets, cell phones, and the like. The service database may be located on a target server, which may be a server or a server cluster.
The structured query language may be a structured query language written according to interface query logic. When the application scenario is insurance company query data, the table structure of the service database can cover a policy master table (cmain) and a policy insured table (cindured). The policy master table (cmain) may include a policy number (proposalno), a policy number (polisyno), a start date (startdate), a final date (enddate), and a policy amount (amountl), where the primary key is the policy number; the insurance policy insured table (cindured) may include an insurance policy number (proposalno), a serial number (serial no), and an insured license number (identifyno), and the primary key is a combined primary key of the insurance policy number and serial number (because there are multiple insureds under one policy). The structured query language corresponding to the above table structure is (xxx is the entry of the interface, and the field following the select is the anti-reference list of the interface):
select
cmain.policyno,cmain.startdate,cmain.enddate,cmain.amount
from cmain inner join cinsured
on cmain.proposalno=cinsured.proposalno and cinsured.identifyno='xxx'.
Step 620: the target server returns a query result corresponding to the query command to the target device; wherein the conditions of the structured query language and the query results together serve as test data.
After receiving the query command sent by the target device, the target server runs the query command in the service database to obtain a running result obtained by the structured query language, and when the application scene is the insurance company, the running result can refer to the following table:
number of insurance policy Date of start-up Date of final insurance Deposit
P3302 2011-01-01 2012-01-01 100
P1101 2013-01-01 2014-01-01 200
P4401 2015-01-01 2016-01-01 300
And after the target server obtains the operation result, returning the operation result to the target equipment.
Finally, a tester can use the condition of the structured query language and the query result of the service database of the test environment as test data to test a corresponding target interface (for example, the query interface provided by the big data persistence component (for example, hbase, elasticsearch and the like) shown in fig. 1), and compare the two interfaces, if the interface return result obtained through the target interface under the same query condition is consistent with the query result of the service database, the interface test is passed; if the data synchronization is inconsistent, the defect of the interface query logic or the data synchronization is indicated, and the corresponding developer is required to further check.
In the embodiment of the application, a target server receives a query command of target equipment, wherein the query command comprises a command written by using a structured query language, and a service database is arranged on the target server and is used for storing service data; the target server returns a query result corresponding to the query command to the target device; wherein the conditions of the structured query language and the query results together serve as test data. Therefore, after receiving the query command, the target server can directly acquire the query result from the service database, so that the work of searching the positioning test data in a correlated way among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Furthermore, it should be appreciated that the large data component based test data positioning can only cover the query logic, and cannot cover the data synchronization stage. In the embodiment of the application, the tester directly locates the test data based on the service database, so that the end-to-end test data location between the data synchronization end and the interface providing end of the big data system is realized.
In order to better demonstrate the advantages of the test data positioning method provided by the embodiment of the application, further description is provided below.
The method and the device evaluate the advantages and disadvantages of the test data positioning scheme, and mainly determine whether the scheme can rapidly and efficiently position the required test data on the premise of not providing higher requirements for testers. The related big data system test data positioning schemes are all based on big data components inside the system. For example, the big data system provides an interface with the function of inquiring the corresponding elements of the insurance policy number, the insurance starting date, the final insurance date and the like according to the insurance policy number, when testing the interface function, the insurance policy number needs to be positioned according to the insurance policy number in the elastic search, then the corresponding elements of the insurance policy number, the insurance starting date, the final insurance date and the like are positioned in the Hbase according to the insurance policy number, after the two steps are completed, the positioning work of the whole interface test data can be completed, and the externally exposed inquiry modes of big data components such as the elastic search and the Hbase are often different and complex. This solution has the following drawbacks: firstly, a tester needs to be skilled in using a plurality of big data components, and the inquiry modes of different big data components often have great variability; secondly, the complete test flow often involves simultaneous positioning of data in a plurality of big data components, and the workload is large; thirdly, the data positioning based on the big data component can only solve the problem that the test data positioning of the query interface can not cover the link of synchronous application of synchronous data in the big data system, because the test data is positioned based on the big data component (Elasticsearch, hbase, etc.); fourth, the data model of the big data component is designed according to the query scene, and has great difference with the data model of the business database, and the testers need to be familiar with two sets of data models at the same time.
In contrast, the positioning method of the test data provided by the embodiment of the application may have the following advantages:
first, the technical cost is low. The test personnel directly locate the test data based on the service database, and the test personnel can complete the locating work of the test data by using the skills of the test personnel which are skilled in use, so that the test personnel do not need to be familiar with a plurality of big data components in a big data system.
Second, the service cost is low. The tester directly locates the test data based on the service database, and the tester only needs to be familiar with the data model under the service scene, because the query logic in the externally exposed interface is consistent with the query logic in the service scene finally, the large data system is only introduced to meet the requirement of high-concurrency query technology bottleneck of mass data in the service database, and the related data model should not become the skill which the tester must master.
Third, the communication cost is low. Because the big data system is the downstream of the service system, the big data system does not directly generate data, the meaning and the association relation of each service element exist on the service system side, a tester needs to apply the interface query logic to the data model of the service side to write the structured query language, and the data model of the service database needs to consult the tester of the service system to acquire the write logic. Because the big data testers and the service system testers are communicated based on the service database, the communication cost of the two parties is low, and the quick mastering of the data model of the service system is facilitated.
Fourth, the full flow coverage of test data positioning. The test personnel directly locate the test data based on the service database, so that the end-to-end test data location between the data synchronization end of the big data system and the two ends of the interface providing end is realized, the test data locating method in the scheme can cover the whole flow from data synchronization to data query of the big data system end, and the end-to-end test data coverage can be realized; the test data positioning based on the big data component can only cover the query logic, but cannot cover the data synchronization stage.
Fifth, the workload is low. The tester directly positions the test data based on the service database, and the tester only needs to care about one data source of the service database, thereby omitting the work of correlation searching and positioning among a plurality of big data components. For example, a test data positioning method based on a big data component needs to complete test coverage from an insured person license number to an insurance policy number in an elastic search in an example query logic of the present intersection book; after the insurance policy number is positioned, the test coverage from the insurance policy number to the insurance policy number, the starting insurance date, the final insurance date and the insurance amount is required to be completed in Hbase; the two phases need to be associated by applying a single number.
And sixthly, providing a foundation for subsequent production defect investigation. And aiming at the production defects proposed by the query interface, an operation and maintenance personnel can apply the interface input in the production defects to the test stage, and query the structured query language corresponding to the interface in the slave library of the business database in the production environment. Comparing the returned result of the database with the returned interface, if the two are consistent, the data in the service database is inconsistent with the expected of the query initiator, and the defect-free large data system can be fed back, and the corresponding problem is fed back to the service system; if the two are inconsistent, the big data system developer performs intervention investigation, determines the specific stage (data synchronization and interface inquiry) of the problem occurrence, and then repairs.
Fig. 7 is a block diagram of a test data positioning device according to an embodiment of the present application, where a test data positioning device 700 according to an embodiment of the present application includes a sending module 710 and a receiving module 720.
A sending module 710, configured to send a query command to a service database, where the query command includes a command written in a structured query language, and the service database is configured to store service data.
A receiving module 720, configured to receive a query result returned by the service database and corresponding to the query command;
Wherein the conditions of the structured query language and the query results together serve as test data.
In the positioning device for the test data, which is provided by the embodiment of the application, the query command is directly sent to the service database, the query result can be directly obtained from the service database, the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Optionally, in an embodiment of the present application, the test data positioning device provided in the embodiment of the present application further includes: the test module is used for testing the target interface by utilizing the test data to obtain a test result; wherein the target interface comprises an interface to a target database comprising a database for providing a query service.
Optionally, in an embodiment of the present application, in a process of testing the target interface with the test data to obtain a test result, the test module is specifically configured to:
Obtaining an interface return result, wherein the interface return result is obtained by inquiring through the target interface by utilizing the condition of the structured inquiry language;
under the condition that the query result is consistent with the interface return result, the test result is that the target interface passes the test;
and under the condition that the query result is inconsistent with the interface return result, the test result is that the target interface fails the test.
Optionally, in an embodiment of the present application, in a process of obtaining a result returned by the interface, the test module is specifically configured to: sending a test command to a query service node through the target interface, wherein the test command comprises the condition of the structured query language; and receiving an interface return result sent by the query service node.
Fig. 8 is a block diagram of a positioning device for test data according to an embodiment of the present application. The positioning device 800 for test data provided in the embodiment of the present application includes a receiving module 810 and a sending module 820.
A receiving module 810, configured to receive a query command of a target device, where the query command includes a command written in a structured query language, and the target server is provided with a service database, where the service database is used to store service data;
A sending module 820, configured to return a query result corresponding to the query command to the target device;
wherein the conditions of the structured query language and the query results together serve as test data.
According to the positioning device for the test data, after the query command is received, the query result can be directly obtained from the service database, so that the work of searching the positioning test data in a correlated manner among a plurality of large data components is omitted, and the positioning efficiency of the test data can be greatly improved. Meanwhile, the business database is a database aiming at transaction business, and the data in the business database is accurate and comprehensive, so that the accuracy of the test data obtained in the mode is higher than that of the test data obtained in the mode of a big data component.
Fig. 9 is a schematic diagram of a target device according to an embodiment of the present application. As shown in fig. 9, a target device 900 provided by an embodiment of the present application may include a processor 910 and a memory 920. The memory stores a computer program that when executed implements steps in any of the test data positioning methods provided in the embodiments of the present application (e.g., the test data positioning method shown in any of fig. 2 to 5).
Fig. 10 is a schematic diagram of a target device according to an embodiment of the present application. As shown in fig. 10, a target device 1000 provided by an embodiment of the present application may include a processor 1010 and a memory 1020. The memory stores a computer program that when executed implements the steps of any of the test data positioning methods provided in the embodiments of the present application (e.g., the test data positioning method shown in fig. 6).
In fig. 9 and 10, the processor and the memory are electrically connected directly or indirectly to enable transmission or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The processor is used for reading/writing data or programs stored in the memory and executing corresponding functions.
The Memory is used to store programs or data, and may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), and the like.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored, and when the program or the instruction is executed by a processor, the program or the instruction implement each process of the embodiment of the method, and the same technical effects can be achieved, so that repetition is avoided, and no further description is given here.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes computer readable storage medium such as computer readable memory ROM, random access memory RAM, magnetic or optical disk, etc.
The embodiment of the application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used for running a program or an instruction, implementing each process of the above method embodiment, and achieving the same technical effect, so as to avoid repetition, and not repeated here.
The embodiments of the present application provide a computer program product, which is stored in a storage medium, and the program product is executed by at least one processor to implement the respective processes of the above method embodiments, and achieve the same technical effects, and are not repeated herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.

Claims (10)

1. A method for locating test data, comprising:
the target device sends a query command to a service database, wherein the query command comprises a command written by using a structured query language, and the service database is used for storing service data;
the target equipment receives a query result which is returned by the service database and corresponds to the query command;
wherein the conditions of the structured query language and the query results together serve as test data.
2. The method for locating test data according to claim 1, further comprising:
the target device tests the target interface by using the test data to obtain a test result;
wherein the target interface comprises an interface to a target database comprising a database for providing a query service.
3. The method for positioning test data according to claim 2, wherein the target device tests the target interface by using the test data to obtain a test result, comprising:
the target equipment acquires an interface return result, wherein the interface return result is obtained by inquiring through the target interface by utilizing the condition of the structured inquiry language;
under the condition that the query result is consistent with the interface return result, the test result is that the target interface passes the test;
and under the condition that the query result is inconsistent with the interface return result, the test result is that the target interface fails the test.
4. A method for locating test data according to claim 3, wherein the target device obtaining interface return results comprises:
the target device sends a test command to a query service node through the target interface, wherein the test command comprises the condition of the structured query language;
and the target equipment receives an interface return result sent by the query service node.
5. A method for locating test data, comprising:
The method comprises the steps that a target server receives a query command of target equipment, wherein the query command comprises a command written by using a structured query language, and a service database is arranged on the target server and is used for storing service data;
the target server returns a query result corresponding to the query command to the target device;
wherein the conditions of the structured query language and the query results together serve as test data.
6. A test data positioning device, comprising:
the system comprises a sending module, a service database and a processing module, wherein the sending module is used for sending query commands to the service database, the query commands comprise commands written by using a structured query language, and the service database is used for storing service data;
the receiving module is used for receiving a query result which is returned by the service database and corresponds to the query command;
wherein the conditions of the structured query language and the query results together serve as test data.
7. A test data positioning device, comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a query command of target equipment, the query command comprises a command written by using a structured query language, and a service database is arranged on a target server and is used for storing service data;
The sending module is used for returning a query result corresponding to the query command to the target equipment;
wherein the conditions of the structured query language and the query results together serve as test data.
8. A target device, comprising: a memory and a processor, the memory storing a computer program which, when executed, implements the steps in the method according to any one of claims 1-4.
9. A target server, comprising: a memory and a processor, the memory storing a computer program which, when executed, implements the steps in the method according to claim 5.
10. A readable storage medium, characterized in that it stores thereon a program or instructions, which when executed by a processor, realizes the steps in the method according to any of claims 1-5.
CN202310363208.9A 2023-04-06 2023-04-06 Positioning method and positioning device for test data, target equipment and target server Pending CN116431494A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310363208.9A CN116431494A (en) 2023-04-06 2023-04-06 Positioning method and positioning device for test data, target equipment and target server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310363208.9A CN116431494A (en) 2023-04-06 2023-04-06 Positioning method and positioning device for test data, target equipment and target server

Publications (1)

Publication Number Publication Date
CN116431494A true CN116431494A (en) 2023-07-14

Family

ID=87080897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310363208.9A Pending CN116431494A (en) 2023-04-06 2023-04-06 Positioning method and positioning device for test data, target equipment and target server

Country Status (1)

Country Link
CN (1) CN116431494A (en)

Similar Documents

Publication Publication Date Title
CN110309071B (en) Test code generation method and module, and test method and system
CN103514223A (en) Data synchronism method and system of database
CN110704475A (en) Method and system for comparing ETL loading table structures
US7908243B2 (en) Considering transient data also in reports generated based on data eventually stored in a data-warehouse
CN114416868B (en) Data synchronization method, device, equipment and storage medium
CN111522881B (en) Service data processing method, device, server and storage medium
CN109947797B (en) Data inspection device and method
US9009098B1 (en) Methods and apparatus for creating a centralized data store
JP2021140430A (en) Database migration method, database migration system, and database migration program
CA3191210A1 (en) Data syncronization method and device, computer equipment and storage medium
CN116431494A (en) Positioning method and positioning device for test data, target equipment and target server
Klein et al. Application-Specific Evaluation of No SQL Databases
US11438232B2 (en) Configuration item determination based on information technology discovery data items from multiple sources
CN112395292A (en) Data feature extraction and matching method and device
CN113010208A (en) Version information generation method, version information generation device, version information generation equipment and storage medium
CN112612773A (en) Database synchronization test method and device, computer equipment and storage medium
CN111737148A (en) Automatic regression testing method and device, computer equipment and storage medium
CN112527813A (en) Data processing method and device of business system, electronic equipment and storage medium
US9158818B2 (en) Facilitating identification of star schemas in database environments
CN117032635A (en) Method and device for managing influence of demand change and computer readable storage medium
RU152893U1 (en) DEVICE FORMING DATABASES ON THE HISTORY OF MEDICINE
CN113486022A (en) Data consistency verification method and related device
CN114066170A (en) Government data open sharing-oriented problem feedback processing system and method
CN114282260A (en) Method and device for auditing and executing Clickhouse DDLSQL semantic grammar
CN117593092A (en) On-line management method, system, equipment and storage medium for commodity sale

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