CN112445700A - Test method and device - Google Patents

Test method and device Download PDF

Info

Publication number
CN112445700A
CN112445700A CN201910838896.3A CN201910838896A CN112445700A CN 112445700 A CN112445700 A CN 112445700A CN 201910838896 A CN201910838896 A CN 201910838896A CN 112445700 A CN112445700 A CN 112445700A
Authority
CN
China
Prior art keywords
test
request
predefined
target
content
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.)
Granted
Application number
CN201910838896.3A
Other languages
Chinese (zh)
Other versions
CN112445700B (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

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

Abstract

The embodiment of the invention discloses a test method and a test device; the embodiment of the invention can receive 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 content of the request 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 from different sources can correspond to the unique test environments, so that the scheme can process the test requests from different sources simultaneously, 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 a testing device.
Background
Software Testing (Software Testing) is a process used to test the quality of Software. Typically, software testing is performed by comparing the difference between the actual output and the predicted output to determine the quality of the software. For example, when it is desired to test some object in software that is not easily constructed or not easily obtained, Mock testing (a software testing method) may simulate the behavior of the object by virtualizing the object.
At present, the functions of software are more and more complex, and when a Mock test is performed on one software, a test team is often required to work and cooperate 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 testing efficiency.
The embodiment of the invention provides a test 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 displays the target response content.
Correspondingly, an embodiment of the present invention provides a testing apparatus, including:
the system comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a test request of a client, and the test request comprises request source information and request content to be tested;
the environment unit is used for inquiring a target test environment according to the request source information;
the predefined mapping relation unit is used for acquiring a predefined mapping relation set corresponding to the target testing environment when the target testing environment exists, 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;
a response unit, configured to determine target response content corresponding to the requested content to be tested based on a predefined mapping relationship 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 test method, which comprises the following steps:
displaying a test page;
obtaining request content to be tested based on request editing operation of a user aiming at the test page;
acquiring identity information;
generating a test request according to the identity information and the content of the request to be tested;
sending the test request to a server so that the server can generate response content corresponding to the content of the request 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 instructions stored by the processor and the memory are loaded 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, and the instructions are executed by the processor to realize any test method in the embodiment of the invention.
The embodiment of the invention can receive 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 content of the request 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 requesting the 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 of different sources can be processed at the same time, and the response content corresponding to the test requests of different sources can be generated. Therefore, the scheme can support a test team to carry out multi-person simultaneous test, and each test is not influenced mutually, so that the test efficiency is improved under the condition of ensuring that the tests are not interfered mutually.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1a is a schematic structural diagram of a test system according to an embodiment of the present invention;
FIG. 1b is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 1c is a diagram illustrating a predefined mapping relationship set structure provided in an embodiment of the present invention;
FIG. 1d is a schematic diagram of the relationship between predefined information and a test environment provided by an embodiment of the present invention;
FIG. 1e is a first structural diagram of a test environment set provided by an embodiment of the present invention;
FIG. 1f is a diagram illustrating a second structure of a test environment set according to an embodiment of the present invention;
FIG. 2a is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 2b is a schematic diagram of a first page of a test page provided in an embodiment of the present invention;
FIG. 2c is a schematic diagram of a second page of the test page provided in 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 illustrating 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 Mock testing process of a server in the testing system according to the embodiment of the present invention;
FIG. 4 is a schematic diagram of a first structure of a testing apparatus 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 technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a test method, a test device, electronic equipment and a storage medium.
An embodiment of the present invention provides a test system, including: the test equipment suitable for the client side and the test equipment suitable for the server side are provided by the embodiment of the invention.
Wherein, the server may be a server. Such as a single server, a cluster of servers consisting of multiple servers.
The client may be a terminal. For example, devices such as mobile phones, tablet computers, smart bluetooth devices, notebook computers, and Personal Computers (PCs).
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, and the following is introduced:
the server side: the server can receive a 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 content of the request 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.
A client: the client can display a test page; obtaining request content to be tested based on request editing operation of a user for a test page; 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 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 receiving and displaying the response content returned by the server.
Specifically, when a test is required, the client can display a test page, obtain the content of a request to be tested based on the request editing operation of a user for the test page, 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 inquire a target test environment according to request source information, and when the target test environment exists, the server can obtain 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 content of the request 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 use the response content.
The following are detailed below. The numbers in the following examples are not intended to limit the order of preference of the examples.
In this embodiment, a description will be given from the perspective of a testing apparatus, which may be specifically integrated in a server, and configured to perform a Mock test on a test request sent by a client, so as to obtain response content.
The Mock test means that for some objects which are not easy to construct and obtain, behaviors of the objects are simulated by creating the Mock objects, that is, a specific response corresponding to a certain request is assumed in advance, so that each time a client sends the request to a server, the server can send the response which is assumed in advance to the client, the client receives the response which is assumed in advance, and the behavior of generating a real response according to the certain request is simulated.
The server may be an electronic device, such as a server, a terminal, and the like. For example, the server may be a server, such as a single server, a server cluster, and the like. As another example, the terminal may be a mobile phone, a notebook computer, a personal computer, or the like.
As shown in fig. 1b, the specific flow of the test method may be as follows:
101. receiving a test request of a 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 a client to a server, and the request is used for requesting to perform software test. The test request may include request source information and content of the request to be tested.
The request source information refers to source information of a client or a user who initiates the request. The request source information may be a network address, an identity, a client geographic positioning information, and the like of the client initiating the test request, or may be user account information, user identity information, and the like used by the user initiating the test request to log in the client.
The content of the test request is specifically used for generating a test response in the test request, and the content of the test request may include software information of the software to be tested, information of a functional 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 is 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, and the like.
In some embodiments, the test environment may be constructed in advance for later providing a test environment for a test request from a different source, so before performing step 101, the following steps may be further included:
a. acquiring predefined information, wherein the predefined information can comprise predefined source information and predefined content;
b. inquiring a test environment corresponding to the predefined source information;
c. when a test environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the test environment according to predefined content;
d. and when the test environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the test 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 for representing the source of the predefined information, and the predefined content can be used for generating or updating a predefined mapping relation set corresponding to the test environment.
The predefined source information may be of various types, for example, the predefined source information may be a network address, an identity, a geographic location information of the client, and the like of the client, or may be user account information, user identity information, and the like used for logging in the client when the user performs the predefined.
The predefined mapping relation set may include at least one predefined mapping relation, the predefined mapping relation is a mapping relation between request content predefined by a user and response content predefined by the user, and the predefined request content, the predefined response content, and the mapping relation thereof may be carried by predefined information. For example, referring to fig. 1c, each test environment corresponds to a predefined mapping relationship set, where the mapping relationships between predefined request contents and predefined response contents in the predefined mapping relationship set may be in a one-to-one correspondence, or may be in a one-to-many, many-to-one, many-to-many, and so on, 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.
The method for obtaining the predefined information has various methods, for example, a user can set the predefined information on a client, and a server can obtain the predefined information by receiving the predefined information sent by the client; for another example, the server may communicate with a network server; as another example, by reading predefined information in local memory, and so on.
The predefined source information and the test environment may have a predefined mapping relationship therebetween, and it may be determined whether the test environment corresponding to the predefined source information exists by querying the test environment having the predefined mapping relationship with the predefined source information, for example, by querying a name, a number, an identifier, and the like of the test environment corresponding to a network address through the predefined source information, such as the network address of the client 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 there is no test environment corresponding to the predefined source information, a predefined mapping relationship set corresponding to the test environment may be generated according to the predefined content, for example, a new test environment is created, a name, a number, an identifier, and the like of the new test environment are named, and the name, the number, the identifier, and the like of the new test environment are associated with the predefined source information, such as a network address of the client.
For example, referring to fig. 1d, predefined information C is obtained, wherein the predefined information C may include predefined source information (i.e., network address C) and predefined content C. The server may query the test environment name associated with the network address C by looking up the test environment name from the network address C in 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. The 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 relationship set C corresponding to the test environment C is updated according to the predefined content C, and the predefined mapping relationship set C is updated to a predefined mapping relationship 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, and the predefined content may carry predefined request content, predefined response content, and a mapping relationship between the predefined request content and the predefined response content:
Figure BDA0002193055760000081
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 may include transport 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. 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 type of the Transmission Protocol is various, for example, a TCP/IP Protocol type (Transmission Control Protocol/Internet Protocol), a UDP Protocol type (User data Protocol), an IPX/SPX Protocol type (Internet Packet Exchange), and a User-defined Transmission Protocol type.
For example, the transport protocol types may include an HTTP (a protocol for transport using TCP) type, an svrkit (a protocol for transport using TCP or UDP) type, a logcsvr (a protocol for transport using HTTP) type, and so on.
The data packet parser is used for parsing the data packet encrypted by adopting transmission protocol encapsulation, and different transmission protocols can correspond to the proprietary data packet parser.
The packet parser may be understood as a section of algorithm code for decrypting a packet encrypted by a transmission protocol, for example, a packet encrypted by a TCP/IP protocol shown in table 2, and 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 message type sequence number (for example, the request type sequence number is 0x01), an acknowledgement number, a header length, a message content (for example, a request content to be detected), and the like from the packet.
Figure BDA0002193055760000091
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 can include at least one virtual test environment.
(2) And traversing the virtual test environments in the test environment set.
(3) And when the virtual test environment corresponding to the request source information exists in the test environment set, determining the virtual test environment corresponding to the request source information as a target test environment.
Referring to fig. 1e, the test environment set may include a virtual test environment 1, a virtual test environment 2, and a virtual test environment 3, each virtual test environment has corresponding request source information, and when a target test environment is to be queried according to the request source information, the virtual test environments in the test environment set are 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, and the virtual test environments with the same request source information are determined as the target test environment.
In some embodiments, in order to perform a mock test on different functional modules of software to be tested simultaneously without mutual interference, so as to further improve the testing efficiency, referring to fig. 1f, the test request may include information of the module to be tested, the target testing environment may include at least one module testing sub-environment, the predefined mapping relationship set may include at least one predefined mapping relationship sub-set, and after step 102, the following step may be further included:
and determining a target module testing sub-environment in the module testing sub-environment according to the information of the module to be tested.
The information of the module to be tested is information of the 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 state an identifier that uses the module to indicate the functionality of the module, i.e., what the module can do.
For example, the transmission module may include a receiving interface, a parsing interface, an encapsulating interface, a transmitting interface, and the like.
In some embodiments, in order to prevent a test stall caused by no suitable virtual service environment, when a suitable virtual service environment cannot be queried, the test may be performed by using a real test environment, so as to further improve the test efficiency, where the test environment may further include at least one real test environment, and after the step "traverse the virtual test environments in the test environment set", the following steps may be further included:
a. traversing the real test environment in the test environment set when the virtual test environment corresponding to the request source information does not exist 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 content of the request to be tested by adopting the real test environment to obtain real response content;
c. and sending the real response content to the client so that the client displays the real response content.
The method includes the steps that a real test environment is adopted to test the content of a request to be tested, and a plurality of modes of obtaining real response content are provided, for example, real test service is provided in a server, and the real test service is adopted to respond to the test request to obtain 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 network server sends the test request 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 from the network server, so as to obtain a real response content.
103. 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.
The method for obtaining the predefined mapping relationship set corresponding to the target test environment is various, for example, obtaining by reading a local memory, obtaining by communicating with a network server, obtaining by querying from a database, obtaining by user entry, and the like.
In some embodiments, in order to perform a mock test on different functional modules of the software to be tested simultaneously without mutual interference, so as to further improve the testing efficiency, in step 102, a target module testing sub-environment may be determined in the module testing sub-environment according to the information of the module 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 content of the request to be tested based on a 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 the 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 request content which is the same as the request content to be detected, 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 simultaneously without mutual interference, so as to further improve the testing efficiency, in step 103, a predefined mapping relationship subset corresponding to the target module testing sub-environment may be obtained, so step 104 may specifically include the following steps:
and determining target response content corresponding to the content of the request 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 applicability, the test request packet carrying the transport protocol type information is already obtained in step 101, so step 105 may specifically include the following steps:
a. inquiring a data packet wrapper corresponding to the transmission protocol type information to obtain the data packet wrapper;
b. packaging the target response content by adopting a data packet packaging device to obtain a test response data packet carrying the target response content;
c. and sending a test response data packet to the client.
The data packet 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 to generate an encrypted data packet. Different transport protocols may correspond to their proprietary packet encapsulators. For example, the TCP/IP protocol corresponds to a TCP/IP packet wrapper.
In some embodiments, in order to facilitate the user to query the test history, the test method may further include the steps of:
a. receiving a log query request of a client;
b. acquiring log data in a log database based on the log query request;
c. sending the log data to the client so that the client can display the log data;
the log data may include information such as test requests sent by the client at historical time and received response content.
For example, the log query request may include network address information of a client sending the log query request, and based on the network address information of the client, information such as test requests sent by the client at all historical times and received response contents may be queried in the log database.
In some embodiments, each time a test is completed, the data of the test may be saved in a log database for a user to query, so after sending the target response content to the client, the method further includes:
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 from 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 content of the request 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. Therefore, in the embodiment of the invention, the test requests from different sources can correspond to the unique test environments, and the unique test environments can be adopted to generate the test responses corresponding to the test requests. The scheme can simultaneously process the test requests from different sources, thereby improving the test efficiency.
In this embodiment, a description will be given from the perspective of a testing apparatus, which may be specifically integrated in a client, and configured to generate and send a test request to a server, and receive and display response content 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 client can obtain the request content to be tested edited in the request area by the user, send the request content to be tested to the server, 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 aiming at the test page.
For example, the content of the request to be tested may be obtained by uploading a Script (Script) carrying the test request by the user, or the content of the request to be tested may be obtained by selecting the request to be tested from preset test requests by the user, and the like.
For example, referring to fig. 2b, the request area may include an add request control, an add request edit control, a delete request control, a send request control, and so on. The user can create an added request by clicking the added request control and display a request editing page by clicking the request editing control, and 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, for example, referring to FIG. 2c, which may include an added predefined control, an added predefined editing control, a predefined deletion control, and so forth. The user can create an added predefined by clicking a new predefined control, and in the predefined editing control, the user can import or input predefined information, and the client can send the predefined information to the server.
203. And acquiring identity information.
The identity information may be identity information of the client, identity information of the user when the user logs in the user side, and the like.
For example, the identity information may be a network address of the client, an account number and a nickname of the user when the user logs in the client, and the like.
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 request content to be tested.
In some embodiments, in order to improve security, before transmitting the content of the request to be tested, the content of the request to be tested may be encrypted, and the test request may be carried by an encrypted test request data packet, where step 304 may specifically include the following steps:
a. acquiring transmission protocol type information and a data packet wrapper corresponding to the transmission protocol type information;
b. packaging the identity information, the request content to be tested and the transmission protocol type information according to a data packet packaging device to obtain a test request data packet;
c. and sending a test request data packet to the server.
The specific transmission protocol type information and the data packet wrapper corresponding to the transmission protocol type information may refer to step 101 and step 105, which are not described herein again.
205. And sending a test request to the server so that the server can generate 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 only 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 using a data packet analyzer to obtain response content;
d. and displaying the response content.
The packet parser corresponding to the transmission protocol type information may refer to step 101, which is not described herein.
Therefore, the embodiment of the invention can display the test page; obtaining request content to be tested based on request editing operation of a user for a test page; 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 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 receiving and displaying the response content returned by the server. In the scheme, the plurality of clients can simultaneously send the test requests carrying the identity information 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 a team test scene for performing Mock test (a test method) on software to be tested.
In this embodiment, a Mock test performed on software to be tested by a test team will be taken as an example to describe the scheme in detail.
As shown in fig. 3a, the present solution provides a test system, where the test system includes a client and a server, 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, page display functions such as a test page and a log query page; 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 query 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 storage medium such as a database and a local memory.
The scheme comprises the following flows:
and (I) 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 the newly added request control of the test page to generate a test request, and edit the content of the request to be tested by clicking the request editing control.
After the client acquires the request content to be tested, the client can package the request content to be tested and the network address of the client into a test request data packet according to a data packet wrapper corresponding to a preset transmission protocol.
For example, with the data packet 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 can obtain a corresponding data packet parser according to a transmission protocol preset by the server itself, and parse the test request data packet through the data packet parser to obtain request source information (i.e., a client network address) and request content to be tested.
For example, a packet parser may be used to parse custom protocol type encrypted test request packets, such as an application service (app server) type, a logical service (logic server) type, and so on.
And (III) the server side inquires the target test environment according to the network address of the client side.
Specifically, referring to fig. 3b, the server may distinguish the Mock test environment of the request according to the client network address. A plurality of sets of Mock testing environments can be defined in the Mock server, and the environments are mutually isolated.
It should be noted that the same source of requests can only correspond to one Mock test environment, but different sources of requests can correspond to the same Mock test environment.
And when the server inquires the Mock test environment corresponding to the client network address according to the client network address, starting the Mock test environment to serve as a target test environment.
When the server side cannot inquire the Mock test environment corresponding to the network address of the client side according to the network address of the client side, namely, the Mock test cannot be carried out, the server side can forward the test request data packet sent by the client side to the real application server of the application to be tested so as to carry out the application test.
For example, referring to fig. 3c, the test request packet may carry a client network address, and the server may traverse all the preset network addresses corresponding to the Mock test environment, for example, when the client network address is the network address A, Mock, and the preset network address corresponding to the test environment 1 is also the network address a, the Mock test environment 1 is started, and is determined as the target test environment.
And (IV) the server side acquires the predefined information of the client side and generates or updates a predefined mapping relation table.
In the scheme, a user can configure the predefined request, the predefined response and the 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 the network address of the client for performing the Mock test on the test request sent by the client.
For example, referring to fig. 3c, after the server obtains the predefined information of the client, 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 predefined request content, predefined response content, and mapping relation between the predefined request content and the predefined response content, which are predefined by the user.
For example, the predefined mapping 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 (V) the server matches the content of the request to be tested according to a predefined mapping relation table to obtain the target response content.
In the scheme, the server can traverse all the predefined request contents in the predefined mapping relation table, compare the predefined request contents with the request contents to be tested, find out the predefined request contents which are the same as 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, respectively, and when the content of the request to be tested is the same as the predefined request X, the predefined response X is used as the target response content.
And (VI) 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 way of packaging the target response content into the test response data packet by the server can be similar to the way of generating the test request data packet by the client; the client may receive the test response packet in a manner similar to the manner in which the server receives the test request packet sent by the client.
And the client analyzes the test response data packet to obtain target response content, and displays 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 occurrence time of the Mock test, the client information, the content of the request to be tested, the target response content, and other information as log data in the log database, and the user may obtain the log data from the log database by querying the page through the client log.
As can be seen from the above, in this embodiment, the client may display the test page, and generate the test request data 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 inquires a target test environment according to the network address of the client side; the server side obtains predefined information of the client side and generates or updates a predefined mapping relation table; the server matches the content of the request to be tested according to a 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, according to the scheme, a plurality of users can test certain application software at the same time, the application software is not interfered with each other, and the safety, the efficiency and the accuracy of the test are improved. The user can also configure predefined information on the test page, so that the test applicability and flexibility are improved. In addition, the scheme also supports various transmission protocol types and supports user-defined transmission protocol types, thereby further improving the applicability.
In order to better implement the above method, an embodiment of the present invention provides a testing apparatus, which is suitable for a server, and the testing apparatus may be specifically integrated in an electronic device, and the electronic device may be a terminal, a server, or other devices.
For example, in the present embodiment, a method according to an embodiment of the present invention will be described in detail from the perspective of a testing apparatus, taking as an example that the testing apparatus is specifically integrated in a server.
As shown in fig. 4, the testing apparatus may include a receiving unit 401, an environment unit 402, a mapping unit 403, a response unit 404, and a transmitting unit 405 as follows:
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, before receiving the test request of the client, may further be configured to:
a. acquiring predefined information, wherein the predefined information comprises predefined source information and predefined content;
b. inquiring a test environment corresponding to the predefined source information;
c. when a test environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the test environment according to predefined content;
d. and when the test environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the test 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.
(II) an environment 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.
The environment subunit is configured to obtain a test environment set, where the test environment set may include at least one virtual test environment.
(2) A virtual subunit.
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 after traversing the virtual test environments in the test environment set, the virtual sub-unit may be further specifically configured to:
a. traversing the real test environment in the test environment set when the virtual test environment corresponding to the request source information does not exist 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 content of the request to be tested by adopting the real test environment to obtain real response content;
c. and sending the real response content to the client so that the client displays the real response content.
In some embodiments, the test request may include information about the module 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 the 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 according to the request source information, may further be configured to:
and determining a target module testing sub-environment in the module testing sub-environment according to the information of the module to be tested.
And (iii) predefining a mapping relation unit 403.
A predefined mapping relation unit 403, configured to, when a target test environment exists, obtain 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 relationship unit 403 may specifically be configured to:
when the target module testing sub-environment exists, acquiring a predefined mapping relation sub-set corresponding to the target module testing sub-environment;
(IV) a response unit 404.
A response unit 404, configured to determine target response content corresponding to the requested content to be tested based on the predefined mapping relationship 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 to:
and determining target response content corresponding to the content of the request to be tested based on the predefined mapping relation subset corresponding to the target module testing sub-environment.
(five) a transmission unit 405.
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 packet wrapper corresponding to the transmission protocol type information to obtain the data packet wrapper;
b. packaging the target response content by adopting a data packet packaging device to obtain a test response data packet carrying the target response content;
c. and sending a test response data packet to the client.
In some embodiments, the testing apparatus may further comprise a logging unit, the logging unit may be configured to:
a. receiving a log query request of a client;
b. acquiring log data in a log database based on the log query request;
c. sending the log data to the client so that the client can display 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 a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
As can be seen from the above, the test apparatus of the embodiment receives, by the receiving unit, a test request from the client, where the test request includes request source information and 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 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 content of the request to be tested by the response unit based on a predefined mapping relation set corresponding to the target test environment; and sending the target response content to the client by the sending unit so that the client displays the target response content. The scheme can improve the test efficiency.
In order to better implement the above method, an embodiment of the present invention further provides a testing apparatus correspondingly, which is suitable for a client, and the testing apparatus may be specifically integrated in an electronic device, and the electronic device may be a terminal, such as a mobile phone, a notebook computer, a tablet computer, a personal computer, and the like.
For example, in the present embodiment, the method of the present invention will be described in detail by taking the test apparatus as an example integrated in a notebook computer.
As shown in fig. 5, the testing apparatus may include a page unit 501, an editing unit 502, an obtaining unit 503, a generating unit 504, a requesting unit 505, and a display unit 506 as follows:
page unit 501.
And a page unit 501, configured to display a test page.
And (ii) an editing unit 502.
The editing unit 502 is configured to obtain a content of a request to be tested based on a request editing operation of a user for a test page.
(iii) an acquisition unit 503.
An obtaining unit 503 is configured to obtain the identity information.
(iv) a generating unit 504.
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.
The test request may include a test request data packet, and the generating unit 504 may specifically be configured to:
acquiring transmission protocol type information and a data packet wrapper corresponding to the transmission protocol type information;
packaging the identity information, the request content to be tested and the transmission protocol type information according to a data packet packaging device to obtain a test request data packet;
and sending a test request data packet to the server.
(five) 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.
(sixth) a display unit 506.
And the display unit 506 is used for receiving and displaying the response content returned by the server.
The display unit 506 may be specifically 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 using a data packet analyzer to obtain response content;
and displaying the response content.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
In view of the above, the test device of the present embodiment displays the test page on the page; the editing unit obtains the content of the request to be tested based on the request editing operation of the user for the test page; acquiring identity information by an acquisition unit; generating a test request by the 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 can generate response content corresponding to the content of the request to be tested according to the identity information; and receiving and displaying the response content returned by the server by the display unit. The scheme can improve the test efficiency.
The embodiment of the invention also provides the electronic equipment which can be equipment such as a terminal, a server and the like.
For example, the terminal may be a mobile phone, a tablet computer, an intelligent bluetooth device, a notebook computer, a personal computer, or the like; 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 by taking an example in which the electronic device of this embodiment is a server, for example, as shown in fig. 6, which shows a schematic structural diagram of a server according to an embodiment of the present invention, specifically:
the server may include components such as a processor 601 of one or more processing cores, memory 602 of one or more computer-readable storage media, a power supply 603, an input module 604, and a communication module 605. Those skilled in the art will appreciate that the server architecture shown in FIG. 6 is not meant to be limiting, and may include more or fewer components than those shown, or some components may be combined, 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, thereby performing overall monitoring of the server. In some embodiments, processor 601 may include one or more processing cores; in some embodiments, processor 601 may integrate an application processor that handles primarily operating systems, user pages, applications, etc. and a modem processor that handles primarily 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 executes various functional applications and data processing by operating the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the server, and the like. Further, 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 the processor 601 with access to the memory 602.
The server also includes a power supply 603 for providing power to the various components, and in some embodiments, the power supply 603 may be logically connected to the processor 601 through a power management system, so that functions such as managing charging, discharging, and power consumption are performed through the power management system. The power supply 603 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The server may also include an input module 604, the input module 604 being operable to receive entered numeric or character information and 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, through which the server may wirelessly transmit over short distances to provide wireless broadband internet access to the user. For example, the communication module 605 may be used to assist a user in emailing, browsing web pages, accessing streaming media, and the like.
Although not shown, the server may further include a display unit and the like, which will not be described in detail herein. Specifically, in this embodiment, the processor 601 in the server loads the executable file corresponding to the process of one or more application programs into the memory 602 according to the following instructions, and the processor 601 runs the application programs stored in the memory 602, thereby implementing 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 content of the request 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 above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
As can be seen from the above, the embodiment of the present invention receives a test request from 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 content of the request 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. This scheme can promote efficiency of software testing.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the testing methods provided by the embodiment 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 content of the request 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), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any test method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any test method provided in the embodiments of the present invention can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The above detailed description is provided for a testing method and device provided by the embodiments of the present invention, and the principle and the implementation of the present invention are explained by applying specific examples, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (8)

