CN110716919A - Mock testing method, Mock testing device and storage medium - Google Patents

Mock testing method, Mock testing device and storage medium Download PDF

Info

Publication number
CN110716919A
CN110716919A CN201910899097.7A CN201910899097A CN110716919A CN 110716919 A CN110716919 A CN 110716919A CN 201910899097 A CN201910899097 A CN 201910899097A CN 110716919 A CN110716919 A CN 110716919A
Authority
CN
China
Prior art keywords
mock
test
data
task
server
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
CN201910899097.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.)
Beike Technology Co Ltd
Original Assignee
Beike 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 Beike Technology Co Ltd filed Critical Beike Technology Co Ltd
Priority to CN201910899097.7A priority Critical patent/CN110716919A/en
Publication of CN110716919A publication Critical patent/CN110716919A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/23Updating
    • 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
    • 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/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • 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/23Updating
    • G06F16/2358Change logging, detection, and notification
    • 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/23Updating
    • G06F16/2365Ensuring data consistency and integrity

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a Mock testing method, a Mock testing device and a storage medium, and the Mock testing method, the Mock testing device and the storage medium specifically comprise the following steps: the method comprises the steps that a test server receives a test task of a Mock test, and according to the type of the test task, request information for obtaining Mock data is sent to a Mock database, the Mock data is used for the Mock test, the request information comprises query conditions of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test; the Mock database receives the request information, searches for Mock data corresponding to the obtained test task according to the query condition, and returns the obtained Mock data to the test server; after receiving the Mock data, the testing server executes the testing task, so that maintenance of the Mock data in the Mock test can be facilitated based on the scheme, and the workload of technical personnel is reduced.

Description

