CN111224834B - Simulation test method, simulation test device, server and storage medium - Google Patents

Simulation test method, simulation test device, server and storage medium Download PDF

Info

Publication number
CN111224834B
CN111224834B CN201911128940.8A CN201911128940A CN111224834B CN 111224834 B CN111224834 B CN 111224834B CN 201911128940 A CN201911128940 A CN 201911128940A CN 111224834 B CN111224834 B CN 111224834B
Authority
CN
China
Prior art keywords
data transmission
request
test
configuration information
rule
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
CN201911128940.8A
Other languages
Chinese (zh)
Other versions
CN111224834A (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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201911128940.8A priority Critical patent/CN111224834B/en
Publication of CN111224834A publication Critical patent/CN111224834A/en
Application granted granted Critical
Publication of CN111224834B publication Critical patent/CN111224834B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a simulation test method, a simulation test device, a server and a storage medium, and belongs to the technical field of communication. The method comprises the following steps: receiving a data transmission request sent by a first terminal, and determining a test rule set associated with the data transmission request according to the data transmission request; acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, extracting an encryption field of the data transmission request according to an encryption field identifier corresponding to the first encryption rule; decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request; and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal. The method and the device can flexibly carry out decryption processing in different modes aiming at different data transmission requests in the process of simulation test.

Description

Simulation test method, simulation test device, server and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a simulation test method, an apparatus, a server, and a storage medium.
Background
Before the client comes online, the client generally needs to be tested. When testing the client, the assistance of the server is needed; in order not to influence the normal operation of the server, the client side can be assisted in testing by simulating the testing server. The client on the terminal sends the request which should be sent to the server to the simulation test server, and receives the data returned by the simulation test server according to the request, so that the client is tested.
Disclosure of Invention
The embodiment of the application provides a simulation test method, a simulation test device, a server and a storage medium, which can decrypt an encrypted data transmission request in a simulation test process and dynamically return a corresponding data transmission response. The technical scheme is as follows:
according to an aspect of an embodiment of the present application, there is provided a simulation test method, including:
receiving a data transmission request sent by a first terminal, and determining a test rule set associated with the data transmission request according to the data transmission request;
acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, extracting an encryption field of the data transmission request according to an encryption field identifier corresponding to the first encryption rule;
decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request;
and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal.
In a possible implementation manner, before the obtaining the first configuration information corresponding to the test rule set, the method further includes:
receiving the first configuration information sent by a second terminal, wherein the first configuration information comprises a first encryption rule of the data transmission request;
and associating the test rule set with the first configuration information.
In another possible implementation manner, the determining a data transmission response corresponding to the request parameter includes:
determining a test rule corresponding to the request parameter from a test rule set according to the request parameter, wherein the test rule comprises request body data and response body template data;
determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters;
and adding the target request data into the target response body template to obtain the data transmission response.
In another possible implementation manner, before determining, according to the request parameter, a test rule corresponding to the request parameter from a test rule set, the method further includes:
receiving the request parameters and the test rules sent by a second terminal;
associating the request parameters with the test rules.
In another possible implementation manner, the sending the data transmission response to the first terminal includes:
if the second configuration information corresponding to the test rule set comprises a second encryption rule of the data transmission response, encrypting the data transmission response according to the second encryption rule;
and sending the encrypted data transmission response to the first terminal.
In another possible implementation manner, if the second configuration information includes a second encryption rule for the simulated return data, before encrypting the simulated return data according to the second encryption rule, the method further includes:
receiving second configuration information sent by a second terminal, wherein the second configuration information comprises a second encryption rule of the data transmission response;
and associating the test rule set with the second configuration information.
According to another aspect of embodiments of the present application, there is provided a simulation test apparatus, the apparatus including:
the receiving module is configured to receive a data transmission request sent by a first terminal;
a determination module configured to determine a set of test rules associated with the data transmission request according to the data transmission request;
the acquisition module is configured to acquire first configuration information corresponding to the test rule set;
the decryption module is configured to extract an encrypted field of the data transmission request according to an encrypted field identifier corresponding to a first encryption rule if the first configuration information includes the first encryption rule of the data transmission request; decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request;
the determining module is further configured to determine a data transmission response corresponding to the request parameter;
a sending module configured to send the data transmission response to the first terminal.
In one possible implementation, the apparatus further includes:
the receiving module is further configured to receive the first configuration information sent by a second terminal, where the first configuration information includes a first encryption rule of the data transmission request;
a first association module configured to associate the set of test rules with the first configuration information.
In another possible implementation manner, the determining module is further configured to determine, according to the request parameter, a test rule corresponding to the request parameter from a test rule set, where the test rule includes request body data and response body template data;
determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters; and adding the target request data into the target response body template to obtain the data transmission response.
In another possible implementation manner, the apparatus further includes:
the receiving module is further configured to receive the request parameter and the test rule sent by the second terminal;
a second association module configured to associate the request parameter with the test rule.
In another possible implementation manner, the sending module is further configured to encrypt the data transmission response according to a second encryption rule if second configuration information corresponding to the test rule set includes the second encryption rule of the data transmission response; and sending the encrypted data transmission response to the first terminal.
In another possible implementation manner, the apparatus further includes:
the receiving module is further configured to receive second configuration information sent by a second terminal, where the second configuration information includes a second encryption rule of the data transmission response;
a third association module configured to associate the set of test rules with the second configuration information.
According to another aspect of the embodiments of the present application, there is provided a server, which includes a processor and a memory, where at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor to implement the simulation testing method according to any one of the above-mentioned possible implementation manners.
According to another aspect of the embodiments of the present application, there is provided a computer-readable storage medium having at least one program code stored therein, the at least one program code being loaded and executed by a processor to implement the simulation testing method according to any one of the above-mentioned possible implementation manners.
In the embodiment of the application, in the process of carrying out simulation test on a client on a first terminal, a server receives a data transmission request sent by the first terminal and determines a test rule set associated with the data transmission request; acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, decrypting the data transmission request according to the first encryption rule to obtain a request parameter of the data transmission request; and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal. According to the method and the device, the first configuration information comprising the first encryption rule is added, and different data transmission requests correspond to different first configuration information, so that the first encryption rule can be configured, and therefore different decryption modes can be flexibly performed on different data transmission requests in the process of simulation test.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the present application;
FIG. 2 is a flow chart of a simulation test method provided by an embodiment of the present application;
FIG. 3 is a flow chart of a simulation test method provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a simulation testing method provided in an embodiment of the present application;
FIG. 5 is a block diagram of an analog testing apparatus according to an embodiment of the present disclosure;
fig. 6 is a block diagram of a server according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
Fig. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. Referring to fig. 1, the implementation environment includes a first terminal 101 and a server 102; the first terminal 101 and the server 102 are connected via a wireless or wired network. Moreover, a first client that the server 102 provides services may be installed on the first terminal 101, and a user corresponding to the first terminal 101 may implement functions such as data transmission and message interaction through the first client.
The first terminal 101 may be a computer, a mobile phone, a tablet computer or other electronic devices. The user corresponding to the first terminal 101 may be a test developer. The first client may be a client that needs to perform a simulation test. A user corresponding to the first terminal 101 performs a simulation test on the first client through the first terminal 101. For example, the first client may be any client installed on the first terminal 101 that needs to be subjected to the simulation test.
The server 102 provides a simulation test service for the first client, and the server 102 may be a simulation test server. When a first client needing to be tested is tested, the first client sends a data transmission request to the server 102, and the server 102 assists the first client in testing.
The implementation environment further comprises a second terminal 103, and the second terminal 103 and the server 102 are connected through a wireless or wired network. Moreover, a second client that the server 102 provides services may be installed on the second terminal 103, and a user corresponding to the second terminal 103 may implement functions such as data transmission and message interaction through the second client.
The second terminal 103 may be a computer, a mobile phone, a tablet computer or other electronic devices. The user corresponding to the second terminal 103 may also be a test developer. The user corresponding to the second terminal 103 may perform configuration of the test rule set and the configuration information through the second client. The second client may be a configuration-only client.
It should be noted that the first terminal 101 and the second terminal 103 may be the same terminal, and accordingly, a user corresponding to the terminal may test the first client on the same terminal and configure the test rule set and the configuration information. The first terminal 101 and the second terminal 103 may also be different terminals. Correspondingly, the user tests the first client on one terminal and configures the test rule set and the configuration information on the other terminal.
Fig. 2 is a flowchart of a simulation test method according to an embodiment of the present application. Referring to fig. 2, the embodiment includes:
201. the server receives a data transmission request sent by the first terminal, and determines a test rule set associated with the data transmission request according to the data transmission request.
202. The server obtains first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, extracts an encryption field of the data transmission request according to an encryption field identifier corresponding to the first encryption rule.
203. And the server decrypts the encrypted field through the encryption algorithm corresponding to the first encryption rule according to the key corresponding to the first encryption rule to obtain the request parameter corresponding to the data transmission request.
204. And the server determines a data transmission response corresponding to the request parameter and sends the data transmission response to the first terminal.
In the embodiment of the application, in the process of carrying out simulation test on a client on a first terminal, a server receives a data transmission request sent by the first terminal and determines a test rule set associated with the data transmission request; acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, decrypting the data transmission request according to the first encryption rule to obtain a request parameter of the data transmission request; and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal. According to the method and the device, the first configuration information comprising the first encryption rule is added, and different data transmission requests correspond to different first configuration information, so that the first encryption rule can be configured, and therefore different decryption modes can be flexibly performed on different data transmission requests in the process of simulation test.
In a possible implementation manner, before obtaining the first configuration information corresponding to the test rule set, the method further includes:
receiving first configuration information sent by a second terminal, wherein the first configuration information comprises a first encryption rule of a data transmission request;
and associating the test rule set with the first configuration information.
In another possible implementation manner, determining a data transmission response corresponding to the request parameter includes:
according to the request parameters, determining test rules corresponding to the request parameters from the test rule set, wherein the test rules comprise request body data and response body template data;
determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters;
and adding the target request data into the target response body template to obtain a data transmission response.
In another possible implementation manner, before determining, according to the request parameter, the test rule corresponding to the request parameter from the test rule set, the method further includes:
receiving a request parameter and a test rule sent by a second terminal;
request parameters and test rules are associated.
In another possible implementation manner, the sending the data transmission response to the first terminal includes:
if the second configuration information corresponding to the test rule set comprises a second encryption rule of the data transmission response, encrypting the data transmission response according to the second encryption rule;
the encrypted data transmission response is sent to the first terminal.
In another possible implementation manner, if the second configuration information includes a second encryption rule for the analog return data, before encrypting the analog return data according to the second encryption rule, the method further includes:
receiving second configuration information sent by a second terminal, wherein the second configuration information comprises a second encryption rule of the data transmission response;
and associating the test rule set with the second configuration information.
Fig. 3 is a flowchart of a simulation test method according to an embodiment of the present application. Referring to fig. 3, the embodiment includes:
301: the first terminal sends a data transmission request to the server.
When a first client on the first terminal needs to be tested, the first terminal sends a data transmission request to the server, and the data transmission request is used for requesting to call corresponding data from the server. For example, when testing a first client's query service; the data transmission request may be a request for requesting the server to query data, that is, the data transmission request is a data query request.
The first client may be a client that needs to perform a simulation test, that is, a service party corresponding to the server, and the service party may be an upstream service party corresponding to the server. The server may be a server that provides simulation test services, for example, the server may be qmk (a test data simulation platform) backend.
Fig. 4 is a schematic diagram of a simulation testing method according to an embodiment of the present application, and referring to fig. 4, a first client on a first terminal establishes communication with a server through a request and response mechanism. When the first client needs to request the server for calling data, a data transmission request needs to be sent to the server through the first terminal. The server may return a corresponding data transmission response to the first client on the first terminal according to the data transmission request sent by the first terminal. For example, the server may provide a service of data query for the first client, the first client on the first terminal sends a data transmission request to the server, the data transmission request is used for requesting the server to query data, and the server may query the data according to the data transmission request and return the queried data to the first client on the first terminal through a data transmission response.
It should be noted that the data transmission request carries a request parameter, and the request parameter may be an encrypted request parameter or an unencrypted request parameter.
302: the server receives a data transmission request sent by the first terminal, and determines a test rule set associated with the data transmission request according to the data transmission request.
The test rule set is a rule set by the server to assist the first client in testing. Different data transmission requests correspond to different sets of test rules. The test rule set comprises at least one test rule, and the test rule comprises request body data and response body template data corresponding to request parameters of the data transmission request.
The server may determine the test rule set corresponding to the data transmission request according to a Uniform Resource Locator (URL) in the data transmission request. Correspondingly, the step of determining, by the server, the test rule set associated with the data transmission request according to the data transmission request may be: the server determines the URL of the data transmission request from the data transmission request, and determines the test rule set corresponding to the data transmission request according to the URL of the data transmission request.
The data transmission request may be an http (hypertext Transfer Protocol) request message, the data transmission request may also be an FTP (File Transfer Protocol) request, the data transmission request may also be an SMTP (Simple Mail Transfer Protocol) request, and in this embodiment, the data transmission request is not specifically limited. The embodiment of the present application takes an example in which the data transmission request is an http request message.
303: the server obtains first configuration information corresponding to the test rule set, and decrypts the data transmission request according to a first encryption rule if the first configuration information comprises the first encryption rule of the data transmission request, so as to obtain a request parameter of the data transmission request.
The data transmission request sent by the first terminal to the server may be an encrypted data transmission request or an unencrypted data transmission request. When a data transmission request sent by a first terminal to a server carries data to be encrypted, the first terminal needs to encrypt the data transmission request. For example, when the data transmission request needs to carry private data such as user information or a bank account, the data transmission request needs to be encrypted. When the data transmission request sent by the first terminal to the server carries data which does not need to be encrypted, the data transmission request does not need to be encrypted. The encryption of the data transmission request is also the encryption of the request parameter in the data transmission request.
When the data transmission request received by the server is an encrypted data transmission request, the server may decrypt the encrypted data transmission request according to the first encryption rule. When the data transmission request received by the server is an unencrypted data transmission request, the server does not need to execute the step of decrypting the data transmission request according to the first encryption rule to obtain the request parameter of the data transmission request. The server may extract the request parameters directly from the data transfer request.
The request parameter is a part of the data transmission request, the request parameter may include an identifier of data to be requested by the data transmission request, and the server may be capable of determining the data to be returned to the first terminal according to the request parameter in the data transmission request. For example, the data transmission request is used for requesting to query the balance of a bank account, request parameters of the data transmission request include the bank account and an identifier for indicating a return balance, and the server can return the balance of the bank account to the first terminal according to the bank account and the identifier for indicating the return balance in the request parameters.
The first encryption rule may correspond to an encryption field identifier, an encryption algorithm, and a key, and the server may decrypt the data transmission request through the encryption field identifier, the encryption algorithm, and the key. Correspondingly, the step of decrypting, by the server, the data transmission request according to the first encryption rule to obtain the request parameter of the data transmission request may be: the server extracts an encrypted field of the data transmission request according to the encrypted field identification corresponding to the first encryption rule; and decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to the key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request.
The encrypted field identification is used to identify where the encrypted field is located in the data transfer request. When the data transmission request is an http request message, the data transmission request is different types of http request messages, and the positions of the encryption fields of the data transmission request are different. The server may determine a position of the encrypted field of the data transmission request according to the encrypted field identifier in the first encryption rule corresponding to the data transmission request, and extract the encrypted field of the data transmission request from the position.
Correspondingly, the step of extracting the encrypted field of the data transmission request by the server according to the encrypted field identifier may be: the server determines the position of the encrypted field in the data transmission request according to the encrypted field identifier; and extracting the encrypted field of the data transmission request from the position according to the position of the encrypted field in the data transmission request. For example, if the data transmission request is a get (receive) request, the encrypted field is identified as "a", which indicates that the encrypted field is in the request header of the http request message, the server extracts the encrypted field from the request header of the data transmission request according to the encrypted field identification "a". For another example, if the data transmission request is a post request, and the encrypted field identifier is "B", which indicates that the encrypted field is in the request body of the http request packet, the server extracts the encrypted field from the request body of the data transmission request according to the encrypted field identifier "B".
When the data transmission request is an http request message, the encryption algorithm may be a symmetric encryption algorithm, and the encryption algorithm may also be an asymmetric encryption algorithm. The present embodiment is not particularly limited. For example, when the encryption algorithm is a symmetric encryption algorithm, the key used for encryption by the first terminal is the same as the key used for decryption by the server. The server can decrypt the encrypted field through an encryption algorithm directly according to the secret key to obtain the request parameter corresponding to the data transmission request. For another example, when the encryption algorithm is an asymmetric encryption algorithm, the secret key includes a public key and a private key, and the first terminal may encrypt the data transmission request by using the public key. The server decrypts the encrypted field with a private key corresponding to the public key.
With continued reference to fig. 4, the storage data of the server stores therein encryption/decryption configuration data, which may be the first configuration information. The encrypted field is the encrypted request parameter, and the request parameter is the decrypted request parameter. The server decrypts the data transmission request according to the first encryption rule in the first configuration information to obtain the request parameter of the data transmission request, that is, the server obtains the first encryption rule from the encryption and decryption configuration data, and performs decryption processing on the request parameter according to the first encryption rule to obtain the decrypted request parameter.
In the embodiment of the application, the server can decrypt the encrypted data transmission request according to the encrypted field identifier, the encryption algorithm and the secret key, so that the request parameter in the data transmission request can be still analyzed in the test scene of the data transmission request encryption, the content of the data transmission request requested by the server is determined, and the test is more real.
The server may obtain the first configuration information corresponding to the test rule set according to the association relationship between the test rule set and the first configuration information. The server may be configured with an association relationship between the test rule set and the first configuration information, and the server further supports the user to configure the first configuration information corresponding to the test rule set. The user may be a test developer, and the user may configure a first encryption rule corresponding to the user for the data transmission request through a second client on the second terminal. Accordingly, the process of the server supporting the user configuration may be: a user configures a first encryption rule corresponding to the data transmission request for the data transmission request through a second client on a second terminal; the second terminal sends the first encryption rule configured by the user to the server as first configuration information; the server receives first configuration information sent by the second terminal, wherein the first configuration information comprises a first encryption rule of the data transmission request, and the server associates the test rule set with the first configuration information. With continued reference to fig. 4, the second client may be the qmk front end, the user may configure the first configuration information through a configuration module in the second client, the second client sends the first configuration information to the server, and the server may store the first configuration information in the storage data.
In the embodiment of the application, the server can flexibly configure the encryption rule corresponding to the data transmission request according to the data transmission request, so that different decryption modes can be flexibly performed according to different data transmission requests.
304: and the server determines the data transmission response corresponding to the request parameter.
The data transmission response is a response of the server to the data transmission request sent by the first terminal. For example, when the data transmission request is an http request message, the data transmission response is an http response message corresponding to the http request message.
With reference to fig. 4, the request body data and the response body template data are stored in the storage data of the server, and the server may determine the data transmission response corresponding to the request parameter directly according to the request parameter and the stored request body data and response body template data. Correspondingly, the step of determining, by the server, the data transmission response corresponding to the request parameter may be: the server determines a test rule corresponding to the request parameter from the test rule set according to the request parameter, wherein the test rule comprises request body data and response body template data; determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters; and adding the target request data into the target response body template to obtain a data transmission response.
For example, the data transmission request to be tested is used for requesting the server to query the balance of a bank account, and the request parameters of the data transmission request include the bank account and an identifier for indicating the query balance. The step of the server determining the data transmission response corresponding to the request parameter may be: the server determines a test rule corresponding to the request parameter from the test rule set according to the request parameter, wherein the test rule comprises request body data and response body template data; target request data corresponding to the request parameter is determined from the request body data, and the target request data can be a numerical value. The server needs to encapsulate the target request data in the data transmission response according to the communication protocol, and return the data transmission response to the first terminal. Correspondingly, the server can determine a target response body template corresponding to the request parameter from the response body template data according to the request parameter; the target response body template may be a response body template of an http response message, and the server may add the target request data to the target response body template to obtain a data transmission response.
In the embodiment of the application, the server can directly determine the data transmission response corresponding to the data transmission request according to the stored request body data and the response body template data, and the test efficiency is higher.
With continued reference to fig. 4, the target request data is mock content that the server needs to return to the first terminal. The server can determine target request data corresponding to the request parameters from the request body data by a regular matching method. Correspondingly, the step of determining, by the server, the target request data corresponding to the request parameter from the request body data according to the request parameter may be: and the server performs regular matching on the request parameters and the request body data, and takes out target request data matched with the request parameters from the request body data.
In the embodiment of the application, the server can dynamically match mock content corresponding to the data transmission request in a regular matching manner and return the mock content to the service party. Instead of only returning a random data transmission response, the test scene can be simulated more truly.
With continued reference to fig. 4, the server may be configured with request volume data and response template data, and the server may also support the user to configure the request volume data and the response template data. The server can perform regular matching on the decrypted request parameters and the request body data, and acquire target request data from the request body data.
The user may be a test developer when the server supports the user to configure the request volume data and the response volume template data. Before the simulation test is performed, a user can configure a test rule corresponding to a request parameter of a data transmission request to be tested through a second client on a second terminal, wherein the test rule comprises request body data and response body template data. Accordingly, the process of the server supporting the user configuration may be: a user configures a test rule corresponding to a request parameter of a data transmission request to be tested through a second client on a second terminal; the second terminal sends the request parameters configured by the user and the test rules corresponding to the request parameters to the server; the server receives a request parameter sent by the second terminal and a test rule corresponding to the request parameter; and the server associates the request parameters and the test rules corresponding to the request parameters. With continued reference to fig. 4, the second client may be an qmk front end, the user may configure the request body data and the response body template data through the second client, the second client transmits the request body data and the response body template data configured by the user to the server, and the server may store the request body data and the response body template data in the storage data.
305: the server sends the data transmission response to the first terminal.
In one possible implementation, the server may send the data transmission response directly to the first terminal.
In another possible implementation manner, the server may further send the encrypted data transmission response to the first terminal according to the configuration for encrypting the data transmission response. Correspondingly, the step of sending the data transmission response to the first terminal by the server may further be: if the second configuration information corresponding to the test rule set comprises a second encryption rule of the data transmission response, the server encrypts the data transmission response according to the second encryption rule; the encrypted data transmission response is sent to the first terminal.
The step of encrypting the data transmission response by the server according to the second encryption rule is similar to the step of decrypting the data transmission request by the server according to the first encryption rule, and is not described herein again.
Continuing to refer to fig. 4, the server obtains the target request data from the request body data through regular matching, obtains the target response template corresponding to the data transmission request from the response body template data, adds the target request data to the target response template, and determines the data transmission response. The data transmission response is the return content of the mock. The server may encrypt the returned content according to the configuration, that is, if the server has the second configuration information, the server encrypts the returned content according to the second encryption rule in the second configuration information.
In this embodiment, the server may further encrypt the returned content according to the configuration, and transmit the encrypted content to the service party. Therefore, the scene that the client on the first terminal receives the encrypted data transmission response can be tested, and the test is more comprehensive.
The server may obtain the second configuration information corresponding to the test rule set according to the association relationship between the test rule set and the second configuration information. The server may be configured with an association relationship between the test rule set and the second configuration information, and the server further supports the user to configure the second configuration information. The user may be a test developer, and the user may configure a second encryption rule corresponding to the user for the data transmission request through a second client on the second terminal. Accordingly, the process of the server supporting the user configuration may be: the user configures a second encryption rule corresponding to the data transmission request for the data transmission request through a second client on a second terminal; the second terminal sends the second encryption rule configured by the user to the server as second configuration information; the server receives second configuration information sent by the second terminal, wherein the second configuration information comprises a second encryption rule of the data transmission request, and the server associates the test rule set with the second configuration information.
In the embodiment of the application, the server can flexibly configure the encryption rule corresponding to the data transmission response according to the data transmission request, so that different modes of encryption processing can be flexibly performed according to different data transmission responses.
In the embodiment of the application, in the process of carrying out simulation test on a client on a first terminal, a server receives a data transmission request sent by the first terminal and determines a test rule set associated with the data transmission request; acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, decrypting the data transmission request according to the first encryption rule to obtain a request parameter of the data transmission request; and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal. According to the method and the device, the first configuration information comprising the first encryption rule is added, and different data transmission requests correspond to different first configuration information, so that the first encryption rule can be configured, and therefore different decryption modes can be flexibly performed on different data transmission requests in the process of simulation test.
All the above optional technical solutions may be combined arbitrarily to form optional embodiments of the present application, and are not described herein again.
Fig. 5 is a schematic structural diagram of a simulation test apparatus according to an embodiment of the present application. Referring to fig. 5, the apparatus includes:
a receiving module 501 configured to receive a data transmission request sent by a first terminal;
a determining module 502 configured to determine, according to the data transmission request, a set of test rules associated with the data transmission request;
an obtaining module 503 configured to obtain first configuration information corresponding to the test rule set;
the decryption module 504 is configured to, if the first configuration information includes a first encryption rule of the data transmission request, extract an encryption field of the data transmission request according to an encryption field identifier corresponding to the first encryption rule; decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request;
a determining module 502, further configured to determine a data transmission response corresponding to the request parameter;
a sending module 505 configured to send the data transmission response to the first terminal.
In one possible implementation, the apparatus further includes:
the receiving module 501 is further configured to receive first configuration information sent by the second terminal, where the first configuration information includes a first encryption rule of the data transmission request;
a first association module configured to associate the set of test rules with the first configuration information.
In another possible implementation manner, the determining module 502 is further configured to determine, according to the request parameter, a test rule corresponding to the request parameter from the test rule set, where the test rule includes request body data and response body template data; determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters; and adding the target request data into the target response body template to obtain a data transmission response.
In another possible implementation manner, the apparatus further includes:
a receiving module 501, further configured to receive a request parameter and a test rule sent by a second terminal;
a second association module configured to associate the request parameters with the test rules.
In another possible implementation manner, the sending module 505 is further configured to encrypt the data transmission response according to a second encryption rule if the second configuration information corresponding to the test rule set includes the second encryption rule of the data transmission response; the encrypted data transmission response is sent to the first terminal.
In another possible implementation manner, the apparatus further includes:
the receiving module 501 is further configured to receive second configuration information sent by the second terminal, where the second configuration information includes a second encryption rule of the data transmission response;
a third association module configured to associate the set of test rules with the second configuration information.
In the embodiment of the application, in the process of carrying out simulation test on a client on a first terminal, a server receives a data transmission request sent by the first terminal and determines a test rule set associated with the data transmission request; acquiring first configuration information corresponding to the test rule set, and if the first configuration information comprises a first encryption rule of the data transmission request, decrypting the data transmission request according to the first encryption rule to obtain a request parameter of the data transmission request; and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal. According to the method and the device, the first configuration information comprising the first encryption rule is added, and different data transmission requests correspond to different first configuration information, so that the first encryption rule can be configured, and therefore different decryption modes can be flexibly performed on different data transmission requests in the process of simulation test.
It should be noted that: in the simulation test apparatus provided in the above embodiment, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules as needed, that is, the internal structure of the server is divided into different functional modules to complete all or part of the functions described above. In addition, the simulation test method provided by the above embodiment and the simulation test device embodiment belong to the same concept, and the specific implementation process thereof is described in the method embodiment and is not described herein again.
Fig. 6 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 600 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 601 and one or more memories 602, where the memory 602 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 601 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, a computer-readable storage medium, such as a memory, is also provided that includes instructions executable by a processor in a terminal to perform the simulation test method in the above-described embodiments. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present application also provides a computer program product comprising one or more computer programs for implementing the simulation test method provided by the above-mentioned method embodiments when executed by a processor.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (12)

1. A simulation test method, the method comprising:
receiving first configuration information sent by a second terminal, wherein the first configuration information comprises a first encryption rule of a data transmission request;
associating the first configuration information with a set of test rules, the set of test rules being a set of test rules associated with the data transfer request;
receiving the data transmission request sent by a first terminal, and acquiring the first configuration information associated with the test rule set according to the association relation between the test rule set associated with the data transmission request and the first configuration information; extracting an encrypted field of the data transmission request according to an encrypted field identifier corresponding to the first encryption rule included in the first configuration information;
decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request;
and determining a data transmission response corresponding to the request parameter, and sending the data transmission response to the first terminal.
2. The method of claim 1, wherein the determining the data transmission response corresponding to the request parameter comprises:
determining a test rule corresponding to the request parameter from a test rule set according to the request parameter, wherein the test rule comprises request body data and response body template data;
determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters;
and adding the target request data into the target response body template to obtain the data transmission response.
3. The method of claim 2, wherein before determining the test rule corresponding to the request parameter from the test rule set according to the request parameter, the method further comprises:
receiving the request parameters and the test rules sent by a second terminal;
associating the request parameters with the test rules.
4. The method of claim 1, wherein the sending the data transmission response to the first terminal comprises:
if the second configuration information corresponding to the test rule set comprises a second encryption rule of the data transmission response, encrypting the data transmission response according to the second encryption rule;
and sending the encrypted data transmission response to the first terminal.
5. The method of claim 4, wherein if the second configuration information corresponding to the test rule set includes a second encryption rule of the data transmission response, before encrypting the data transmission response according to the second encryption rule, the method further comprises:
receiving second configuration information sent by a second terminal, wherein the second configuration information comprises a second encryption rule of the data transmission response;
and associating the test rule set with the second configuration information.
6. A simulation test apparatus, the apparatus comprising:
the receiving module is configured to receive first configuration information sent by a second terminal, wherein the first configuration information comprises a first encryption rule of a data transmission request;
a first association module configured to associate the first configuration information with a set of test rules, the set of test rules being a set of test rules associated with the data transfer request;
the receiving module is further configured to receive the data transmission request sent by the first terminal;
an obtaining module configured to obtain the first configuration information associated with the test rule set according to an association relationship between the test rule set associated with the data transmission request and the first configuration information;
the decryption module is configured to extract an encrypted field of the data transmission request according to an encrypted field identifier corresponding to the first encryption rule included in the first configuration information; decrypting the encrypted field through an encryption algorithm corresponding to the first encryption rule according to a key corresponding to the first encryption rule to obtain a request parameter corresponding to the data transmission request;
a determining module configured to determine a data transmission response corresponding to the request parameter;
a sending module configured to send the data transmission response to the first terminal.
7. The apparatus of claim 6, wherein the determining module is further configured to determine, according to the request parameter, a test rule corresponding to the request parameter from a set of test rules, where the test rule includes request body data and response body template data; determining target request data corresponding to the request parameters from the request body data, and determining target response body templates corresponding to the request parameters from the response body template data according to the request parameters; and adding the target request data into the target response body template to obtain the data transmission response.
8. The apparatus of claim 7, further comprising:
the receiving module is further configured to receive the request parameter and the test rule sent by the second terminal;
a second association module configured to associate the request parameter with the test rule.
9. The apparatus of claim 6, wherein the sending module is further configured to encrypt the data transmission response according to a second encryption rule if the second configuration information corresponding to the test rule set includes the second encryption rule of the data transmission response; and sending the encrypted data transmission response to the first terminal.
10. The apparatus of claim 9, further comprising:
the receiving module is further configured to receive second configuration information sent by a second terminal, where the second configuration information includes a second encryption rule of the data transmission response;
a third association module configured to associate the set of test rules with the second configuration information.
11. A server, characterized in that the server comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the simulation test method according to any of claims 1 to 5.
12. A computer-readable storage medium having stored therein at least one program code, the at least one program code loaded and executed by a processor, to implement the simulation test method of any one of claims 1 to 5.
CN201911128940.8A 2019-11-18 2019-11-18 Simulation test method, simulation test device, server and storage medium Active CN111224834B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911128940.8A CN111224834B (en) 2019-11-18 2019-11-18 Simulation test method, simulation test device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911128940.8A CN111224834B (en) 2019-11-18 2019-11-18 Simulation test method, simulation test device, server and storage medium

Publications (2)

Publication Number Publication Date
CN111224834A CN111224834A (en) 2020-06-02
CN111224834B true CN111224834B (en) 2021-12-14

Family

ID=70830610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911128940.8A Active CN111224834B (en) 2019-11-18 2019-11-18 Simulation test method, simulation test device, server and storage medium

Country Status (1)

Country Link
CN (1) CN111224834B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199704B (en) * 2020-10-22 2022-09-06 福建天晴数码有限公司 Method for dynamically encrypting and decrypting web data based on server
CN112328480A (en) * 2020-11-04 2021-02-05 浙江诺诺网络科技有限公司 System testing method and device
CN113438134B (en) * 2021-06-30 2023-03-31 未鲲(上海)科技服务有限公司 Request message processing method, device, server and medium
CN113904969B (en) * 2021-09-28 2023-09-15 青岛海尔科技有限公司 Performance detection method of Internet of things equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108347361A (en) * 2018-03-06 2018-07-31 平安普惠企业管理有限公司 Applied program testing method, device, computer equipment and storage medium
CN109714291A (en) * 2017-10-25 2019-05-03 普天信息技术有限公司 A kind of data transmission method and device
CN109889410A (en) * 2019-03-18 2019-06-14 北京达佳互联信息技术有限公司 Test method, apparatus, agent equipment and the readable storage medium storing program for executing of business function

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10361931B2 (en) * 2016-06-30 2019-07-23 At&T Intellectual Property I, L.P. Methods and apparatus to identify an internet domain to which an encrypted network communication is targeted

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714291A (en) * 2017-10-25 2019-05-03 普天信息技术有限公司 A kind of data transmission method and device
CN108347361A (en) * 2018-03-06 2018-07-31 平安普惠企业管理有限公司 Applied program testing method, device, computer equipment and storage medium
CN109889410A (en) * 2019-03-18 2019-06-14 北京达佳互联信息技术有限公司 Test method, apparatus, agent equipment and the readable storage medium storing program for executing of business function

Also Published As

Publication number Publication date
CN111224834A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
CN111224834B (en) Simulation test method, simulation test device, server and storage medium
CN108123800B (en) Key management method, key management device, computer equipment and storage medium
CN106533669B (en) The methods, devices and systems of equipment identification
JP5870471B2 (en) Method, apparatus, and system for sharing software between terminals
CN116662941B (en) Information encryption method, device, computer equipment and storage medium
CN111246407B (en) Data encryption and decryption method and device for short message transmission
CN113961893A (en) User login method and device based on block chain, electronic equipment and storage medium
CN111416816A (en) Access method and device of joint debugging interface, computer equipment and storage medium
CN109150898A (en) Method and apparatus for handling information
WO2023236512A1 (en) Information code display method and apparatus, and terminal device and storage medium
CN115334150B (en) Data forwarding method, device, system, electronic equipment and medium
CN108737350B (en) Information processing method and client
CN113422758B (en) Data encryption method and device, internet of things system, electronic equipment and storage medium
CN112583602B (en) Information code data transmission method, device, system, computer device and medium
CN104184804A (en) Cloud storage system and system and method for downloading/providing data from cloud storage system
CN113946862A (en) Data processing method, device and equipment and readable storage medium
CN111835734A (en) Information processing method, information processing device, electronic equipment, server and storage medium
CN113992353A (en) Login certificate processing method and device, electronic equipment and storage medium
CN113761566A (en) Data processing method and device
CN114580689A (en) Service prediction method, device, equipment, storage medium and program product
CN112118208B (en) Method and device for reporting data
CN116112172B (en) Android client gRPC interface security verification method and device
CN110225010A (en) A kind of processing method and relevant device of PUSH message
CN112906017B (en) Processing method, device and server for encrypted data test
CN113783835B (en) Password sharing method, device, equipment and storage medium

Legal Events

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