1. A method of testing, comprising:
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 displays the target response content.
2. The testing method of claim 1, wherein said querying a target test environment based on said request source information comprises:
acquiring a test environment set, wherein the test environment set comprises at least one virtual test environment;
traversing virtual test environments in the test environment set;
and when the virtual test environment corresponding to the request source information exists in the test environment set, determining the virtual test environment corresponding to the request source information as a target test environment.
3. The testing method of claim 2, wherein the testing environment further comprises at least one real testing environment, and after traversing the virtual testing environments in the set of testing environments, further comprising:
traversing a real test environment in the test environment set when the virtual test environment corresponding to the request source information does not exist in the test environment set;
when a real test environment corresponding to the request source information exists in the test environment set, testing the content of the request 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 testing 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 using the data packet analyzer to obtain request source information and request content;
the sending the target response content to the client comprises:
inquiring a data packet wrapper corresponding to the transmission protocol type information to obtain the data packet wrapper;
packaging the target response content by adopting the data packet packaging device to obtain a test response data packet carrying the target response content;
and sending the test response data packet to the client.
5. The testing method of claim 1, wherein the test request includes information of a module to be tested, the target testing environment includes at least one module testing sub-environment, the predefined set of mapping relationships includes at least one predefined subset of mapping relationships;
after querying the target test environment according to the request source information, the method further includes:
determining a target module testing sub-environment in the module testing sub-environment according to the information of the module to be tested;
when the target test environment exists, acquiring a predefined mapping relationship set corresponding to the target test environment, including:
when the target module testing sub-environment exists, acquiring a predefined mapping relation sub-set 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 includes:
and determining target response content corresponding to the request content to be tested based on a predefined mapping relation subset corresponding to the target module testing sub-environment.
6. The testing method of claim 1, wherein prior to receiving the test request from the client, further comprising:
acquiring predefined information, wherein the predefined information comprises predefined source information and predefined content;
inquiring a test environment corresponding to the predefined source information;
when a test environment corresponding to the predefined source information exists, updating a predefined mapping relation set corresponding to the test environment according to the predefined content;
and when the test environment corresponding to the predefined source information does not exist, generating a predefined mapping relation set corresponding to the test 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 in a log database based on the log query request;
sending the log data to a client so that the client can display 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 saving the log data in a log database.
8. A test apparatus, comprising:
the system comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a test request of a client, and the test request comprises request source information and request content to be tested;
the environment unit is used for inquiring a target test environment according to the request source information;
the predefined mapping relation unit is used for acquiring a predefined mapping relation set corresponding to the target testing environment when the target testing environment exists, 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;
a response unit, configured to determine target response content corresponding to the requested content to be tested based on a predefined mapping relationship 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.
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 true CN112445700A (en) 2021-03-05
CN112445700B 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)

