CN111797004A - Test method, device and equipment based on Mock and readable storage medium - Google Patents

Test method, device and equipment based on Mock and readable storage medium Download PDF

Info

Publication number
CN111797004A
CN111797004A CN202010464403.7A CN202010464403A CN111797004A CN 111797004 A CN111797004 A CN 111797004A CN 202010464403 A CN202010464403 A CN 202010464403A CN 111797004 A CN111797004 A CN 111797004A
Authority
CN
China
Prior art keywords
data
test
value
request
identifier
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
CN202010464403.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.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202010464403.7A priority Critical patent/CN111797004A/en
Publication of CN111797004A publication Critical patent/CN111797004A/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/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a test method, a device, equipment and a readable storage medium based on Mock, wherein the method comprises the following steps: acquiring test global data, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications; acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications; if the target data value of the data identifier in the data request is an undefined value, determining the target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data; sending the data request to a test server so that the test server generates test data according to the data request; and acquiring the test data sent by the test server. The method can process data with incomplete data so as to improve the testing efficiency.

Description

Test method, device and equipment based on Mock and readable storage medium
Technical Field
The present application relates to the field of testing technologies, and in particular, to a Mock-based testing method, apparatus, device, and readable storage medium.
Background
The Mock platform is a platform that can create virtual data. With the development of computer technology, more and more Mock platforms appear in front of people, and the Mock platforms gradually replace the traditional manual testing process while improving the working efficiency of testers. However, the existing Mock test tool can only process data requests with complete fields, cannot respond to data requests comprising undefined fields, and needs completely defined and complete data requests for testing, so that the current test efficiency is not high.
Therefore, how to process the incomplete data to improve the test efficiency becomes an urgent problem to be solved.
Disclosure of Invention
The application provides a test method, a test device, test equipment and a readable storage medium based on Mock, so that incomplete data can be processed, and the test efficiency is improved.
In a first aspect, the present application provides a Mock-based testing method, including:
acquiring test global data, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications;
acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications;
if the target data value of the data identifier in the data request is an undefined value, determining the target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data;
sending the data request to a test server so that the test server generates test data according to the data request;
and acquiring the test data sent by the test server.
In a second aspect, the present application further provides a Mock-based test device, the device comprising:
the data acquisition module is used for acquiring test global data, and the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications;
the request receiving module is used for acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications;
the data processing module is used for determining the target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier if the target data value of the data identifier in the data request is an undefined value;
the data testing module is used for sending the data request to a testing server so that the testing server generates testing data according to the data request;
and the result receiving module is used for acquiring the test data sent by the test server.
In a third aspect, the present application further provides a computer device, including: the memory is used for storing a computer program; the processor is used for executing the computer program and realizing the above-mentioned Mock-based test method when the computer program is executed.
In a fourth aspect, the present application also provides a computer-readable storage medium storing a computer program, which when executed by a processor causes the processor to implement the Mock-based testing method as described above.
The application discloses a test method, a device, equipment and a readable storage medium based on Mock, by obtaining test global data and a data obtaining request, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications, the data request comprises a plurality of data identifications and target data values of the data identifications, then judging whether the target data values of the data identifications are undefined values in the data request, if the target data values of the data identifications are undefined values in the data request, determining the target data values of the data identifications in the data request according to the data value samples corresponding to the data identifications in the test global data, then sending the data request to a test server so that the test server generates test data according to the data request, and finally, acquiring the test data sent by the test server. The method can process data with incomplete data so as to improve the testing efficiency.
Drawings
In order to more clearly illustrate the technical solutions of 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 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 creative efforts.
FIG. 1 is a schematic view of a usage scenario provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart of a Mock-based testing method provided in an embodiment of the present application;
FIG. 3 is a schematic flow chart of another Mock-based testing method provided in the embodiments of the present application;
FIG. 4 is a schematic block diagram of a testing apparatus provided in an embodiment of the present application;
FIG. 5 is a schematic block diagram of another testing apparatus provided in an embodiment of the present application;
fig. 6 is a schematic block diagram of a structure of a computer device according to an embodiment 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 some, but not all, embodiments of the present application. 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 flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides a test method, a test device, test equipment and a readable storage medium based on Mock. The test method based on Mock can be applied to a test terminal or a test server, the test terminal can comprise electronic terminals such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment, and the test server can be a single server or a server cluster consisting of a plurality of servers. For example, as shown in fig. 1, the Mock test method is applied to a test server, which establishes communication with a test terminal through a network protocol and/or other communication protocols to obtain a test request sent by the test terminal, generates test data according to the data request, and sends the generated test data to the test terminal. The following explanation takes the application of the Mock-based test method to a test terminal as an example.
The Mock test is a test method for constructing a virtual object for testing some objects which are not easy to construct or obtain in the test process, the virtual object is the Mock object, and the process of testing the Mock object is the Mock test.
The test terminal is a working terminal which needs to perform corresponding Mock test, a Mock management page can be arranged on the test terminal, and a corresponding Mock test request is generated by receiving an operation instruction of a user on the Mock management page. The test terminal can also generate a Mock test request by receiving operations of adding, deleting, modifying, checking and the like of Mock test information in a pre-packaged SDK (Software Development Kit) by a user. The test terminal can send a Mock test request to the test server through the received sending instruction
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 2, fig. 2 is a schematic flowchart of a Mock-based testing method according to an embodiment of the present application.
As shown in fig. 2, the Mock-based test method includes steps S101 to S105.
Step S101, obtaining test global data, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications.
The test tool may be deployed on a test server, for example, may be a computer program (stand-alone software or a plug-in) installed on the test server. When the test server runs the test tool, the test server can provide test service for the test terminal. For example, the test terminal sends a test request to the test server, and the test server feeds back test data to the test terminal.
In particular, a test tool deployed by a test server may invoke a test database. The test database may include a plurality of data entries, and at least some of the data entries include corresponding data identifications and data value samples corresponding to the data identifications.
Illustratively, the moco tool is an open source test tool that can acquire published test data. Of course, the user may also store new test data on the test server, or add, delete or modify test data.
For example, the test data includes data files such as photos, text, voice, video, and the like. Each data file, such as a photo, corresponds to description information of the data file, and the description information may include at least one data identifier and a data value sample corresponding to each data identifier. For example, the description information of a certain photograph includes "city name: shanghai, Account: 123456".
In particular, the data value sample is an index tag of the test data that the test tool may invoke, and the data identification is a category of the index tag. The test server can obtain a corresponding data file according to the data identification and the corresponding data value sample query.
For example, the test terminal may obtain test data that the test tool may call, and then extract description information of the data file from the test data to obtain data identifiers therein and data values corresponding to the data identifiers, where the data values may be used as data value samples of the test data to generate test global data of the test tool.
Alternatively, the test server may generate the test global data and send the test global data to the test terminal.
The data value sample is specifically a value which can be taken by a data identifier in test data which can be called by a test server; it is understood that the test global data may be stored in the form of key-value, where key may be used as the data identifier and value may be used as the data value sample.
For example, the data identifications may include city names, telephone numbers, account numbers, etc., and the data sample data value samples corresponding to each data identification may be one or more. For example, the sample of data sample data values corresponding to the data identifier of the city name may be shenzhen, shanghai, etc., the sample of data sample data values corresponding to the data identifier of the phone may be 139, 188, 170, etc., and the sample of data sample data values corresponding to the data identifier of the account number may be 123456, 654321, 415263, etc.
Step S102, a data request is obtained, wherein the data request comprises a plurality of data identifications and target data values of the data identifications.
For example, the test terminal may generate a corresponding data request, that is, a Mock test request, according to an operation instruction of a user on a Mock management page, and send the data request to the test server.
Specifically, the data request includes a plurality of data identifiers and target data values of the data identifiers, and the corresponding data identifiers and the corresponding target data values may be used to describe characteristics of the required data.
Illustratively, the data identification of the data request may include a city name, phone number, account number, and the like. For example, the city name of a data request has a target data value of shanghai, the phone has a target data value of 139, and the account has a target data value of 123456.
Step S103, if the target data value of the data identifier in the data request is an undefined value, determining the target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier in the test global data.
The server deployed test tool only supports data requests that determine the target data value. For example, only when the data identifier and the target data value are consistent with a certain data identifier and a target data value in the test global data, the test server may query the corresponding data file and send the data file to the test terminal.
In some embodiments, some tests focus only on partial data identifications, such as city names and telephones, and do not focus on the target data values of some other data identifications. For example, differences between different account numbers are not concerned, the test terminal may represent target data values of data identifiers that are not concerned with in a preset character string when generating the data request. For example, when the account is not concerned, the target data value identified by the account data in the data request may be expressed as "? Is there a Is there a "means. Illustratively, a city of a data request is named shanghai, a telephone is 139, and an account is? Is there a Is there a .
Existing test tools typically do not support processing data requests containing uncertain target data values. Only when each data identifier in the data request has a determined, identifiable and specific target data value, the corresponding test data can be generated according to the target data value of each data identifier.
In the scheme, the test terminal can process the data request containing the uncertain target data value to obtain a complete data request which meets the requirements of the test tool. Illustratively, the implementation of the function may be configured in the test terminal in the form of a plug-in, for example, installed in the Mock management software.
Specifically, whether the target data value of the data identifier is an undefined value in the data request is judged, and if the target data value of the data identifier is uncertain and has no undefined value with a specific meaning in the data request, the data request is subjected to completion processing to obtain a complete data request which meets the requirements of a test tool.
In some embodiments, if the target data value of the data identifier in the data request is a preset character string, the target data value of the data identifier is determined to be an undefined value. Specifically, some tests focus only on partial data identifiers, such as city names and telephones, and do not focus on the target data values of some other data identifiers, so that the target data values of the data identifiers that are not focused on are represented by preset character strings. And when the target data value of the data identifier in the data request is judged to be a preset character string, performing data completion by taking the target data value as an undefined value.
In some embodiments, if the target data value of the data identifier in the data request is an encrypted value, the target data value of the data identifier is determined to be an undefined value. For example, some tests do not need to be performed according to the target data value corresponding to the data identifier, and in order to ensure the data security during the test, a user may perform encryption processing on the target data value through the test terminal. And when the target data value of the data identifier in the data request is judged to be an encrypted value, performing data completion by taking the target data value as an undefined value.
In some embodiments, according to a data identifier in the test global data and a data value sample corresponding to the data identifier, determining whether a target data value of the data identifier in the data request is not in the data value sample of the data identifier; and if the target data value of the data identifier in the data request is not in the data value sample of the data identifier, determining that the target data value of the data identifier is an undefined value. Illustratively, if a data value sample corresponding to a certain data identifier includes 10 data values, and a target data value of the data identifier in a certain data request is different from all of the 10 sample data values, it is determined that the target data value of the data identifier in the data request is not in the data sample data value sample of the data identifier.
Specifically, if the data value sample corresponding to the data identifier in the test global data includes one data value, the data value is determined as the target data value of the data identifier in the data request.
If the data value sample corresponding to the data identifier in the test global data comprises a plurality of data values, selecting one data value from the plurality of data values according to a preset selection rule, and determining the selected data value as a target data value of the data identifier in the data request. For example, the target data value identified in the data request may be determined by determining a frequency of use corresponding to each data value in a data value sample corresponding to the data identifier in the test global data, and selecting one data value from the plurality of data values as the target data value identified in the data request according to the frequency of use, for example, selecting the data value with the highest frequency of use from the plurality of data values.
And step S104, sending the data request to a test server so that the test server generates test data according to the data request.
And sending the data request subjected to completion processing to a test server so that the test server generates test data according to the data request.
In some embodiments, after receiving the data request, the testing tool installed on the testing server may query a testing database of the testing server storing testing data according to the data request to obtain testing data corresponding to the data request, where the testing data may include, for example, a testing data entry or a data file.
Specifically, according to the data identifier and the corresponding target data value in the test request, test data, such as text data, picture data or video data, having the same data identifier and corresponding data value is queried in a test database of the test server.
And step S105, obtaining the test data sent by the test server.
For example, after receiving the test data sent by the test server, the test terminal may display, store, or analyze the test data.
In some embodiments, as shown in fig. 3, the Mock-based test method further includes a step S201 after the step S102.
Step S201, if all target data values of the data identifier in the data request are not undefined values, sending the data request to a test server, so that the test server generates test data according to the data request.
Specifically, if it is detected that a target data value of a data identifier in a data request sent by a test terminal is in test global data, that is, a data value defined in the test global data, the data request may be sent to a test server, so that the test server generates test data according to the data request. Illustratively, if a data identifier in a data request and a target data value of the data identifier are consistent with a data identifier in the test global data and a data value corresponding to the data identifier, the data request is sent to a test server, so that the test server generates test data according to the data request.
In some embodiments, after receiving the data request, the testing tool installed on the testing server may query a testing database of the testing server storing testing data according to the data request to obtain testing data corresponding to the data request, where the testing data may include, for example, a testing data entry or a data file.
Specifically, the test server queries test data, such as text data, picture data, or video data, having the same data identifier and corresponding data value, in a test database of the test server according to the data identifier and corresponding target data value in the test request.
In some embodiments, as shown in fig. 3, step S105 is performed after step S201 is performed: and acquiring the test data sent by the test server.
For example, after receiving the test data sent by the test server, the test terminal may display, store, or analyze the test data.
The Mock-based test method provided by the above embodiment, by obtaining the test global data and the data obtaining request, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications, the data request comprises a plurality of data identifications and target data values of the data identifications, secondly, judging whether the target data value of the data identifier in the data request is an undefined value, if the target data value of the data identifier in the data request is the undefined value, determining a target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data, and then sending the data request to a test server so that the test server generates test data according to the data request, and finally acquiring the test data sent by the test server. The method can process data with incomplete data so as to improve the testing efficiency.
Referring to fig. 4, fig. 4 is a schematic block diagram of a Mock-based testing device according to an embodiment of the present application, which is used for executing the foregoing Mock-based testing method. Wherein, the Mock-based test device can be configured in a server or a terminal.
The server may be an independent server or a server cluster. The terminal can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
As shown in fig. 4, the Mock-based test device 300 includes: a data acquisition module 301, a request receiving module 302, a data processing module 303, a data testing module 304 and a result receiving module 305.
The data obtaining module 301 is configured to obtain test global data, where the test global data includes a plurality of data identifiers and data value samples corresponding to the data identifiers.
A request receiving module 302, configured to obtain a data request, where the data request includes a plurality of data identifiers and target data values of the data identifiers.
A data processing module 303, configured to determine, according to a data value sample corresponding to the data identifier, a target data value of the data identifier in the data request if the target data value of the data identifier in the data request is an undefined value.
In some embodiments, as shown in fig. 5, the data processing module 303 includes a data determination sub-module 3031 and a data determination sub-module 3032.
A data determining submodule 3031, configured to determine that a target data value of the data identifier is an undefined value if the target data value of the data identifier in the data request is a preset character string; or
The data request is used for determining that the target data value of the data identifier is an undefined value if the target data value of the data identifier in the data request is an encrypted value; or
And the device is used for judging whether a target data value of the data identifier in the data request is not in the data value sample of the data identifier according to the data identifier in the test global data and the data value sample corresponding to the data identifier, and if the target data value of the data identifier in the data request is not in the data value sample of the data identifier, determining that the target data value of the data identifier is an undefined value.
And the data determining submodule 3032 is configured to determine a target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier.
And the data testing module 304 is configured to send the data request to a testing server, so that the testing server generates testing data according to the data request.
A result receiving module 305, configured to obtain the test data sent by the test server.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the apparatus and the modules and units described above may refer to the corresponding processes in the foregoing embodiment of the document abstract extraction method, and are not described herein again.
The apparatus provided in the foregoing embodiment may be implemented by the data obtaining module 301 obtaining test global data and the request receiving module 302 obtaining a data request, where the test global data includes a plurality of data identifiers and data value samples corresponding to the data identifiers, the data request includes a plurality of data identifiers and target data values of the data identifiers, the data processing module 303 determining whether a target data value of the data identifier in the data request is an undefined value, if the target data value of the data identifier in the data request is the undefined value, determining the target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier in the test global data, and then the data testing module 404 sending the data request to the test server, so that the test server generates test data according to the data request, finally, the result receiving module 305 obtains the test data sent by the test server. The device can process the incomplete data to improve the test efficiency.
Referring to fig. 6, fig. 6 is a schematic block diagram illustrating a structure of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal device.
As shown in fig. 6, the computer device includes a processor, a memory, and a network interface connected by a system bus, wherein the memory may include a nonvolatile storage medium and an internal memory.
The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause a processor to perform any of the Mock-based testing methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a non-volatile storage medium, which when executed by the processor, causes the processor to perform any of the Mock-based testing methods.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring test global data, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications;
acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications;
if the target data value of the data identifier in the data request is an undefined value, determining the target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data;
sending the data request to a test server so that the test server generates test data according to the data request;
and acquiring the test data sent by the test server.
In one embodiment, when the processor implements the Mock-based testing method, the processor is further configured to implement:
and if the target data value of the data identifier in the data request is a preset character string, determining that the target data value of the data identifier is an undefined value.
In one embodiment, when the processor implements the Mock-based testing method, the processor is further configured to implement:
and if the target data value of the data identifier in the data request is an encrypted value, determining that the target data value of the data identifier is an undefined value.
In one embodiment, when the processor implements the Mock-based testing method, the processor is further configured to implement:
judging whether a target data value of the data identifier in the data request is not in the data value sample of the data identifier according to the data identifier in the test global data and the data value sample corresponding to the data identifier;
and if the target data value of the data identifier in the data request is not in the data value sample of the data identifier, determining that the target data value of the data identifier is an undefined value.
In one embodiment, when the determining that the data value sample corresponding to the data identifier in the test global data is the target data value of the data identifier in the data request is implemented, the processor is configured to implement:
and if the data value sample corresponding to the data identifier comprises a plurality of data values, selecting one data value from the plurality of data values according to a preset selection rule, and determining the selected data value as a target data value of the data identifier in the data request.
In one embodiment, when the processor selects one of the plurality of data values according to a preset selection rule, the processor is configured to:
determining a frequency of use for each of the data values;
selecting one data value from the plurality of data values according to the frequency of use.
In one embodiment, after implementing the get data request, the data request including a number of data identifiers and target data values of the data identifiers, the processor is further configured to implement:
and if the target data values of all the data identifications in the data request are not undefined values, sending the data request to a test server so that the test server generates test data according to the data request.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and a method implemented when the program instructions are executed may refer to various embodiments of the Mock-based testing method in the present application.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
The foregoing embodiments provide a computer apparatus and computer-readable storage medium that, by retrieving test global data and a retrieve data request, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications, the data request comprises a plurality of data identifications and target data values of the data identifications, secondly, judging whether the target data value of the data identifier in the data request is an undefined value, if the target data value of the data identifier in the data request is the undefined value, determining a target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data, and then sending the data request to a test server so that the test server generates test data according to the data request, and finally acquiring the test data sent by the test server. The method can process data with incomplete data so as to improve the testing efficiency.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. 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 system 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 system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A Mock-based test method is characterized by comprising the following steps:
acquiring test global data, wherein the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications;
acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications;
if the target data value of the data identifier in the data request is an undefined value, determining the target data value of the data identifier in the data request according to a data value sample corresponding to the data identifier in the test global data;
sending the data request to a test server so that the test server generates test data according to the data request;
and acquiring the test data sent by the test server.
2. The Mock-based testing method according to claim 1, wherein said method comprises:
and if the target data value of the data identifier in the data request is a preset character string, determining that the target data value of the data identifier is an undefined value.
3. The Mock-based testing method according to claim 1, wherein said method comprises:
and if the target data value of the data identifier in the data request is an encrypted value, determining that the target data value of the data identifier is an undefined value.
4. The Mock-based testing method according to claim 1, wherein said method comprises:
judging whether a target data value of the data identifier in the data request is not in the data value sample of the data identifier according to the data identifier in the test global data and the data value sample corresponding to the data identifier;
and if the target data value of the data identifier in the data request is not in the data value sample of the data identifier, determining that the target data value of the data identifier is an undefined value.
5. The Mock-based testing method according to any of the claims 1 to 4, wherein the determining of the target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier in the test global data comprises:
and if the data value sample corresponding to the data identifier comprises a plurality of data values, selecting one data value from the plurality of data values according to a preset selection rule, and determining the selected data value as a target data value of the data identifier in the data request.
6. The Mock-based testing method according to claim 5, wherein said selecting a data value from said plurality of data values according to a preset selection rule comprises:
determining a frequency of use for each of the data values;
selecting one data value from the plurality of data values according to the frequency of use.
7. The Mock-based testing method according to claim 1, wherein said obtaining a data request, said data request comprising a plurality of data identifications and target data values of said data identifications, further comprises:
and if the target data values of all the data identifications in the data request are not undefined values, sending the data request to a test server so that the test server generates test data according to the data request.
8. A Mock-based test device, comprising:
the data acquisition module is used for acquiring test global data, and the test global data comprises a plurality of data identifications and data value samples corresponding to the data identifications;
the request receiving module is used for acquiring a data request, wherein the data request comprises a plurality of data identifications and target data values of the data identifications;
the data processing module is used for determining the target data value of the data identifier in the data request according to the data value sample corresponding to the data identifier if the target data value of the data identifier in the data request is an undefined value;
the data testing module is used for sending the data request to a testing server so that the testing server generates testing data according to the data request;
and the result receiving module is used for acquiring the test data sent by the test server.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory is used for storing a computer program;
the processor for executing the computer program and implementing the Mock-based testing method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when executed by a processor, causes the processor to implement the Mock-based testing method according to any of claims 1 to 7.
CN202010464403.7A 2020-05-27 2020-05-27 Test method, device and equipment based on Mock and readable storage medium Pending CN111797004A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010464403.7A CN111797004A (en) 2020-05-27 2020-05-27 Test method, device and equipment based on Mock and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010464403.7A CN111797004A (en) 2020-05-27 2020-05-27 Test method, device and equipment based on Mock and readable storage medium