Mock testing method, Mock testing device and storage medium
Technical Field
The application relates to the technical field of automatic testing, in particular to a Mock testing method, a Mock testing device and a storage medium.
Background
The Mock test refers to a test method which is created by using a virtual object for some objects which are not easy to construct or obtain in the test process so as to facilitate the test. In the prior art, the Mock data is usually configured in the code in advance, and is stored in the memory of the test server when the code is compiled, and the Mock data in the memory is read when the automatic test is executed. In addition, the Mock data can also be written in a configuration file, before the automatic test is executed, the configuration file is loaded by the test server, the Mock data in the configuration file is analyzed and stored in the memory of the test server, and the Mock data in the memory is read when the automatic test is executed.
However, in the conventional Mock data configuration mode, since all Mock data are written in a code file or a configuration file, when the data volume is large, the code volume is too large, the compiling time is increased, after a test is started, all Mock data are loaded and stored in a memory of a test server, the memory of the test server is wasted to a certain extent, and when the Mock data change, the code and redeployment service need to be changed, so that the maintenance is not convenient, and the workload of technical personnel is increased.
Disclosure of Invention
In view of the prior art, the embodiment of the invention discloses a Mock testing method, which can modify and update Mock data without modifying codes and redeploying services by setting a database for managing the Mock data, and is convenient for data maintenance, and the method comprises the following steps:
the testing service end receives a testing task of a Mock test, wherein the Mock test is a test for simulating a real test in the testing service end;
according to the type of the test task, sending request information for acquiring Mock data to a Mock database, wherein the Mock data is used for the Mock test, the request information comprises query conditions of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test;
the Mock database receives the request information, searches for Mock data corresponding to the obtained test task according to the query condition, and returns the obtained Mock data to the test server;
and the test server executes the test task after receiving the Mock data.
Optionally, after receiving the Mock data, the testing server executes the testing task, including:
the test server receives and stores the Mock data;
the test server calls an interface of an application program server and sends the stored Mock data to the application program server;
and the application program server side executes the test task by using the received Mock data.
Optionally, the step of executing the test task by the application server using the received Mock data includes:
the application program server receives the Mock data;
the application program server side stores the Mock data to a data table of an application service database according to the received identification information carried by the Mock data, wherein the data table of the application service database comprises a field corresponding to the identification information, so that the Mock data is stored to a position corresponding to the data table;
and the application program server executes the test task.
Optionally, the step of receiving, by the test server, the test task of the Mock test includes:
the test server receives a test task;
the test server judges whether the test task needs to carry out Mock test or not according to the task identification information of the test task;
and if the test task needs to carry out the Mock test, determining that the received test task is the test task of the Mock test.
Optionally, the step of receiving the request information by the Mock database, and searching for the Mock data corresponding to the test task according to the query condition further includes: and when the Mock data corresponding to the test task is not found, the test task is not executed.
Another embodiment of the present invention provides a Mock testing device, comprising:
the receiving module is used for receiving a test task of a Mock test by the test service end, wherein the Mock test is a test for simulating a real test in the test service end;
the sending module is used for sending request information for acquiring Mock data to a Mock database according to the type of the test task, wherein the Mock data is used for the Mock test, the request information comprises the query condition of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test;
the return module is used for searching and acquiring the Mock data corresponding to the test task according to the query condition after the Mock database receives the request information, and returning the acquired Mock data to the test server;
and the execution module is used for executing the test task after the test server receives the Mock data.
Optionally, the execution module includes: the receiving unit is used for receiving and storing the Mock data by the test server;
the sending unit is used for testing an interface of the application program server called by the server and sending the stored Mock data to the application program server;
and the execution unit is used for executing the test task by the application program server side by using the received Mock data.
Optionally, the receiving module includes: the judging unit is used for receiving a test task by the test server; the test server judges whether the test task needs to carry out Mock test or not according to the task identification information of the test task; and if the test task needs to carry out the Mock test, determining that the received test task is the test task of the Mock test.
In another embodiment of the present invention, a computer readable storage medium is provided, which has stored thereon computer instructions, which when executed by a processor, can implement the steps of the Mock testing method described above.
In another embodiment of the present invention, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the Mock testing method is implemented.
In summary, according to the technical scheme provided by the embodiment of the invention, the Mock database is arranged, the Mock data is managed through the Mock database, the test server can obtain the Mock data for Mock test from the Mock database, the Mock data can be modified and updated through the Mock database without modifying codes and redeploying services, the data maintenance is convenient, and according to the type of the preset test task and the Mock data query condition, the test server can obtain the required Mock data according to the type of the specific test task, so that a large amount of Mock data irrelevant to the test task can be avoided being obtained at the same time, and the memory of the test server is saved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 illustrates a flow diagram of a Mock testing method 100 of some embodiments of the present application;
FIG. 2 illustrates a flow diagram of a method 200 of some embodiments of the present application;
FIG. 3 illustrates a flow chart of a method 300 of some embodiments of the present application;
FIG. 4 illustrates a flow chart of a method 400 of some embodiments of the present application;
FIG. 5 illustrates a schematic diagram of a Mock testing method application scenario 500 in some embodiments of the present application;
FIGS. 6 a-6 d are schematic diagrams illustrating different types of Mock data tables, respectively, in some embodiments of the present application;
FIG. 7 illustrates a schematic block diagram of a Mock testing device 700 according to some embodiments of the present application;
fig. 8 shows a schematic structural diagram of an electronic device 800 in some embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail with specific examples. Several of the following embodiments may be combined with each other and some details of the same or similar concepts or processes may not be repeated in some embodiments.
The Mock testing technology is a technology for testing an object which is not easy to construct or obtain by creating a virtual object in the testing process, and the virtual object is the Mock object. The Mock object is a substitute for the real object during debugging. The functions of the application program operated by the front-end equipment and the like can be tested by the conventional Mock testing technology. In the prior art, Mock data is usually manually pre-configured in a code, that is, the Mock data is pre-dead data and is stored in a test server, because all Mock data are written in a code file or a configuration file, when the data volume is large, the code volume is too large, the compiling time is increased, after the test is started, all Mock data are loaded and stored in a memory of the test server, the memory of the test server is wasted to a certain extent, and when the Mock data change, the code and the redeployment service are required to be changed, so that the maintenance is not convenient, and the workload of technicians is increased.
Based on the defects existing in the prior art, the technical scheme provided by the embodiment of the application can modify and update the Mock data by setting the database for managing the Mock data without modifying codes and redeploying services, so that the data maintenance is facilitated.
Referring to fig. 1, fig. 1 is a flow chart of a Mock testing method 100 according to some embodiments of the present application. In an embodiment of the present application, a Mock testing method 100 is provided, where the method 100 includes:
step S101: and the test service end receives the test task of the Mock test.
Here, the Mock test is a test for simulating a real test in the test server, the test task may be one or more test cases, and the test server executes step S102 after receiving the test task that needs to be performed with the Mock test, so as to obtain Mock data required by executing the test task of the Mock test.
Step S102: and sending request information for acquiring the Mock data to a Mock database according to the type of the test task, wherein the request information comprises the query condition of the Mock data.
Here, the Mock data is data used for the Mock test, and the Mock database is used for managing the Mock data required in the Mock test. The types of the test tasks are set in a pre-divided mode, and the Mock database comprises Mock data tables of different types of test tasks, and the Mock data tables are configured in advance.
Specifically, the test server side can send request information for acquiring Mock data to the Mock database through a pre-compiled test code file, wherein the test code file does not include the Mock data and includes the request information for acquiring the Mock data, so that the test server side can acquire the Mock data required by the test from the Mock database.
Step S103: and the Mock database receives the request information, searches and acquires Mock data corresponding to the test task according to the query condition, and returns the acquired Mock data to the test server.
Here, the received request information includes a query condition for searching for the Mock data corresponding to the test task, and according to the query condition, the Mock data table corresponding to the test task and the Mock data stored in the Mock data table can be searched.
Step S104: and the test server executes the test task after receiving the Mock data.
To sum up, the Mock test method provided by the embodiment of the invention is provided with the Mock database, the Mock data is managed through the Mock database, the test server can obtain the Mock data for the Mock test from the Mock database, and the Mock data can be modified and updated through the Mock database without modifying codes and redeploying services, so that the data maintenance is facilitated, the workload of technicians is reduced, and the test working efficiency is improved. And according to the type of the preset test task and the Mock data query condition, the test server can acquire the required Mock data according to the specific type of the test task, so that the situation that all Mock data are acquired at the same time can be avoided, wherein a large amount of Mock data irrelevant to the current test task are included, and the memory of the test server is saved.
In an embodiment of the present application, as shown in fig. 2, fig. 2 shows a flowchart of a Mock testing method 200 according to some embodiments of the present application. The Mock testing method 200 comprises:
step S201: and the test service end receives the test task of the Mock test.
Step S202: and sending request information for acquiring the Mock data to a Mock database according to the type of the test task, wherein the request information comprises the query condition of the Mock data.
Here, the Mock data is data used for the Mock test, and the Mock database is used for managing the Mock data required in the Mock test. The types of the test tasks are set in a pre-divided mode, and the Mock database comprises Mock data tables of different types of test tasks, and the Mock data tables are configured in advance. Specifically, the test tasks may include a first type task, a second type task, a third type task, and a fourth type task, and the Mock database may include a first type task Mock data table, a second type task Mock data table, a third type task Mock data table, and a fourth type task Mock data table.
Here, the test server may send request information for acquiring Mock data to the Mock database through a pre-compiled test code file, where the test code file does not include Mock data and includes the request information for acquiring Mock data, so that the test server may acquire Mock data required for testing from the Mock database.
Therefore, when compiling is carried out, the test code file for performing the Mock test in the test server side can not be written with Mock data any more, and the problems that the test code file is too large and the compiling time is too long due to large data volume can be avoided.
Step S203: and the Mock database receives the request information, searches and acquires Mock data corresponding to the test task according to the query condition, and returns the acquired Mock data to the test server.
Here, the received request information includes query conditions for searching for Mock data corresponding to the test task, the query conditions include test task type information and other query parameter information, and the Mock data table corresponding to the test task and the Mock data stored in the Mock data table can be searched according to the query conditions. Specifically, the test task is determined to be a first-class task according to the query condition in the request information, a first-class task Mock data table in the Mock database is searched, and the Mock data is taken out from the first-class task Mock data table according to other query parameter information, such as numbers, data types and the like. And finally, returning the acquired Mock data to the test server.
Step S204: and the test server receives and stores the Mock data.
Here, the test server receives the Mock data and stores the Mock data in the memory of the test server. The test server can only store the Mock data of the test task, so that the fact that the Mock data written in all code files need to be loaded and stored in the prior art can be avoided, and the storage space of the test server is saved to a certain extent.
Step S205: and the test server calls an interface of the application program server and sends the stored Mock data to the application program server.
Here, the application server may be a device on which the application runs, the test server sends the Mock data to the application server, and the application server may run the test task by using the Mock data.
Step S206: and the application program server side executes the test task by using the received Mock data.
Here, the application server performs a Mock test using Mock data, such as initiating an Http request, simulating sending a data packet, or simulating receiving a data packet, according to a specific test task. Different test tasks have different execution steps, which can be realized by the prior art, and are not described herein again.
In an embodiment of the present application, as shown in fig. 3, fig. 3 shows a flow chart of a method 300 of some embodiments of the present application. The method 300 may be embodied as step S206 of the method 200:
step S301: and the application program server receives the Mock data.
Step S302: and the application program server side stores the Mock data to a data table of an application service database according to the received identification information carried by the Mock data.
Here, the data table of the application service database includes a field corresponding to the identification information, so that the Mock data is stored in a corresponding position of the data table.
Step S303: and the application program server executes the test task.
The application service database comprises a data table for storing Mock data, the application program server stores the Mock data to the Mock data table of the application service database according to the received field information carried by the Mock data, and the identification information carried by the Mock data can comprise: transaction order number, request code, etc. According to the field information, the corresponding recording position in the Mock data table of the application service database can be searched, and the Mock data is written into the Mock data table after being searched, namely the Mock data is stored in the application service database so as to be conveniently used when the application service terminal executes the test task.
In an embodiment of the present application, as shown in fig. 4, fig. 4 shows a flowchart of a Mock testing method 400 according to some embodiments of the present application. The Mock testing method 400 includes:
step S401: the test server receives a test task;
step S402: and the test server judges whether the test task needs to carry out Mock test or not according to the task identification information of the test task.
Here, the test task includes task identification information for identifying whether the test task needs to perform a Mock test.
Step S403: if yes, the test task is determined to be a test task of the Mock test, and the step S404 is executed continuously.
Here, if the test server determines that the received test task needs to perform the Mock test, the test server continues to execute step S404 to obtain Mock data required by the test task.
Furthermore, if the test task does not require Mock testing, no processing is done.
Step S404: and the test server sends request information for acquiring the Mock data to a Mock database according to the type of the test task, wherein the request information comprises the query condition of the Mock data.
Here, the Mock data is data used for the Mock test, and the Mock database is used for managing the Mock data required in the Mock test. The types of the test tasks are set in a pre-divided mode, and the Mock database comprises Mock data tables of different types of test tasks, and the Mock data tables are configured in advance. Specifically, the test tasks may include a first type task, a second type task, a third type task, and a fourth type task, and the Mock database may include a first type task Mock data table, a second type task Mock data table, a third type task Mock data table, and a fourth type task Mock data table.
Here, the test server may send request information for acquiring Mock data to the Mock database through a pre-compiled test code file, where the test code file does not include Mock data and includes the request information for acquiring Mock data, so that the test server may acquire Mock data required for testing from the Mock database. Therefore, when compiling is carried out, the test code file for performing the Mock test in the test server side can not be written with Mock data any more, and the problems that the test code file is too large and the compiling time is too long due to large data volume can be avoided.
Step S405: and the Mock database receives the request information, searches and acquires Mock data corresponding to the test task according to the query condition, and returns the acquired Mock data to the test server.
Here, the received request information includes query conditions for searching for Mock data corresponding to the test task, the query conditions include test task type information and other query parameter information, and the Mock data table corresponding to the test task and the Mock data stored in the Mock data table can be searched according to the query conditions. Specifically, according to the query condition in the request information, the test task is determined to be a first-class task, a first-class task Mock data table in the Mock database is found, and the Mock data is taken out from the first-class task Mock data table according to other query parameter information, such as numbers, data types and the like. And finally, returning the acquired Mock data to the test server.
In addition, according to the query condition, searching for the Mock data corresponding to the test task, and when the Mock data corresponding to the test task is not found, not executing the test task. After the execution of the test task is stopped, the test server may continue to execute the next received test task.
Step S406: and the test server receives and stores the Mock data.
Here, the test server receives the Mock data and stores the Mock data in the memory of the test server. The test server can only store the Mock data of the test task, so that the fact that the Mock data written in all code files need to be loaded and stored in the prior art can be avoided, and the storage space of the test server is saved to a certain extent.
Step S407: and the test server calls an interface of the application program server and sends the stored Mock data to the application program server.
Here, the application server may be a device on which the application runs, the test server sends the Mock data to the application server, and the application server may run the test task by using the Mock data.
Step S408: and the application program server receives the Mock data.
Step S409:
and the application program server side stores the Mock data to a data table of an application service database according to the received identification information carried by the Mock data.
Here, the data table of the application service database includes a field corresponding to the identification information, so that the Mock data is stored in a corresponding position of the data table.
Step S410: and the application program server executes the test task.
In summary, in the embodiment of the application, the Mock database is arranged, the Mock data is managed through the Mock database, the test server can obtain the Mock data for Mock test from the Mock database, the Mock data can be modified and updated through the Mock database, code modification and redeployment are not needed, data maintenance is facilitated, workload of technicians is reduced, and test work efficiency is improved. And according to the type of the preset test task and the Mock data query condition, the test server can acquire the required Mock data according to the specific type of the test task, so that the acquisition of a large amount of Mock data irrelevant to the test task can be avoided, and the memory of the test server is saved.
In the embodiment of the present application, the Mock test method is described in detail with reference to fig. 5. Fig. 5 is a schematic diagram of an application scenario 500 of the Mock testing method in some embodiments of the present application.
In the embodiment of the present application, the application scenario 500 includes a testing server 501, a Mock database, and an application server 503. The test service 501 runs a test service, where the test service may be a service process that implements a test task, and the test task may specifically be a test case.
The test server 501 receives a pre-configured test task, firstly, judges whether the test task needs to perform a Mock test according to task identification information of the test task, determines the test task as the test task of the Mock test if the task identification information of the test task includes information identifying that the Mock test needs to be performed, and starts to execute subsequent steps.
According to the type of the test task, the test server 501 sends request information for acquiring Mock data to the Mock database 502, wherein the query conditions of the request information Mock data comprise test task type information and other query parameter information. The types of the test tasks are set in a pre-divided mode, and the Mock database comprises Mock data tables of different types of test tasks, and the Mock data tables are configured in advance. Specifically, the test tasks may include a first type task, a second type task, a third type task, and a fourth type task, and the Mock database may include a first type task Mock data table, a second type task Mock data table, a third type task Mock data table, and a fourth type task Mock data table.
Specifically, taking the Mock test of the loan service as an example, the test task of the loan service can be divided into qualification prequalification and loan application information which trigger a storage request; triggering qualification pre-review and loan application information of the submission request; the system comprises approval result information triggering the manager approval request and bank state information triggering the pushing state request. A Mock data table corresponding to the test service type is preset in the Mock database, as shown in fig. 6a to 6d, fig. 6a is the Mock data table for triggering the qualification prereview of the storage request and the loan application information test task; FIG. 6b is a Mock data sheet triggering the qualification prereview of the submission request, the loan application information testing task; FIG. 6c is a Mock data table of an approval result information test task triggering a manager approval request; FIG. 6d is a Mock data table of a bank status information testing task triggering a push status request. The Mock database receives the request information, can determine a Mock data table to which Mock data required by the test task belong according to the type information of the test task, searches and acquires the Mock data corresponding to the test task according to other query parameter information, and returns the acquired Mock data to the test server.
According to the query conditions, the Mock data table corresponding to the test task can be searched, the Mock data stored in the Mock data table is taken out, and then the obtained Mock data is returned to the test server. In the loan service, conditions such as a bank total line number, a bank branch number, a bank status code, and a data use method are inquired.
Referring to fig. 6a, taking the testing task type of the qualification prereview and loan application information triggering the storage request as an example, in the Mock data table of the testing task type, the query parameter information is: the bank line number is CITIC, the bank branch number is 737200, the bank branch number is 101101370101001, the data use mode is qualification pre-review, the Mock data stored in params is qualification pre-review information, the Mock data of the test task can be taken out according to the query parameter information, and the Mock database 502 returns the obtained Mock data to the test server 501.
In addition, according to the query condition, searching for the Mock data corresponding to the test task, and when the Mock data corresponding to the test task is not found, not executing the test task. After stopping executing the test task, the test server 501 may continue to execute the next received test task.
Further, the test server 501 receives the Mock data and stores the Mock data in the memory of the test server. The test server can only store the Mock data of the test task, so that the fact that the Mock data written in all code files need to be loaded and stored in the prior art can be avoided, and the storage space of the test server is saved to a certain extent.
Further, the test server 501 calls an interface of the application server 502, and sends the saved Mock data to the application server 502. The application server 502 may be a device for running the application, and the test server 501 sends the Mock data to the application server, and the application server may perform the test task by using the Mock data. The application server 502 receives the Mock data, and according to the identification information carried by the Mock data, the identification information carried by the Mock data may include: transaction order number, request code, etc. According to the identification information, the corresponding recording position in the Mock data table of the application service database can be searched, the Mock data is written into the Mock data table after the search, namely, the Mock data is stored in the application service database, and after the application service terminal 502 finishes the step of storing the Mock data, the application service terminal can start to execute the test task.
Therefore, in the embodiment of the application, the Mock data used by the Mock test are pre-configured in the independent Mock database, the corresponding Mock data tables are set according to different types of test tasks, the test server can obtain the Mock data used for the Mock test from the Mock database, the Mock data can be modified and updated through the Mock database, the code does not need to be modified, the service does not need to be redeployed, and the data maintenance is convenient. Meanwhile, according to the type of the preset test task and the Mock data query condition, the test server can obtain the required Mock data according to the specific type of the test task, so that the phenomenon that a large amount of Mock data irrelevant to the test task are obtained at the same time can be avoided, and the memory of the test server is saved.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a Mock testing device 700 according to some embodiments of the present application, in which a Mock testing device 700 is provided, the Mock testing device 700 includes:
a receiving module 701, configured to receive, by a test server, a test task of a Mock test, where the Mock test is a test for simulating a real test in the test server;
a sending module 702, configured to send request information for obtaining Mock data to a Mock database according to the type of the test task, where the Mock data is used for the Mock test, the request information includes a query condition of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test;
a returning module 703, configured to search for and acquire Mock data corresponding to the test task according to the query condition after the Mock database receives the request information, and return the acquired Mock data to the test server;
and the execution module 704 is configured to execute the test task after the test server receives the Mock data.
Further, the executing module 704 of the apparatus 700 includes:
a receiving unit 7041, configured to receive and store the Mock data by the test server;
a sending unit 7042, configured to test an interface of an application server called by the server, and send the saved Mock data to the application server;
an executing unit 7043, configured to execute the test task by using the received Mock data by the application server.
Further, the receiving module 701 of the apparatus 700 is further configured to receive a test task by the test server; the test server judges whether the test task needs to carry out Mock test according to the task identification information of the test task; and if the test task needs to carry out the Mock test, determining that the received test task is the test task of the Mock test.
In summary, the Mock testing device can execute the Mock testing method in the above embodiment, wherein Mock data is pre-configured in an independent Mock database, a corresponding Mock data table is set according to different types of testing tasks, a testing server can obtain Mock data for Mock testing from the Mock database, the Mock data can be modified and updated through the Mock database, code modification and service redeployment are not needed, and data maintenance is facilitated. Meanwhile, according to the type of the preset test task and the Mock data query condition, the test server can obtain the required Mock data according to the specific type of the test task, so that the phenomenon that a large amount of Mock data irrelevant to the test task are obtained at the same time can be avoided, and the memory of the test server is saved.
Embodiments of the present application further provide a computer-readable storage medium, which stores instructions that, when executed by a processor, cause the processor to perform the steps in the method for Mock testing according to the above embodiments. In practical applications, the computer readable medium may be included in the apparatus/device/system described in the above embodiments, or may exist alone without being assembled into the apparatus/device/system. The computer readable storage medium carries one or more programs which, when executed, implement a method of performing a Mock test according to the Mock test device described with reference to fig. 7.
According to embodiments disclosed herein, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example and without limitation: 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), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing, without limiting the scope of the present disclosure. In the embodiments disclosed herein, 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.
Fig. 8 is a schematic structural diagram of an electronic device 800 according to some embodiments of the invention, as shown in fig. 8. An electronic device is further provided in an embodiment of the present application, and the electronic device includes the above computer-readable medium 801 and further includes a processor 802 that can execute the computer-readable storage medium. In practice, the electronic device may be one or more computers, so long as the computer-readable medium and the processor are included.
In addition, the method steps described in this application may be implemented by hardware, for example, logic gates, switches, Application Specific Integrated Circuits (ASICs), programmable logic controllers, embedded microcontrollers, and the like, in addition to data processing programs. Such hardware capable of implementing the methods described herein may also constitute the present application.
The flowchart and block diagrams in the figures of the present application illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments disclosed herein. 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.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not explicitly recited in the present application. In particular, the features recited in the various embodiments and/or claims of the present application may be combined and/or coupled in various ways, all of which fall within the scope of the present disclosure, without departing from the spirit and teachings of the present application.
The principles and embodiments of the present invention are explained herein using specific examples, which are provided only to help understanding the method and the core idea of the present invention, and are not intended to limit the present application. It will be appreciated by those skilled in the art that changes may be made in this embodiment and its broader aspects and without departing from the principles, spirit and scope of the invention, and that all such modifications, equivalents, improvements and equivalents as may be included within the scope of the invention are intended to be protected by the claims.