Cited By (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
CN113608994A (en) * 2021-06-30 2021-11-05 天津五八到家货运服务有限公司 Request processing method and system
CN114238099A (en) * 2021-12-09 2022-03-25 北京五八信息技术有限公司 Method and device for gray scale test, electronic equipment and readable medium
CN116701470A (en) * 2023-08-07 2023-09-05 舟谱数据技术南京有限公司 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

Cited By (5)

* 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
CN113608994A (en) * 2021-06-30 2021-11-05 天津五八到家货运服务有限公司 Request processing method and system
CN114238099A (en) * 2021-12-09 2022-03-25 北京五八信息技术有限公司 Method and device for gray scale test, electronic equipment and readable medium
CN116701470A (en) * 2023-08-07 2023-09-05 舟谱数据技术南京有限公司 Method and device for reproducing customer problems under medium rack, electronic equipment and medium
CN116701470B (en) * 2023-08-07 2023-10-13 舟谱数据技术南京有限公司 Method and device for reproducing customer problems under medium rack, electronic equipment and medium

Also Published As

Publication number Publication date
CN112445700B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
CN112445700B (en) Test method and device
US20220294850A1 (en) Cloud storage methods and systems
CN110247784B (en) Method and device for determining network topology structure
CN107426335B (en) System capable of automatically generating cloud environment configuration file and use method
CN108370379A (en) With cunicular equipment management
WO2020048453A1 (en) Network element management method and apparatus, system and storage medium
US20170289243A1 (en) Domain name resolution method and electronic device
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) A kind of cut-in method of WLAN, device and storage medium
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN110557284A (en) data aggregation method and device based on client gateway
CN106453349B (en) Account login method and device
CN104506450A (en) Media resource feedback method and device
CN110933170A (en) Multi-device linkage control method and device of ZigBee gateway and storage medium
CN111585786A (en) Realization of secret-free building method of big data cluster
US9350738B2 (en) Template representation of security resources
CN104052679A (en) Load balancing method and device for network flow
US9769332B1 (en) Camera intercept device
CN103491153A (en) Method, equipment and peer-to-peer network system for data sharing
US20150039917A1 (en) Information processing device, activation method, and computer program product
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
TWI735633B (en) Data transmission method, equipment, device and system
CN110943962B (en) Authentication method, network equipment, authentication server and forwarding equipment

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