Publications (1)

Publication Number Publication Date
CN111797004A true CN111797004A (en) 2020-10-20

Family

ID=72806311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010464403.7A Pending CN111797004A (en) 2020-05-27 2020-05-27 Test method, device and equipment based on Mock and readable storage medium

Country Status (1)

Country Link
CN (1) CN111797004A (en)

Similar Documents

Publication Publication Date Title
CN112671769B (en) Electronic contract signing method, device and equipment
CN109815261B (en) Global search function implementation and data real-time synchronization method and device and electronic equipment
CN109814854B (en) Project framework generation method, device, computer equipment and storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN112860778B (en) Database management method, device, equipment and medium for desktop application program
CN112597020A (en) Interface testing method and device, computer equipment and storage medium
CN112667415B (en) Data calling method and device, readable storage medium and electronic equipment
CN105871960B (en) Method, device and equipment for calling data sharing
CN113434582B (en) Service data processing method and device, computer equipment and storage medium
US20160004850A1 (en) Secure download from internet marketplace
CN113660359A (en) Management method and device for domain name resolution record, storage medium and electronic equipment
CN113077139A (en) Process configuration method, device, equipment and computer readable storage medium
CN113094283A (en) Data acquisition method, device, equipment and storage medium
CN111538672A (en) Test case layered test method, computer device and computer-readable storage medium
CN112433753A (en) Interface document generation method, device, equipment and medium based on parameter information
CN111797004A (en) Test method, device and equipment based on Mock and readable storage medium
CN111061637A (en) Interface test method, interface test device and storage medium
CN111026669A (en) Test log management method, test log management device, and storage medium
CN113986747A (en) Data generation method and device, electronic equipment and storage medium
CN112182107B (en) List data acquisition method, device, computer equipment and storage medium
CN114489603A (en) Code generation method, apparatus, electronic device, medium, and product
CN113553344A (en) Business data management method, system, computer equipment and storage medium
WO2020192134A1 (en) Exception handling method and apparatus based on spring mvc, and computer device and storage medium
CN111367634A (en) Information processing method, information processing device and terminal equipment
CN112256820A (en) Document positioning method and device

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