Claims (10)

1. A Mock testing method, characterized in that the method comprises:
the testing service end receives a testing task of a Mock test, wherein the Mock test is a test for simulating a real test in the testing service end;
according to the type of the test task, sending request information for acquiring Mock data to a Mock database, wherein the Mock data is used for the Mock test, the request information comprises query conditions of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test;
the Mock database receives the request information, searches for Mock data corresponding to the obtained test task according to the query condition, and returns the obtained Mock data to the test server;
and the test server executes the test task after receiving the Mock data.
2. The method according to claim 1, wherein the step of executing the test task after the test server receives the Mock data comprises:
the test server receives and stores the Mock data;
the test server calls an interface of an application program server and sends the stored Mock data to the application program server;
and the application program server side executes the test task by using the received Mock data.
3. The method according to claim 2, wherein the step of executing the test task by the application server using the received Mock data comprises:
the application program server receives the Mock data;
the application program server side stores the Mock data to a data table of an application service database according to the received identification information carried by the Mock data, wherein the data table of the application service database comprises a field corresponding to the identification information, so that the Mock data is stored to a position corresponding to the data table;
and the application program server executes the test task.
4. The method of claim 1, wherein the step of receiving the test task of the Mock test by the test server comprises:
the test server receives a test task;
the test server judges whether the test task needs to carry out Mock test or not according to the task identification information of the test task;
and if the test task needs to carry out the Mock test, determining that the received test task is the test task of the Mock test.
5. The method according to claim 1, wherein the step of searching for the Mock data corresponding to the test task by the Mock database after receiving the request information according to the query condition further comprises:
and when the Mock data corresponding to the test task is not found, the test task is not executed.
6. A Mock testing device, the device comprising:
the receiving module is used for receiving a test task of a Mock test by the test service end, wherein the Mock test is a test for simulating a real test in the test service end;
the sending module is used for sending request information for acquiring Mock data to a Mock database according to the type of the test task, wherein the Mock data is used for the Mock test, the request information comprises the query condition of the Mock data, and the Mock database is used for managing the Mock data required in the Mock test;
the return module is used for searching and acquiring the Mock data corresponding to the test task according to the query condition after the Mock database receives the request information, and returning the acquired Mock data to the test server;
and the execution module is used for executing the test task after the test server receives the Mock data.
7. The apparatus of claim 6, wherein the means for performing comprises:
the receiving unit is used for receiving and storing the Mock data by the test server;
the sending unit is used for testing an interface of the application program server called by the server and sending the stored Mock data to the application program server;
and the execution unit is used for executing the test task by the application program server side by using the received Mock data.
8. The apparatus of claim 6, wherein the receiving module is configured to receive a test task by the test service; the test server judges whether the test task needs to carry out Mock test or not according to the task identification information of the test task; and if the test task needs to carry out the Mock test, determining that the received test task is the test task of the Mock test.
9. A computer readable storage medium having stored thereon computer instructions, wherein said instructions when executed by a processor implement the steps of the Mock test method according to any of claims 1 to 5.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the Mock test method according to any of claims 1 to 5 when executing the program.
CN201910899097.7A 2019-09-23 2019-09-23 Mock testing method, Mock testing device and storage medium Pending CN110716919A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910899097.7A CN110716919A (en) 2019-09-23 2019-09-23 Mock testing method, Mock testing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910899097.7A CN110716919A (en) 2019-09-23 2019-09-23 Mock testing method, Mock testing device and storage medium

