[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112445700B - Test method and device - Google Patents

Test method and device Download PDF

Info

Publication number
CN112445700B
CN112445700B CN201910838896.3A CN201910838896A CN112445700B CN 112445700 B CN112445700 B CN 112445700B CN 201910838896 A CN201910838896 A CN 201910838896A CN 112445700 B CN112445700 B CN 112445700B
Authority
CN
China
Prior art keywords
test
request
predefined
content
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910838896.3A
Other languages
Chinese (zh)
Other versions
CN112445700A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910838896.3A priority Critical patent/CN112445700B/en
Publication of CN112445700A publication Critical patent/CN112445700A/en
Application granted granted Critical
Publication of CN112445700B publication Critical patent/CN112445700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3664Environments for testing or debugging software
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a testing method and a testing device; the embodiment of the invention can receive the test request of the client, wherein the test request comprises request source information and request content to be tested; inquiring a target test environment according to the request source information; when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client so that the client displays the target response content. In the embodiment of the invention, the test requests with different sources can correspond to the unique test environments, so that the scheme can process the test requests with different sources at the same time, thereby improving the test efficiency.

Description

Test method and device
Technical Field
The invention relates to the field of computers, in particular to a testing method and device.
Background
Software Testing (Software Testing) is a process used to test the quality of Software. In general, the method of software testing is to determine the quality of the software by comparing the difference between the actual output and the predicted output. For example, when it is desired to test some objects in software that are not easily constructed or easily available, the Mock test (a software test method) can simulate the behavior of the object by virtualizing the object.
At present, the functions of software are more and more complex, and when performing Mock test on one software, the test team is often required to perform division of work and cooperation so as to perform multiple tests on each function of the software. However, current testing is inefficient.
Disclosure of Invention
The embodiment of the invention provides a testing method and a testing device, which can improve the testing efficiency.
The embodiment of the invention provides a testing method, which comprises the following steps:
receiving a test request of a client, wherein the test request comprises request source information and request content to be tested;
inquiring a target test environment according to the request source information;
when the target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
and sending the target response content to the client so that the client can display the target response content.
Correspondingly, an embodiment of the present invention provides a testing device, including:
The receiving unit is used for receiving a test request of the client, wherein the test request comprises request source information and request content to be tested;
the environment unit is used for inquiring the target test environment according to the request source information;
a predefined mapping relation unit, configured to obtain, when the target test environment exists, a predefined mapping relation set corresponding to the target test environment, where the predefined mapping relation set includes at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
the response unit is used for determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
and the sending unit is used for sending the target response content to the client so that the client can display the target response content.
The embodiment of the invention also provides a testing method, which comprises the following steps:
displaying a test page;
obtaining request content to be tested based on the request editing operation of the user on the test page;
acquiring identity information;
generating a test request according to the identity information and the content of the request to be tested;
The test request is sent to a server side, so that the server side generates response content corresponding to the request content to be tested according to the identity information;
and receiving and displaying the response content returned by the server.
The embodiment of the invention also provides electronic equipment, which comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions stored in the memory to realize any test method in the embodiment of the invention.
The embodiment of the invention also provides a storage medium, wherein the storage medium stores instructions which, when executed by a processor, implement any of the test methods in the embodiment of the invention.
The embodiment of the invention can receive the test request of the client, wherein the test request comprises request source information and request content to be tested; inquiring a target test environment according to the request source information; when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client so that the client displays the target response content.
In the embodiment of the invention, the target test environment is determined by the request source information, and the target response content corresponding to the test request is generated by adopting the target test environment, so that the test requests with different sources can be processed simultaneously, and the response content corresponding to the test requests with different sources can be generated. Therefore, the scheme can support a test team to perform simultaneous tests for multiple persons, and each test is not mutually influenced, so that the test efficiency is improved under the condition of ensuring that the tests are not mutually interfered.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a test system according to an embodiment of the present invention;
FIG. 1b is a schematic diagram of a first flow chart of a testing method according to an embodiment of the present invention;
FIG. 1c is a schematic diagram of a predefined mapping relationship set structure provided by an embodiment of the present invention;
FIG. 1d is a schematic diagram of the relationship between predefined information and test environment provided by an embodiment of the present invention;
FIG. 1e is a schematic diagram of a first configuration of a test environment set according to an embodiment of the present invention;
FIG. 1f is a schematic diagram of a second configuration of a test environment set provided by an embodiment of the present invention;
FIG. 2a is a schematic diagram of a second flow chart of a test method according to an embodiment of the present invention;
FIG. 2b is a first page view of a test page provided by an embodiment of the present invention;
FIG. 2c is a second page schematic of the test page provided by the embodiment of the present invention;
FIG. 3a is a schematic diagram of a layer architecture of a test system according to an embodiment of the present invention;
fig. 3b is a schematic diagram of information transceiving between a server and multiple clients in a test system according to an embodiment of the present invention;
FIG. 3c is a schematic diagram illustrating a test procedure of a service side Mock in the test system according to the embodiment of the present invention;
FIG. 4 is a schematic diagram of a first configuration of a testing device according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a second structure of a testing device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The embodiment of the invention provides a testing method, a testing device, electronic equipment and a storage medium.
The embodiment of the invention provides a test system, which comprises: the test equipment suitable for the client, the test equipment suitable for the server and the like provided by the embodiment of the invention.
The server may be a server. Such as a single server, a cluster of servers consisting of multiple servers.
Wherein, the client may be a terminal. Such as cell phones, tablet computers, smart bluetooth devices, notebook computers, personal computers (Personal Computer, PC) and the like.
For example, referring to the schematic structural diagram of the test system shown in fig. 1a, the test system may include a server and a client, which are described below:
the server side: the server side can receive a test request of the client side, wherein the test request comprises request source information and request content to be tested; inquiring a target test environment according to the request source information; when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client so that the client displays the target response content.
Client side: the client can display a test page; based on the request editing operation of the user for the test page, obtaining the request content to be tested; acquiring identity information; generating a test request according to the identity information and the content of the request to be tested; sending a test request to a server so that the server generates response content corresponding to the request content to be tested according to the identity information; and receiving and displaying the response content returned by the server.
Specifically, when testing is required, the client can display a test page, edit the operation based on the request of the user for the test page to obtain the content of the request to be tested, acquire identity information, generate a test request according to the identity information and the content of the request to be tested, and finally send the test request to the server; when the server receives a test request sent by the client, the server can query a target test environment according to the request source information, and when the target test environment exists, the server can acquire a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; then, the server side can determine target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; finally, the server side can send target response content to the client side; when the client receives the target response content sent by the server, the client can respond to the response content.
The following will describe in detail. The numbers of the following examples are not intended to limit the preferred order of the examples.
In this embodiment, a description will be made from the perspective of a testing device, which may be specifically integrated in a server, for performing a Mock test on a test request sent by a client to obtain response contents.
The Mock test refers to that for some objects which are not easy to construct and acquire, the Mock object is created to simulate the behavior of the object, namely, by supposing a specific response corresponding to a certain request in advance, each time the client sends the request to the server, the server can send the suppositional response to the client, so that the client receives the suppositional response in advance, and the behavior of generating a real response according to the certain request is simulated.
The server may be an electronic device, for example, a server, a terminal, or other devices. For example, the server may be a server, such as a single server, a cluster of servers, and so forth. For another example, the terminal may be a mobile phone, a notebook computer, a personal computer, etc.
As shown in fig. 1b, the specific flow of the test method may be as follows:
101. And receiving a test request of the client, wherein the test request can comprise request source information and request content to be tested.
The test request refers to a request initiated by the client to the server, where the request is used for requesting software testing. The test request may include request source information and request content to be tested.
The request source information refers to source information of a client or a user initiating the request. The request source information is various, for example, the request source information can be a network address, an identity identifier, client geographic positioning information and the like of the client initiating the test request, and can also be user account information, user identity information and the like of a user initiating the test request for logging in the client.
The content of the test request refers to a content specifically used for generating a test response in the test request, and the test request content may include software information of the software to be tested, information of a function module to be tested of the software to be tested, a custom program uploaded by a user, and the like.
The manner of receiving the test request of the client may be various, for example, the test request sent by the client may be received through a wireless network, or the test request sent by the client may be received through a communication medium, for example, the test request sent by the client may be received through a network cable, a usb disk, an optical disk, or the like.
In some embodiments, the test environment may be built in advance for later provision of the test environment for test requests of different sources, so the following steps may be further included before performing step 101:
a. acquiring predefined information, wherein the predefined information can comprise predefined source information and predefined content;
b. inquiring a testing environment corresponding to the predefined source information;
c. when a testing environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the testing environment according to the predefined content;
d. and when the testing environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the testing environment according to the predefined content.
The predefined information is information of a predefined test environment, and may include source information and predefined content. The source information is used to represent the source of the predefined information, and the predefined content may be used to generate or update a set of predefined mappings corresponding to the test environment.
The predefined source information may be various, for example, the predefined source information may be a network address, an identity identifier, geographic location information of the client, etc. of the client, or may be user account information, user identity information, etc. used for logging in the client when the user performs the predefined.
Wherein, the predefined mapping relation set can include at least one predefined mapping relation, the predefined mapping relation is a mapping relation between the request content predefined by the user and the response content predefined by the user, and the predefined request content, the predefined response content and the mapping relation thereof can be carried by the predefined information. For example, referring to fig. 1c, each test environment corresponds to a predefined mapping relation set, where the mapping relation between the predefined request content and the predefined response content in the predefined mapping relation set may be one-to-one correspondence, or may be one-to-many, many-to-one, many-to-many, or the like, which is not required herein.
Specifically, the predefined request content, the predefined response content, and the mapping relationship thereof may be set by the user, so that a specific response corresponding to a certain request is assumed in advance.
There are various methods for acquiring the predefined information, for example, the user may set the predefined information on the client, and the server may acquire the predefined information by receiving the predefined information sent by the client; for another example, the server side may communicate with a network server to obtain; as another example, by reading predefined information in local memory, and so on.
The predefined mapping relationship may exist between the predefined source information and the test environment, and the test environment having the predefined mapping relationship with the predefined source information may be queried to determine whether the test environment corresponding to the predefined source information exists, for example, the name, the number, the identifier, etc. of the test environment corresponding to the network address may be queried through the predefined source information, such as the network address of the client terminal sending the predefined information.
When the test environment corresponding to the predefined source information exists, updating the predefined mapping relation set corresponding to the test environment according to the predefined content; when the test environment corresponding to the predefined source information does not exist, a predefined mapping relation set corresponding to the test environment can be generated according to the predefined content, for example, a test environment is newly built, names, numbers, identifiers and the like of the test environment are named, and the names, numbers, identifiers and the like of the test environment are associated with the predefined source information, such as the network address of the client.
For example, referring to fig. 1d, predefined information C is acquired, wherein the predefined information C may include predefined source information (i.e., network address C) as well as predefined content C. The server may query the network address C for the test environment name associated with that network address C, either by local memory or in a database.
For example, when there is no test environment corresponding to the predefined source information, a test environment is generated and named as a test environment C, a mapping relationship is generated between the test environment C and the network address C, and a predefined mapping relationship set C corresponding to the test environment C is generated according to the predefined content C. Specific naming rules are various, and are not described herein.
For another example, when there is a test environment C corresponding to the network address C, the predefined mapping relation set C corresponding to the test environment C is updated according to the predefined content C, and the predefined mapping relation set C is updated to be a predefined mapping relation set C'.
It should be noted that the predefined information may include at least one pair of predefined source information and predefined content, and each pair of predefined source information and predefined content may update or generate a test environment. For example, referring to table 1, the predefined information may include predefined source information and predefined content, which may carry predefined request content, predefined response content, and a mapping relationship between the predefined request content and the predefined response content:
TABLE 1
It should be noted that the request content may include at least one specific request data, and the response content may also include at least one specific response data. For example, as in table 1, the request a may have a predefined mapping relationship with the responses a1 and a 2.
In some embodiments, in order to support multiple network protocols and improve applicability, step 101 may specifically include the following steps:
a. receiving a test request data packet of a client, wherein the test request data packet can comprise transmission protocol type information;
b. inquiring a data packet analyzer corresponding to the transmission protocol type information to obtain the data packet analyzer;
c. and analyzing the test request data packet by adopting a data packet analyzer to obtain request source information and request content.
The transmission protocol type information is data information carrying the transmission protocol type. Wherein the transmission protocol (Communications Protocol), also referred to as communication protocol, refers to a system standard that allows two or more terminals in a transmission system to communicate information between each other in any physical medium. The types of transport protocols are various, such as TCP/IP protocol type (Transmission Control Protocol/Internet Protocol), UDP protocol type (User Datagram Protocol), IPX/SPX protocol type (Internet work Packet Exchange), and user-defined transport protocol type, etc.
For example, the transport protocol types may include HTTP (a protocol for transport using TCP), svrkit (a protocol for transport using TCP or UDP), logicsvr (a protocol for transport using HTTP), and so on.
The data packet parser is a data packet parser for parsing data packets encrypted by adopting a transmission protocol, and different transmission protocols can be corresponding to the special data packet parser.
The packet parser may be understood as an algorithm code for decrypting a packet encrypted by a transmission protocol, for example, referring to a TCP/IP protocol encrypted packet shown in table 2, where the packet parser corresponding to the TCP/IP transmission protocol may extract request source information (for example, a client address), request destination information (for example, a server address), a packet type sequence number (for example, a request type sequence number 0x 01), an acknowledgement number, a header length, a packet content (for example, a request content to be tested), and so on.
TABLE 2
102. And inquiring the target test environment according to the request source information.
Specifically, step 102 may include the steps of:
(1) A set of test environments is obtained, wherein the set of test environments may include at least one virtual test environment.
(2) Traversing the virtual test environments in the test environment set.
(3) When the virtual test environment corresponding to the request source information exists in the test environment set, the virtual test environment corresponding to the request source information is determined to be the target test environment.
Referring to fig. 1e, a test environment set may include a virtual test environment 1, a virtual test environment 2, and a virtual test environment 3, where each virtual test environment has corresponding request source information, and each time a target test environment is to be queried according to the request source information, the virtual test environment in the test environment set is traversed first, the request source information is compared with the request source information 1, the request source information 2, and the request source information 3, respectively, and the virtual test environments with the same request source information are determined as target test environments.
In some embodiments, in order to perform a simultaneous mock test on different functional modules of the software to be tested at the same time under the condition of no interference with each other, so as to further improve the test efficiency, referring to fig. 1f, the test request may include module information to be tested, the target test environment may include at least one module test sub-environment, the predefined mapping relation set may include at least one predefined mapping relation subset, and after step 102, the following steps may further include:
and determining a target module testing sub-environment in the module testing sub-environment according to the module information to be tested.
The module information to be tested is information of a module to be tested of the software to be tested, and each module can comprise interface information of at least one interface. The interface may declare an identifier of the module to be used for indicating the function of the module, i.e. what the module can do.
For example, the transmission module may include a receiving interface, a parsing interface, a packaging interface, a transmitting interface, and the like.
In some embodiments, to prevent the test from being stalled due to the lack of a suitable virtual service environment, when the suitable virtual service environment cannot be queried, the test may be turned to a real test environment to further improve the test efficiency, where the test environment may further include at least one real test environment, and after the step of "traversing the virtual test environments in the test environment set", the following steps may further include:
a. when the virtual test environment corresponding to the request source information does not exist in the test environment set, traversing the real test environment in the test environment set;
b. when a real test environment corresponding to the request source information exists in the test environment set, testing the request content to be tested by adopting the real test environment to obtain real response content;
c. the real response content is sent to the client so that the client displays the real response content.
The method comprises the steps of testing request content to be tested by adopting a real test environment, and obtaining real response content in various modes, for example, providing real test service in a server, responding to the test request by adopting the real test service, and obtaining the real response content; for another example, the network server may provide a real test service, and when a real test environment corresponding to the request source information exists in the test environment set, the test request is sent to the network server address of the real test environment, so that the network server provides the real test service in the real test environment, and then obtains a response returned by the network server, so as to obtain real response content.
103. When the target test environment exists, a predefined mapping relation set corresponding to the target test environment is obtained, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content.
There are various methods for obtaining the predefined mapping relation set corresponding to the target test environment, for example, obtaining by reading the local memory, obtaining by communicating with a network server, obtaining by querying from a database, obtaining by inputting by a user, and so on.
In some embodiments, in order to perform a simultaneous mock test on different functional modules of the software to be tested under the condition of no interference with each other, so as to further improve the test efficiency, in step 102, a target module testing sub-environment may be determined in the module testing sub-environment according to the module information to be tested, so step 103 may specifically include the following steps:
and when the target module testing sub-environment exists, acquiring a predefined mapping relation subset corresponding to the target module testing sub-environment.
104. And determining target response content corresponding to the request content to be tested based on the predefined mapping relation set corresponding to the target test environment.
Specifically, step 104 may include the steps of:
a. traversing all request contents in a predefined mapping relation set corresponding to a target test environment;
b. determining request content which is the same as the request content to be tested in a predefined mapping relation set corresponding to a target test environment;
c. and acquiring response content corresponding to the same request content as the request content to be tested, and determining the response content as target response content.
In some embodiments, in order to perform a mock test on different functional modules of the software to be tested at the same time under the condition of no interference with each other, so as to further improve the test efficiency, in step 103, a subset of predefined mapping relationships corresponding to the test sub-environment of the target module may be obtained, so step 104 may specifically include the following steps:
and determining target response content corresponding to the request content to be tested based on the predefined mapping relation subset corresponding to the target module testing sub-environment.
105. And sending the target response content to the client so that the client displays the target response content.
In some embodiments, in order to improve the applicability, the test request packet carrying the transport protocol type information is already acquired in step 101, so step 105 may specifically include the following steps:
a. Inquiring a data wrapper corresponding to the transmission protocol type information to obtain the data wrapper;
b. encapsulating the target response content by adopting a data encapsulator to obtain a test response data packet carrying the target response content;
c. and sending the test response data packet to the client.
The data wrapper may be understood as a section of algorithm code, which is used to encrypt the content to be encrypted by using a transmission protocol, and generate an encrypted data packet. Different transport protocols may correspond to their proprietary data encapsulator. For example, the TCP/IP protocol corresponds to a TCP/IP data wrapper.
In some embodiments, to facilitate user querying of the test history, the test method may further comprise the steps of:
a. receiving a log query request of a client;
b. acquiring log data from a log database based on a log query request;
c. sending the log data to the client so that the client displays the log data;
the log data may include information such as a test request sent by the client at a historical time and received response content.
For example, the log query request may include the network address information of the client that sends the log query request, and based on the network address information of the client, the log database may query the information such as the test request sent by the client at all historical moments and the received response content.
In some embodiments, each time a test is completed, the data of the test can be saved in the log database for the user to query, so after the target response content is sent to the client, the method further comprises:
generating log data based on the test request and the target response content, and saving the log data to a log database.
As can be seen from the above, the embodiment of the present invention may receive a test request of a client, where the test request includes request source information and content of a request to be tested; inquiring a target test environment according to the request source information; when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client so that the client displays the target response content. Thus, in the embodiment of the invention, test requests with different sources can correspond to the unique test environment, and test responses corresponding to the test requests can be generated by adopting the unique test environment. The scheme can process test requests from different sources simultaneously, so that the test efficiency is improved.
In this embodiment, the description will be made from the perspective of a test apparatus, which may be specifically integrated in a client, for generating and sending a test request to a server, and receiving and displaying response contents returned by the server.
As shown in fig. 2a, the specific flow of the test method may be as follows:
201. and displaying the test page.
The test page may include a request area and a response area, and the client may obtain the content of the request to be tested edited by the user in the request area, send the content of the request to be tested to the server, and obtain the response content from the server, and display the response content in the response area.
202. And obtaining the content of the request to be tested based on the request editing operation of the user on the test page.
The method for obtaining the content of the request to be tested includes various ways based on the request editing operation of the user on the test page, for example, the content of the request to be tested can be obtained by uploading a Script (Script) carrying the test request by the user, the content of the request to be tested can be obtained by selecting the request to be tested from the preset test request by the user, and the like.
For example, referring to FIG. 2b, the request area may include a newly added request control, an added request edit control, a request delete control, a request send control, and so forth. The user can create an increased request by clicking the new request control, and display a request editing page by clicking the request editing control, wherein the user can upload a script carrying the test request in the request editing page, so that the client can obtain the content of the request to be tested.
In some embodiments, the test page may also include predefined areas, such as, referring to fig. 2c, which may include a newly added predefined control, an added predefined edit control, a predefined delete control, and so forth. The user may create an added predefined by clicking on a new added predefined control in which the user may import or enter predefined information that the client may send to the server.
203. And acquiring identity information.
The identity information may be the identity information of the client, the identity information when the user logs in the client, and so on.
For example, the identity information may be a network address of the client, or may be an account number, a nickname, etc. when the user logs in to the client.
204. And generating a test request according to the identity information and the content of the request to be tested.
The client can generate a test request carrying identity information and the content of the request to be tested.
In some embodiments, to improve security, the content of the request to be tested may be encrypted before being transmitted, the test request may be carried by an encrypted test request packet, and step 304 may specifically include the following steps:
a. Acquiring transmission protocol type information and a data wrapper corresponding to the transmission protocol type information;
b. packaging the identity information, the content of the request to be tested and the transmission protocol type information according to the data wrapper to obtain a test request data packet;
c. and sending the test request data packet to the server.
The specific tcp type information and the data wrapper corresponding to the tcp type information may refer to step 101 and step 105, which are not described herein.
205. And sending a test request to the server so that the server generates response content corresponding to the content of the request to be tested according to the identity information.
206. And receiving and displaying the response content returned by the server.
After receiving the response content returned by the server, the client can display in the response area.
In some embodiments, the server returns an encrypted test response packet, and the response content can be obtained after parsing, so step 206 may specifically include the following steps:
a. receiving a test response data packet returned by the server;
b. acquiring a data packet analyzer corresponding to the transmission protocol type information;
c. analyzing the test response data packet by adopting a data packet analyzer to obtain response content;
d. And displaying the response content.
The packet parser corresponding to the transport protocol type information may refer to step 101, which is not described herein.
From the above, the embodiment of the invention can display the test page; based on the request editing operation of the user for the test page, obtaining the request content to be tested; acquiring identity information; generating a test request according to the identity information and the content of the request to be tested; sending a test request to a server so that the server generates response content corresponding to the request content to be tested according to the identity information; and receiving and displaying the response content returned by the server. In the scheme, a plurality of clients can simultaneously send the test requests carrying the identity information of the clients to the clients without mutual interference, so that the clients can simultaneously process the test requests, and the test efficiency is improved.
The test method provided by the embodiment of the invention can be specifically applied to various test scenes, for example, the scheme can be applied to team test scenes for performing Mock test (a test method) on the software to be tested.
In this embodiment, a Mock test is performed on the software to be tested by a test team, and this scheme will be described in detail.
As shown in fig. 3a, the present solution provides a test system, where the test system includes a client and a server, and in the test system architecture, the client includes a presentation layer and a front-end logic layer, and the server includes a back-end logic layer and a storage layer. The presentation layer may include a plurality of page display functions, for example, a test page, a log query page, and other page display functions; the logic layer comprises a front-end logic layer and a back-end logic layer, wherein the front-end logic layer can comprise logic programs such as data file management, interface management, predefined management, log inquiry and the like, and the back-end logic layer can comprise logic programs such as initialization, log storage, analysis request, predefined information acquisition, predefined information matching, response generation and the like; the storage layer may include a database, a local memory, and other storage media.
The scheme flow is as follows:
and (one) the client displays the test page and generates a test request data packet according to the operation of the user on the test page.
In this embodiment, the user may click on the new request control of the test page to generate the test request, and click on the request editing control to edit the content of the request to be tested.
After the client obtains the content of the request to be tested, the content of the request to be tested and the network address of the client can be packaged into a test request data packet according to a data wrapper corresponding to a transmission protocol preset by the client.
For example, with a data wrapper, the client may encrypt the test request data packet by a wrapper method corresponding to the custom protocol.
And (II) the client sends a test request data packet to the server, and the server receives and analyzes the test request data packet.
The server side can acquire a corresponding data packet analyzer according to a transmission protocol preset by the server side, and analyze the test request data packet through the data packet analyzer to obtain request source information (namely a client network address) and request contents to be tested.
For example, a packet parser may be used to parse test request packets encrypted by custom protocol types, such as an application service (app server) type, a logical service (logic server) type, and so on.
And thirdly, the server queries a target test environment according to the network address of the client.
Specifically, referring to fig. 3b, the server may differentiate the Mock test environment of the request according to the client network address. Multiple sets of Mock test environments can be defined in the Mock server, and the environments are isolated from each other.
It should be noted that requests from the same source can only correspond to one Mock test environment, but requests from different sources can correspond to the same Mock test environment.
And enabling the Mock test environment to serve as a target test environment when the server side inquires the Mock test environment corresponding to the client side network address according to the client side network address.
When the service end cannot inquire the Mock testing environment corresponding to the client network address according to the client network address, namely, the Mock testing cannot be carried out, the service end can forward the testing request data packet sent by the client end to the real application server of the application to be tested so as to carry out application testing.
For example, referring to fig. 3c, the test request packet may carry a network address of a client, and the server may traverse preset network addresses corresponding to all Mock test environments, for example, when the network address of the client is the network address A, mock and the preset network address corresponding to the test environment 1 is the network address a, the Mock test environment 1 is started and determined as the target test environment.
And fourthly, the server acquires the predefined information of the client and generates or updates a predefined mapping relation table.
In the scheme, a user can configure a predefined request, a predefined response and a mapping relation between the predefined request and the predefined response on a test page of a client, and after the client sends the configured data to a server, the server can establish the mapping relation between the data and a network address of the client so as to be used for performing a Mock test on the test request sent by the client.
For example, referring to fig. 3c, after the server side obtains the predefined information of the client side, a predefined mapping relation table in the local memory may be generated or updated according to the predefined information, where the predefined mapping relation table may include information such as predefined request content, predefined response content, and mapping relation between the predefined request content and the predefined response content that are predefined by the user.
For example, the predefined mapping relation table may include a predefined request X and a predefined response X corresponding thereto, a predefined request Y and a predefined response Y corresponding thereto, a predefined request Z and a predefined response Z corresponding thereto, and so on.
And fifthly, the server matches the content of the request to be tested according to the predefined mapping relation table to obtain target response content.
In this scheme, the server may traverse all the predefined request contents in the predefined mapping relation table and compare the predefined request contents with the request contents to be tested, so as to find out the predefined request contents identical to the request contents to be tested and the predefined response corresponding to the predefined request contents, and take the predefined response as the target response contents.
For example, referring to fig. 3c, the server may compare the content of the request to be tested with the predefined request X, the predefined request y, and the predefined request z, and when the content of the request to be tested is the same as the predefined request X, the predefined response X is taken as the target response content.
And (six) the server packages the target response content into a test response data packet and sends the test response data packet to the client, so that the client receives and analyzes the test response data packet and then displays the target response content on a test page.
The manner in which the server encapsulates the target response content into the test response data packet may be similar to the manner in which the client generates the test request data packet; the manner in which the client receives the test response packet may be similar to the manner in which the server receives the test request packet sent by the client.
And the client side can obtain target response content after analyzing the test response data packet, and display the target response content in a response area of the test page.
In addition, in this embodiment, each time a complete Mock test is performed, the server may store the information such as the occurrence time of the Mock test, the client information, the request content to be tested, the target response content, etc. as log data in the log database, and the user may obtain the log data from the log database through the client log query page.
As can be seen from the above, in this embodiment, the client may display the test page, and generate a test request packet according to the operation of the user on the test page; the client sends a test request data packet to the server, and the server receives and analyzes the test request data packet; the server side queries a target test environment according to the network address of the client side; the method comprises the steps that a server side obtains predefined information of a client side and generates or updates a predefined mapping relation table; the server matches the request content to be tested according to the predefined mapping relation table to obtain target response content; and the server packages the target response content into a test response data packet and sends the test response data packet to the client, so that the client receives and analyzes the test response data packet and then displays the target response content on a test page. Therefore, the scheme can test certain application software by a plurality of users at the same time, and the application software is not interfered with each other, so that the safety, the efficiency and the accuracy of the test are improved. The user can also configure the predefined information on the test page, so that the applicability and flexibility of the test are improved. In addition, the scheme also supports various transmission protocol types and supports the custom transmission protocol types, so that the applicability is further improved.
In order to better implement the method, the embodiment of the invention provides a testing device which is suitable for a server, and the testing device can be integrated in electronic equipment, wherein the electronic equipment can be a terminal, a server and the like.
For example, in this embodiment, a description will be given from the perspective of a testing device, and a method according to an embodiment of the present invention will be described in detail by taking a specific integration of the testing device in a server as an example.
As shown in fig. 4, the test apparatus may include a receiving unit 401, an environment unit 402, a predefined mapping relation unit 403, a response unit 404, and a transmitting unit 405, as follows:
and (one) a receiving unit 401.
A receiving unit 401, configured to receive a test request of a client.
The test request may include request source information and request content to be tested.
In some embodiments, the receiving unit 401 may be further configured to, before receiving the test request of the client:
a. acquiring predefined information, wherein the predefined information comprises predefined source information and predefined content;
b. inquiring a testing environment corresponding to the predefined source information;
c. when a testing environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the testing environment according to the predefined content;
d. And when the testing environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the testing environment according to the predefined content.
In some embodiments, the receiving unit 401 may specifically be configured to:
a. receiving a test request data packet of a client, wherein the test request data packet comprises transmission protocol type information;
b. inquiring a data packet analyzer corresponding to the transmission protocol type information to obtain the data packet analyzer;
c. and analyzing the test request data packet by adopting a data packet analyzer to obtain request source information and request content.
And (two) an environmental unit 402.
An environment unit 402, configured to query the target test environment according to the request source information.
In some embodiments, the environment unit 402 may include an environment subunit, a virtual subunit, and a target environment subunit, as follows:
(1) An environment subunit.
An environment subunit configured to obtain a set of test environments, where the set of test environments may include at least one virtual test environment.
(2) Virtual subunits.
And the virtual subunit is used for traversing the virtual test environment in the test environment set.
In some embodiments, the test environment may further include at least one real test environment, and the virtual sub-unit may be further configured to, after traversing the virtual test environments in the set of test environments:
a. When the virtual test environment corresponding to the request source information does not exist in the test environment set, traversing the real test environment in the test environment set;
b. when a real test environment corresponding to the request source information exists in the test environment set, testing the request content to be tested by adopting the real test environment to obtain real response content;
c. the real response content is sent to the client so that the client displays the real response content.
In some embodiments, the test request may include module information to be tested, the target test environment may include at least one module test sub-environment, and the set of predefined mappings may include at least one subset of predefined mappings.
(3) A target environment subunit.
And the target environment subunit is used for determining the virtual test environment corresponding to the request source information as a target test environment when the virtual test environment corresponding to the request source information exists in the test environment set.
In some embodiments, the environment unit 402, after querying the target test environment based on the request source information, may also be configured to:
and determining a target module testing sub-environment in the module testing sub-environment according to the module information to be tested.
(III) predefined mapping relation unit 403.
A predefined mapping relation unit 403, configured to obtain, when the target test environment exists, a predefined mapping relation set corresponding to the target test environment, where the predefined mapping relation set includes at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content.
In some embodiments, the predefined mapping relation unit 403 may be specifically configured to:
when a target module testing sub-environment exists, acquiring a predefined mapping relation sub-set corresponding to the target module testing sub-environment;
and (fourth) a response unit 404.
And a response unit 404, configured to determine target response content corresponding to the request content to be tested based on the predefined mapping relation set corresponding to the target test environment.
In some embodiments, the target test environment may include at least one module test sub-environment, the set of predefined mappings may include at least one subset of predefined mappings, and the response unit 404 may be configured to:
and determining target response content corresponding to the request content to be tested based on the predefined mapping relation subset corresponding to the target module testing sub-environment.
And (fifth) a transmitting unit 405.
And a sending unit 405, configured to send the target response content to the client, so that the client displays the target response content.
In some embodiments, the sending unit 405 may specifically be configured to:
a. inquiring a data wrapper corresponding to the transmission protocol type information to obtain the data wrapper;
b. encapsulating the target response content by adopting a data encapsulator to obtain a test response data packet carrying the target response content;
c. and sending the test response data packet to the client.
In some embodiments, the test apparatus may further comprise a log unit, which may be configured to:
a. receiving a log query request of a client;
b. acquiring log data from a log database based on a log query request;
c. sending the log data to the client so that the client displays the log data;
in some embodiments, the sending unit 405 may be configured to, after sending the target response content to the client:
generating log data based on the test request and the target response content, and saving the log data to a log database.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the test device of the present embodiment receives a test request of a client from a receiving unit, where the test request includes request source information and a request content to be tested; inquiring a target test environment by the environment unit according to the request source information; when a target test environment exists, a predefined mapping relation unit acquires a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested by a response unit based on a predefined mapping relation set corresponding to the target test environment; the target response content is transmitted to the client by the transmitting unit so that the client displays the target response content. The scheme can improve the testing efficiency.
In order to better implement the method, the embodiment of the invention also correspondingly provides a testing device which is suitable for the client, and the testing device can be integrated in electronic equipment, wherein the electronic equipment can be a terminal, such as a mobile phone, a notebook computer, a tablet personal computer, a personal computer and the like.
For example, in this embodiment, the method according to the embodiment of the present invention will be described in detail by taking the test device integrated in a notebook computer.
As shown in fig. 5, the test apparatus may include a page unit 501, an editing unit 502, an acquisition unit 503, a generation unit 504, a request unit 505, and a display unit 506 as follows:
a page unit 501.
And a page unit 501, configured to display a test page.
And (two) an editing unit 502.
The editing unit 502 is configured to obtain the requested content to be tested based on a request editing operation of the user for the test page.
And (III) an acquisition unit 503.
An obtaining unit 503, configured to obtain identity information.
(IV) a generating unit 504.
And the generating unit 504 is configured to generate a test request according to the identity information and the content of the request to be tested.
Wherein the test request may include a test request packet, the generating unit 504 may specifically be configured to:
acquiring transmission protocol type information and a data wrapper corresponding to the transmission protocol type information;
packaging the identity information, the content of the request to be tested and the transmission protocol type information according to the data wrapper to obtain a test request data packet;
and sending the test request data packet to the server.
And (fifth) a request unit 505.
The request unit 505 is configured to send a test request to the server, so that the server generates response content corresponding to the content of the request to be tested according to the identity information.
And (sixth) a display unit 506.
And the display unit 506 is configured to receive and display the response content returned by the server.
The display unit 506 may specifically be configured to:
receiving a test response data packet returned by the server;
acquiring a data packet analyzer corresponding to the transmission protocol type information;
analyzing the test response data packet by adopting a data packet analyzer to obtain response content;
and displaying the response content.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the testing device of the present embodiment displays the testing page by the page; the editing unit obtains the content of the request to be tested based on the request editing operation of the user on the test page; acquiring identity information by an acquisition unit; generating a test request by a generating unit according to the identity information and the content of the request to be tested; the request unit sends a test request to the server so that the server generates response content corresponding to the request content to be tested according to the identity information; and the display unit receives and displays the response content returned by the server. The scheme can improve the testing efficiency.
The embodiment of the invention also provides electronic equipment which can be a terminal, a server and other equipment.
For example, the terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
In this embodiment, a detailed description will be given taking an example that the electronic device of this embodiment is a server, for example, as shown in fig. 6, which shows a schematic structural diagram of the server according to the embodiment of the present invention, specifically:
the server may include one or more processor cores 601, one or more computer-readable storage media memory 602, a power supply 603, an input module 604, and a communication module 605, among other components. Those skilled in the art will appreciate that the server architecture shown in fig. 6 is not limiting of the server and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
the processor 601 is a control center of the server, connects various parts of the entire server using various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 602, and calling data stored in the memory 602. In some embodiments, processor 601 may include one or more processing cores; in some embodiments, processor 601 may integrate an application processor that primarily handles operating systems, user pages, applications, and the like, with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 601.
The memory 602 may be used to store software programs and modules, and the processor 601 may execute various functional applications and data processing by executing the software programs and modules stored in the memory 602. The memory 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the server, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide access to the memory 602 by the processor 601.
The server also includes a power supply 603 for powering the various components, and in some embodiments, the power supply 603 may be logically connected to the processor 601 by a power management system, such that functions of managing charging, discharging, and power consumption are performed by the power management system. The power supply 603 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The server may also include an input module 604, which input module 604 may be used to receive entered numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
The server may also include a communication module 605, and in some embodiments the communication module 605 may include a wireless module, and the server may provide wireless broadband internet access to the user by short-range wireless transmissions via the wireless module of the communication module 605. For example, the communication module 605 may be used to assist a user in e-mail, browsing web pages, accessing streaming media, and the like.
Although not shown, the server may further include a display unit or the like, which is not described herein. In this embodiment, the processor 601 in the server loads executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 executes the application programs stored in the memory 602, so as to implement various functions as follows:
receiving a test request of a client, wherein the test request comprises request source information and request content to be tested;
Inquiring a target test environment according to the request source information;
when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
and sending the target response content to the client so that the client displays the target response content.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
As can be seen from the above, the embodiment of the present invention receives a test request of a client, where the test request includes request source information and request content to be tested; inquiring a target test environment according to the request source information; when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content; determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client so that the client displays the target response content. The scheme can improve the test efficiency.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present invention provide a computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform the steps of any of the test methods provided by the embodiments of the present invention. For example, the instructions may perform the steps of:
receiving a test request of a client, wherein the test request comprises request source information and request content to be tested;
inquiring a target test environment according to the request source information;
when a target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
And sending the target response content to the client so that the client displays the target response content.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The instructions stored in the storage medium can execute the steps in any test method provided by the embodiment of the present invention, so that the beneficial effects that any test method provided by the embodiment of the present invention can achieve can be achieved, and detailed descriptions of the foregoing embodiments are omitted herein.
The foregoing has outlined some of the more detailed description of the method and apparatus for testing embodiments of the present invention, wherein specific examples are provided herein to illustrate the principles and embodiments of the present invention, and wherein the above examples are provided to assist in the understanding of the method and core concepts of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention.

Claims (10)

1. A method of testing, comprising:
Acquiring predefined information, wherein the predefined information comprises predefined source information and predefined content;
inquiring the testing environment corresponding to the predefined source information;
generating a predefined mapping relation set corresponding to the test environment according to the predefined content;
receiving a test request of a client, wherein the test request comprises request source information and request content to be tested;
inquiring a target test environment according to the request source information;
when the target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, wherein the predefined mapping relation set comprises at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
and sending the target response content to the client so that the client can display the target response content.
2. The testing method of claim 1, wherein querying the target testing environment based on the request source information comprises:
Acquiring a test environment set, wherein the test environment set comprises at least one virtual test environment;
traversing a virtual test environment in the test environment set;
when the virtual test environment corresponding to the request source information exists in the test environment set, the virtual test environment corresponding to the request source information is determined to be a target test environment.
3. The test method of claim 2, wherein the test environment further comprises at least one real test environment, and after traversing the virtual test environments in the set of test environments, further comprising:
when the virtual test environment corresponding to the request source information does not exist in the test environment set, traversing the real test environment in the test environment set;
when the real test environment corresponding to the request source information exists in the test environment set, testing the request content to be tested by adopting the real test environment to obtain real response content;
and sending the real response content to the client so that the client displays the real response content.
4. The test method of claim 1, wherein receiving a test request from a client comprises:
Receiving a test request data packet of a client, wherein the test request data packet comprises transmission protocol type information;
inquiring a data packet analyzer corresponding to the transmission protocol type information to obtain the data packet analyzer;
analyzing the test request data packet by adopting the data packet analyzer to obtain request source information and request content;
the sending the target response content to the client comprises the following steps:
inquiring a data wrapper corresponding to the transmission protocol type information to obtain the data wrapper;
encapsulating the target response content by adopting the data encapsulator to obtain a test response data packet carrying the target response content;
and sending the test response data packet to the client.
5. The test method of claim 1, wherein the test request includes module information to be tested, the target test environment includes at least one module test sub-environment, and the set of predefined mappings includes at least one subset of predefined mappings;
after the target test environment is queried according to the request source information, the method further comprises the following steps:
determining a target module testing sub-environment in the module testing sub-environment according to the module information to be tested;
When the target test environment exists, acquiring a predefined mapping relation set corresponding to the target test environment, including:
when the target module testing sub-environment exists, acquiring a predefined mapping relation subset corresponding to the target module testing sub-environment;
the determining the target response content corresponding to the request content to be tested based on the predefined mapping relation set corresponding to the target test environment comprises the following steps:
and determining target response content corresponding to the request content to be tested based on the predefined mapping relation subset corresponding to the target module testing sub-environment.
6. The testing method of claim 1, wherein the generating the set of predefined mappings corresponding to the testing environment according to the predefined content comprises:
when a testing environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the testing environment according to the predefined content;
and when the testing environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the testing environment according to the predefined content.
7. The test method of claim 1, further comprising:
Receiving a log query request of a client;
acquiring log data from a log database based on the log query request;
sending the log data to a client so that the client displays the log data;
after the target response content is sent to the client, the method further comprises the following steps:
generating log data based on the test request and the target response content, and storing the log data in a log database.
8. A test device, comprising:
a receiving unit configured to acquire predefined information including predefined source information and predefined content; inquiring the testing environment corresponding to the predefined source information; generating a predefined mapping relation set corresponding to the test environment according to the predefined content;
the receiving unit is also used for receiving a test request of the client, wherein the test request comprises request source information and request content to be tested;
the environment unit is used for inquiring the target test environment according to the request source information;
a predefined mapping relation unit, configured to obtain, when the target test environment exists, a predefined mapping relation set corresponding to the target test environment, where the predefined mapping relation set includes at least one predefined mapping relation, and the predefined mapping relation is a mapping relation between predefined request content and predefined response content;
The response unit is used for determining target response content corresponding to the request content to be tested based on a predefined mapping relation set corresponding to the target test environment;
and the sending unit is used for sending the target response content to the client so that the client can display the target response content.
9. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions, the processor loading the memory stored instructions implementing the test method of any one of claims 1 to 7.
10. A computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform the steps of the test method of any one of claims 1 to 7.
CN201910838896.3A 2019-09-05 2019-09-05 Test method and device Active CN112445700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910838896.3A CN112445700B (en) 2019-09-05 2019-09-05 Test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910838896.3A CN112445700B (en) 2019-09-05 2019-09-05 Test method and device

Publications (2)

Publication Number Publication Date
CN112445700A CN112445700A (en) 2021-03-05
CN112445700B true CN112445700B (en) 2023-10-13

Family

ID=74733366

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910838896.3A Active CN112445700B (en) 2019-09-05 2019-09-05 Test method and device

Country Status (1)

Country Link
CN (1) CN112445700B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051159A (en) * 2021-03-18 2021-06-29 中国工商银行股份有限公司 Mobile terminal application testing method and device
CN113608994B (en) * 2021-06-30 2024-10-15 天津五八到家货运服务有限公司 Request processing method and system
CN114238099B (en) * 2021-12-09 2022-08-09 北京五八信息技术有限公司 Method and device for gray scale test, electronic equipment and readable medium
CN116701470B (en) * 2023-08-07 2023-10-13 舟谱数据技术南京有限公司 Method and device for reproducing customer problems under medium rack, electronic equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104683386A (en) * 2013-11-26 2015-06-03 腾讯科技(深圳)有限公司 Pile service implementation method and device capable of customizing response
CN104699612A (en) * 2015-03-25 2015-06-10 北京嘀嘀无限科技发展有限公司 Processing method, equipment and system used in software testing
CN107122292A (en) * 2016-10-21 2017-09-01 北京小度信息科技有限公司 A kind of method and system of analog service
CN107580080A (en) * 2017-09-15 2018-01-12 北京奇艺世纪科技有限公司 A kind of connection method of test environment and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104683386A (en) * 2013-11-26 2015-06-03 腾讯科技(深圳)有限公司 Pile service implementation method and device capable of customizing response
CN104699612A (en) * 2015-03-25 2015-06-10 北京嘀嘀无限科技发展有限公司 Processing method, equipment and system used in software testing
CN107122292A (en) * 2016-10-21 2017-09-01 北京小度信息科技有限公司 A kind of method and system of analog service
CN107580080A (en) * 2017-09-15 2018-01-12 北京奇艺世纪科技有限公司 A kind of connection method of test environment and device

Also Published As

Publication number Publication date
CN112445700A (en) 2021-03-05

Similar Documents

Publication Publication Date Title
CN112445700B (en) Test method and device
CN104054316B (en) Systems and methods for conducting load balancing on SMS center and building virtual private network
WO2017116803A1 (en) Universal abstraction layer and management of resource devices over a network
US20170289243A1 (en) Domain name resolution method and electronic device
WO2020048453A1 (en) Network element management method and apparatus, system and storage medium
KR102136583B1 (en) Monitoring system and method of cloud environment
CN112367684B (en) Flow control method, device, storage medium and computer equipment
CN111490908B (en) Network speed measurement method, device, equipment, medium and speed measurement system
CN109379742A (en) Access method, device and storage medium of wireless local area network
CN109525684A (en) Message forwarding method and device
CN112040030A (en) Message transmission method and device, computer equipment and storage medium
CN104506450A (en) Media resource feedback method and device
CN104144231B (en) Method and device for processing DNS query request
CN111585786A (en) Realization of secret-free building method of big data cluster
CN110933170A (en) Multi-device linkage control method and device of ZigBee gateway and storage medium
CN112770408B (en) Log transmission method and device, computer equipment and storage medium
CN106453349B (en) Account login method and device
CN106357814B (en) A kind of document handling method, agency service end and client
CN104052679A (en) Load balancing method and device for network flow
CN114466047B (en) Method, platform, equipment and medium for conveniently accessing Internet of things equipment to Internet of things platform
CN115658348A (en) Micro-service calling method, related device and storage medium
CN112738019B (en) Method and device for displaying device information, storage medium and electronic device
CN114025009A (en) Method, system, proxy server and device for forwarding request
CN109413224A (en) Message forwarding method and device
Elias et al. A ubiquitous model for wireless sensor networks monitoring

Legal Events

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