Publications (1)

Publication Number Publication Date
CN110716919A true CN110716919A (en) 2020-01-21

Family

ID=69210741

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910899097.7A Pending CN110716919A (en) 2019-09-23 2019-09-23 Mock testing method, Mock testing device and storage medium

Country Status (1)

Country Link
CN (1) CN110716919A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831550A (en) * 2020-06-04 2020-10-27 贝壳技术有限公司 Joint debugging test method and device
CN111881035A (en) * 2020-07-23 2020-11-03 上海中通吉网络技术有限公司 Method, device and equipment for acquiring on-line analog data
CN112052172A (en) * 2020-09-04 2020-12-08 云账户技术(天津)有限公司 Rapid testing method and device for third-party channel and electronic equipment
CN112328470A (en) * 2020-10-22 2021-02-05 中国建设银行股份有限公司 Automatic operation and maintenance testing method, device, equipment and storage medium
CN112527637A (en) * 2020-12-02 2021-03-19 成都新希望金融信息有限公司 Data management method, device, server and storage medium
CN112711421A (en) * 2020-12-28 2021-04-27 广州品唯软件有限公司 Cross-service Mock data sharing and using method, system, equipment and storage medium
CN113176994A (en) * 2021-04-28 2021-07-27 中国工商银行股份有限公司 Mock data method and device based on function calculation
CN113238929A (en) * 2021-04-25 2021-08-10 平安普惠企业管理有限公司 Code testing method and device based on Mock data, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109614322A (en) * 2018-11-28 2019-04-12 北京京东金融科技控股有限公司 Unit test method, device, equipment and readable storage medium storing program for executing based on Mock
CN110083533A (en) * 2019-04-16 2019-08-02 贝壳技术有限公司 Data processing method and device based on Mock service

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109614322A (en) * 2018-11-28 2019-04-12 北京京东金融科技控股有限公司 Unit test method, device, equipment and readable storage medium storing program for executing based on Mock
CN110083533A (en) * 2019-04-16 2019-08-02 贝壳技术有限公司 Data processing method and device based on Mock service

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831550A (en) * 2020-06-04 2020-10-27 贝壳技术有限公司 Joint debugging test method and device
CN111881035A (en) * 2020-07-23 2020-11-03 上海中通吉网络技术有限公司 Method, device and equipment for acquiring on-line analog data
CN112052172A (en) * 2020-09-04 2020-12-08 云账户技术(天津)有限公司 Rapid testing method and device for third-party channel and electronic equipment
CN112052172B (en) * 2020-09-04 2024-01-30 云账户技术(天津)有限公司 Rapid test method and device for third-party channel and electronic equipment
CN112328470A (en) * 2020-10-22 2021-02-05 中国建设银行股份有限公司 Automatic operation and maintenance testing method, device, equipment and storage medium
CN112527637A (en) * 2020-12-02 2021-03-19 成都新希望金融信息有限公司 Data management method, device, server and storage medium
CN112711421A (en) * 2020-12-28 2021-04-27 广州品唯软件有限公司 Cross-service Mock data sharing and using method, system, equipment and storage medium
CN112711421B (en) * 2020-12-28 2024-04-19 广州品唯软件有限公司 Cross-service Mock data sharing use method, system, equipment and storage medium
CN113238929A (en) * 2021-04-25 2021-08-10 平安普惠企业管理有限公司 Code testing method and device based on Mock data, electronic equipment and storage medium
CN113176994A (en) * 2021-04-28 2021-07-27 中国工商银行股份有限公司 Mock data method and device based on function calculation

Similar Documents

Publication Publication Date Title
CN110716919A (en) Mock testing method, Mock testing device and storage medium
CN108399132B (en) Scheduling test method, device and storage medium
CN110347085B (en) Automated test system, method, vehicle, and computer-readable medium
CN109815141B (en) Test method and device
CN105553738A (en) Heat loading method and device of configuration information and distributed cluster system
CN113342685A (en) Precise test method and device, computer equipment and storage medium
CN103020058A (en) Multi-version data acquisition method and device
CN107621963B (en) Software deployment method, software deployment system and electronic equipment
CN110727585B (en) Memory leak detection method, device, electronic equipment and readable storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN104571916A (en) Method and device for executing terminal operating information
CN115391228A (en) Precise test method, device, equipment and medium
CN105550575A (en) Method and device for obtaining un-exported function address and data structure offset
CN112416648A (en) Data verification method and device
CN114610516B (en) Application program repairing method and device, computer equipment and storage medium
CN110337017B (en) Television and log processing method thereof, log processing device and readable storage medium
CN112350879B (en) Data communication equipment test management method, device, system and storage medium
CN113326046A (en) Method and device for acquiring compiling time length
CN110990052A (en) Configuration saving method and device
CN105511932A (en) Application unloading method and device
CN113885963B (en) Secondary development file execution method, device and storage medium
CN110059071B (en) Data comparison monitoring method, system, equipment and medium based on storage process
CN106096409B (en) protection detection method and device based on SE L inux and terminal equipment
CN108427624B (en) System stability risk identification method and device
CN117804473A (en) Map data acquisition method, apparatus, device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination