CN110489322A - MOCK test method, device, computer equipment and storage medium - Google Patents
MOCK test method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110489322A CN110489322A CN201910610941.XA CN201910610941A CN110489322A CN 110489322 A CN110489322 A CN 110489322A CN 201910610941 A CN201910610941 A CN 201910610941A CN 110489322 A CN110489322 A CN 110489322A
- Authority
- CN
- China
- Prior art keywords
- keyword
- request packet
- crucial phrase
- consistent
- data request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000010998 test method Methods 0.000 title claims abstract description 36
- 238000012360 testing method Methods 0.000 claims abstract description 86
- 238000000034 method Methods 0.000 claims abstract description 25
- 238000004590 computer program Methods 0.000 claims description 14
- 230000005540 biological transmission Effects 0.000 claims description 13
- 238000012512 characterization method Methods 0.000 claims description 11
- 238000013501 data transformation Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 5
- 238000007726 management method Methods 0.000 description 38
- 238000010586 diagram Methods 0.000 description 18
- 238000006243 chemical reaction Methods 0.000 description 12
- 230000006870 function Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
Abstract
The embodiment of the present application provides a kind of MOCK test method, device, computer equipment and storage medium.This method comprises: the encryption data request packet according to transmitted by preset secret key pair user terminal is decrypted to obtain ciphertext data request packet;According to predetermined keyword information in the corresponding crucial phrase of ciphertext data request packet with the presence or absence of judging with the consistent keyword of key word information;If in crucial phrase exist with the consistent keyword of key word information, obtain ciphertext data request packet in request address information;Call service interface corresponding with request address information to acquire target returned data;Target returned data is sent to the user terminal, so that user terminal carries out MOCK test according to target returned data.This method is based on interface testing technology, conveniently and efficiently can carry out MOCK test to third party system interface, have good convenience and flexibility, is added significantly to carry out third party system interface the efficiency of MOCK test.
Description
Technical field
This application involves field of computer technology more particularly to a kind of MOCK test method, device, computer equipment and deposit
Storage media.
Background technique
Developer requires in the process of development or after the completion of exploitation to test the unit of exploitation, with timely
It was found that mistake and being repaired in time to ensure the program correctness and stability developed, MOCK test is for common in development process
A kind of test mode.In the prior art, carrying out MOCK test to existing interface is directly adjusted by testing service device
With the interface, however it is this be difficult to carry out when being invoked at for third party system, there is convenience and flexibly during the test
Property insufficient problem, it is not high so as to cause testing efficiency.
Summary of the invention
This application provides a kind of MOCK test method, device, computer equipment and storage mediums, it is intended to solve existing skill
The not high problem of MOCK testing time-effectiveness rate is being carried out to third party system interface in art method.
In a first aspect, this application provides a kind of MOCK test methods comprising: obtain the encryption number that user terminal is sent
According to request packet;If receiving encryption data request packet transmitted by user terminal, asked according to encryption data described in preset secret key pair
Packet is asked to be decrypted to obtain ciphertext data request packet;It is corresponding to the ciphertext data request packet according to predetermined keyword information
It whether there is in crucial phrase and judged with the consistent keyword of the key word information, the crucial phrase includes multiple passes
Keyword;If in the crucial phrase exist with the consistent keyword of the key word information, obtain the ciphertext data request packet
In request address information;Service interface corresponding with the request address information is called to return to number to acquire target
According to;The target returned data is sent to the user terminal, so that the user terminal is according to the target returned data
Carry out MOCK test.
Second aspect, this application provides a kind of MOCK test devices comprising: data request packet decryption unit is used for
If receiving encryption data request packet transmitted by user terminal, solved according to encryption data request packet described in preset secret key pair
It is close to obtain ciphertext data request packet;Keyword judging unit, for being asked according to predetermined keyword information to the ciphertext data
Asking whether there is in the corresponding crucial phrase of packet is judged with the consistent keyword of the key word information, the crucial phrase
Including multiple keywords;Request address information acquiring unit, if for existing and the key word information in the crucial phrase
Consistent keyword obtains the request address information in the ciphertext data request packet;Target returned data acquiring unit, is used for
Call service interface corresponding with the request address information to acquire target returned data;Target returned data is sent
Unit, for the target returned data to be sent to the user terminal, so that the user terminal is returned according to the target
It returns data and carries out MOCK test.
The third aspect this application provides a kind of computer equipment, including memory, processor and is stored in the storage
On device and the computer program that can run on the processor, the processor are realized above-mentioned when executing the computer program
Described in any item MOCK test methods that first aspect provides.
Fourth aspect, present invention also provides a kind of storage mediums, wherein the storage medium is stored with computer program,
The computer program makes the processor execute the described in any item of above-mentioned first aspect offer when being executed by a processor
MOCK test method.
The application provides a kind of MOCK test method, device, computer equipment and storage medium.The MOCK test method is logical
It crosses and obtains the encryption data request packet that user terminal is sent;It is decrypted according to encryption data request packet described in preset secret key pair,
To generate ciphertext data request packet;If in the crucial phrase exist with the consistent key word information of the first predetermined keyword, obtain
Take the request address information in the ciphertext data request packet;Call corresponding with request address information service interface with
Acquire target returned data;The target returned data is sent to the user terminal, so that the user terminal root
MOCK test is carried out according to the target returned data.It, can be conveniently and efficiently to using MOCK test method provided by the invention
Tripartite's system interface carries out MOCK test, has good convenience and flexibility, is added significantly to third party system interface
Carry out the efficiency of MOCK test.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description
Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field
For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the flow diagram of MOCK test method provided by the embodiments of the present application;
Fig. 2 is the application scenarios schematic diagram of MOCK test method provided by the embodiments of the present application;
Fig. 3 is another flow diagram of MOCK test method provided by the embodiments of the present application;
Fig. 4 is the sub-process schematic diagram of MOCK test method provided by the embodiments of the present application;
Fig. 5 is another sub-process schematic diagram of MOCK test method provided by the embodiments of the present application;
Fig. 6 is another sub-process schematic diagram of MOCK test method provided by the embodiments of the present application;
Fig. 7 is the schematic block diagram of MOCK test device provided by the embodiments of the present application;
Fig. 8 is another schematic block diagram of MOCK test device provided by the embodiments of the present application;
Fig. 9 is the subelement schematic block diagram of MOCK test device provided by the embodiments of the present application;
Figure 10 is another subelement schematic block diagram of MOCK test device provided by the embodiments of the present application;
Figure 11 is another subelement schematic block diagram of MOCK test device provided by the embodiments of the present application;
Figure 12 is the schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
It should be appreciated that ought use in this specification and in the appended claims, term " includes " and "comprising" instruction
Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded
Body, step, operation, the presence or addition of element, component and/or its set.
It is also understood that mesh of the term used in this present specification merely for the sake of description specific embodiment
And be not intended to limit the application.As present specification and it is used in the attached claims, unless on
Other situations are hereafter clearly indicated, otherwise " one " of singular, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is
Refer to any combination and all possible combinations of one or more of associated item listed, and including these combinations.
Fig. 1 and Fig. 2 is please referred to, Fig. 1 is the flow diagram of MOCK test method provided by the embodiments of the present application;Fig. 2 is
The application scenarios schematic diagram of MOCK test method provided by the embodiments of the present application.The MOCK test method is applied to management server
In 10, this method is executed by the application software being installed in management server 10, user terminal 20 and service interface 30
By establishing the transmission being connected to the network to realize data information with management server 10.Management server 10 is for executing
For MOCK test method to carry out the enterprise terminal of MOCK test to third party system, user terminal 20 is for management service
Device 10 sends the terminal device, such as desktop computer, laptop, tablet computer or mobile phone etc. of data information, service interface
30 be the server interface provided by third party system for test.Management server 10 and one are only illustrated in Fig. 2
Platform user terminal 20 and service interface 30 carry out information transmission, in practical applications, the management server 10 can also with it is more
Platform user terminal 20 and multiple service interfaces 30 carry out information transmission simultaneously.
As shown in Figure 1, the MOCK test method includes the following steps S110~S150.
If S110, receiving encryption data request packet transmitted by user terminal, number is encrypted according to preset secret key pair
It is decrypted according to request packet to obtain ciphertext data request packet.
In the embodiment of the present application, if encryption data request packet transmitted by user terminal is received, according to preset code key
The encryption data request packet is decrypted to obtain ciphertext data request packet.User (tester) using user terminal with
Management server is communicated to realize the test based on MOCK technology, and MOCK test is during the test, for certain
It is not easy the object for constructing or being not easy to obtain, uses a kind of test side of the one virtual object of building to be tested
Method, this virtual object are exactly MOCK object, and the process tested MOCK object is MOCK test.Wherein, it manages
The encryption data request packet that server is sent by obtaining user terminal, to realize according to the encryption data request packet to corresponding
Service interface is called, and the target returned data that will acquire feeds back to user terminal.User terminal is to data request packet
Carrying out cryptographic operation can be obtained encryption data request packet, can be enhanced by sending encryption data request packet to management server
Safety in data transmission procedure.
The public key that management server is preserved in user terminal first passes through number of the public key to required transmission of management server
It is encrypted according to request packet to obtain encryption data request packet, the public key of management server carries out public to each user terminal
It opens.After management server receives encryption data request packet, it is decrypted i.e. by preset secret key pair encryption data request packet
Ciphertext data request packet can be obtained, wherein code key is that management server is privately owned, and the public key and secret key pair of management server are answered, and is led to
The data that the public key of management server is encrypted are crossed, are only capable of being decrypted by the code key of management server.
S120, according to predetermined keyword information in the corresponding crucial phrase of the ciphertext data request packet with the presence or absence of with
The consistent keyword of key word information is judged that the crucial phrase includes multiple keywords.
According to predetermined keyword information in the corresponding crucial phrase of the ciphertext data request packet with the presence or absence of with it is described
The consistent keyword of key word information is judged that the crucial phrase includes multiple keywords.It include the in key word information
One predetermined keyword and the second predetermined keyword, crucial phrase be from ciphertext data request packet it is corresponding acquire include
The phrase of multiple keywords.
In one embodiment, as shown in figure 3, further including step S120a before step S120.
S120a, according to predetermined keyword database to the ciphertext data request packet carry out keyword identification with obtain with
The corresponding crucial phrase of the ciphertext data request packet.
In the embodiment of the present application, predetermined keyword database, the predetermined keyword number are stored in management server
According to including multiple predetermined keywords in library, keyword identification is carried out to the ciphertext data request packet by predetermined keyword,
It is to obtain keyword corresponding with predetermined keyword in ciphertext data request packet, obtains included in ciphertext data request packet
Crucial phrase can be obtained in keyword.
In one embodiment, as shown in figure 4, step S120 includes step sub- S121, S122 and S123.
S121, judge to whether there is and the consistent keyword of the first predetermined keyword in the crucial phrase, wherein
First predetermined keyword is the keyword of characterization test mode.
In the embodiment of the present application, the test that user terminal carries out service interface can be divided into two kinds, and one is MOCK
Mode, another kind are non-MOCK modes, can be by whether there is and the consistent key of the first predetermined keyword in crucial phrase
Whether word is judged, to be that MOCK test judges to encryption data request packet transmitted by user terminal, wherein described
First predetermined keyword is the keyword of characterization test mode, such as " MOCK ".
If in S122, the crucial phrase exist with the consistent keyword of the first predetermined keyword, judge the pass
It whether there is in keyword group and requested with the consistent keyword of the second predetermined keyword, second predetermined keyword for characterization
The keyword of address.
If in crucial phrase exist with the consistent keyword of the first predetermined keyword, be considered as user terminal to service
The test that interface is carried out is MOCK test, then further whether includes the progress of the second predetermined keyword in the crucial phrase
Judgement, wherein second predetermined keyword is the keyword for characterizing request address, such as " ste.dbg.m1 ".
In one embodiment, as shown in figure 5, further including step S121a after step S121.
If being not present and the consistent keyword of the first predetermined keyword, generation error in S121a, the crucial phrase
Prompting message is simultaneously sent to the user terminal, and the error prompting information includes first predetermined keyword and current time
Point.
In the embodiment of the present application, first predetermined keyword is " MOCK ".By adding to transmitted by user terminal
It carries out the crucial phrase that keyword identification is extracted in ciphertext data request packet to be compared, if being not present in the crucial phrase
With the consistent keyword of the first predetermined keyword, then being considered as the test that user terminal carries out service interface is non-MOCK
Mode, generation error prompting message are simultaneously sent to the user terminal to remind user, wherein the error prompting packet
First predetermined keyword and current point in time are included, in order to which user modifies to data request packet by user terminal.
If in S123, the crucial phrase exist with the consistent keyword of the second predetermined keyword, determine described in
Exist and the consistent keyword of the key word information in crucial phrase.
If in the crucial phrase exist with the consistent keyword of the second predetermined keyword, that is, can determine whether to obtain key
There is the judging result with the consistent keyword of the key word information in phrase, that is to say in crucial phrase and exist and request ground
The consistent keyword of location keyword.
If in S130, the crucial phrase exist with the consistent keyword of the key word information, obtain the decryption number
According to the request address information in request packet.
In the crucial phrase exist with the consistent keyword of the key word information, i.e., user terminal is to service interface institute
The test of progress be MOCK test and exist in crucial phrase with the consistent keyword of request address keyword, then according to should be with the
The consistent keyword of two predetermined keywords obtains corresponding request address information, in order to according to the request address information to corresponding
Service interface be called and obtain corresponding data information.
S140, call service interface corresponding with the request address information to acquire target returned data.
In the embodiment of the present application, it is stored with preset interface call list in management server, passes through accessed request
Address information, and service interface associated with the request address information is inquired according to preset interface call list, it can call
The service interface simultaneously acquires target returned data.
In one embodiment, as shown in fig. 6, step S140 includes step sub- S141, S142 and S143.
S141, according to preset interface call list, obtain service interface corresponding with the request address information.
In the embodiment of the present application, preset interface call list, the preset interface call list are stored in management server
The corresponding relationship of request address information and service interface is had recorded, specifically, a request address information and a service interface
It is corresponding, by the preset interface call list, can get corresponding with request address information transmitted by user terminal unique
One service interface.
S142, the service interface is called, and receives the primary data of the service interface feedback.
In the embodiment of the present application, service interface is the server interface provided by third party system for test,
By calling the service interface primary data ready to receive fed back to the service interface.
S143, according to preset data transformation rule to the primary data carry out conversion acquire target returned data.
In the embodiment of the present application, preset data transformation rule is also stored in management server, the preset data turns
The data format specifications that rule is management server and user terminal has been reached an agreement are changed, include data in the data conversion rule
The specific format specification such as types entail and data length requirement is advised according to the data format of institute's agreement in data conversion rule
Model can carry out data conversion according to the data format specifications to primary data, be returned with obtaining target corresponding with primary data
Return data.
For example, the type for the primary data that service interface is fed back is " GB18030 ", the data class in data conversion rule
Type requires to be " UTF-8 ", and data length is 20 characters of every row, then is " GB18030 " by format according to data conversion rule
Primary data is converted to the data type of " UTF-8 ", and with 20 characters of every row to this have converted the length of the data of type into
Professional etiquette model can finally obtain target returned data.
S150, the target returned data is sent to the user terminal, so that the user terminal is according to the mesh
It marks returned data and carries out MOCK test.
By the way that target returned data is back to the user terminal, in order to which the user terminal is returned according to the target
It returns data and MOCK test is carried out to service interface.
The application provides a kind of MOCK test method, device, computer equipment and storage medium.The MOCK test method is logical
It crosses and obtains the encryption data request packet that user terminal is sent;It is decrypted according to encryption data request packet described in preset secret key pair,
To generate ciphertext data request packet;If in the crucial phrase exist with the consistent key word information of the first predetermined keyword, obtain
Take the request address information in the ciphertext data request packet;Call corresponding with request address information service interface with
Acquire target returned data;The target returned data is sent to the user terminal, so that the user terminal root
MOCK test is carried out according to the target returned data.It, can be conveniently and efficiently to using MOCK test method provided by the present application
Tripartite's system interface carries out MOCK test, has good convenience and flexibility, is added significantly to third party system interface
Carry out the efficiency of MOCK test.
The embodiment of the present application also provides a kind of MOCK test device, and the MOCK test device is for executing aforementioned MOCK test
Any embodiment of method.Specifically, referring to Fig. 7, Fig. 7 is the schematic of MOCK test device provided by the embodiments of the present application
Block diagram.The MOCK test device can be configured in management server 10.
As shown in fig. 7, MOCK test device 100 include data request packet decryption unit 110, keyword judging unit 120,
Request address information acquiring unit 130, target returned data acquiring unit 140 and target returned data transmission unit 150.
Data request packet decryption unit 110, if for receiving encryption data request packet transmitted by user terminal, according to
Encryption data request packet described in preset secret key pair is decrypted to obtain ciphertext data request packet.
In the embodiment of the present application, if encryption data request packet transmitted by user terminal is received, according to preset code key
The encryption data request packet is decrypted to obtain ciphertext data request packet.User (tester) using user terminal with
Management server is communicated to realize the test based on MOCK technology, and MOCK test is during the test, for certain
It is not easy the object for constructing or being not easy to obtain, uses a kind of test side of the one virtual object of building to be tested
Method, this virtual object are exactly MOCK object, and the process tested MOCK object is MOCK test.Wherein, it manages
The encryption data request packet that server is sent by obtaining user terminal, to realize according to the encryption data request packet to corresponding
Service interface is called, and the target returned data that will acquire feeds back to user terminal.User terminal is to data request packet
Carrying out cryptographic operation can be obtained encryption data request packet, can be enhanced by sending encryption data request packet to management server
Safety in data transmission procedure.
The public key that management server is preserved in user terminal first passes through number of the public key to required transmission of management server
It is encrypted according to request packet to obtain encryption data request packet, the public key of management server carries out public to each user terminal
It opens.After management server receives encryption data request packet, it is decrypted i.e. by preset secret key pair encryption data request packet
Ciphertext data request packet can be obtained, wherein code key is that management server is privately owned, and the public key and secret key pair of management server are answered, and is led to
The data that the public key of management server is encrypted are crossed, are only capable of being decrypted by the code key of management server.
Keyword judging unit 120 is used for according to predetermined keyword information to the corresponding pass of the ciphertext data request packet
It whether there is in keyword group and judged with the consistent keyword of the key word information, the crucial phrase includes multiple keys
Word.
According to predetermined keyword information in the corresponding crucial phrase of the ciphertext data request packet with the presence or absence of with it is described
The consistent keyword of key word information is judged that the crucial phrase includes multiple keywords.It include the in key word information
One predetermined keyword and the second predetermined keyword, crucial phrase be from ciphertext data request packet it is corresponding acquire include
The phrase of multiple keywords.
In other application embodiments, as shown in figure 8, the MOCK test device 100 further includes subelement: crucial phrase is obtained
Take unit 120a.
Crucial phrase acquiring unit 120a, for being carried out according to predetermined keyword database to the ciphertext data request packet
Keyword is identified to obtain crucial phrase corresponding with the ciphertext data request packet.
In the embodiment of the present application, predetermined keyword database, the predetermined keyword number are stored in management server
According to including multiple predetermined keywords in library, keyword identification is carried out to the ciphertext data request packet by predetermined keyword,
It is to obtain keyword corresponding with predetermined keyword in ciphertext data request packet, obtains included in ciphertext data request packet
Crucial phrase can be obtained in keyword.
In other application embodiments, as shown in figure 9, the keyword judging unit 120 includes subelement: the first judgement is single
Member 121, second judgment unit 122 and judging result acquiring unit 123.
First judging unit 121 whether there is and first predetermined keyword one in the crucial phrase for judging
The keyword of cause, wherein first predetermined keyword is the keyword of characterization test mode.
In the embodiment of the present application, the test that user terminal carries out service interface can be divided into two kinds, and one is MOCK
Mode, another kind are non-MOCK modes, can be by whether there is and the consistent key of the first predetermined keyword in crucial phrase
Whether word is judged, to be that MOCK test judges to encryption data request packet transmitted by user terminal, wherein described
First predetermined keyword is the keyword of characterization test mode, such as " MOCK ".
Second judgment unit 122, if for existing and the consistent pass of the first predetermined keyword in the crucial phrase
Keyword judges in the crucial phrase with the presence or absence of default with the consistent keyword of the second predetermined keyword, described second
Keyword is the keyword for characterizing request address.
If in crucial phrase exist with the consistent keyword of the first predetermined keyword, be considered as user terminal to service
The test that interface is carried out is MOCK test, then further whether includes the progress of the second predetermined keyword in the crucial phrase
Judgement, wherein second predetermined keyword is the keyword for characterizing request address, such as " ste.dbg.m1 ".
In other application embodiments, as shown in Figure 10, the keyword judging unit 120 further includes subelement: reminding letter
Cease transmission unit 121a.
Prompting message transmission unit 121a, if for being not present and first predetermined keyword one in the crucial phrase
The keyword of cause, generation error prompting message are simultaneously sent to the user terminal, and the error prompting information includes described first
Predetermined keyword and current point in time.
In the embodiment of the present application, first predetermined keyword is " MOCK ".By adding to transmitted by user terminal
It carries out the crucial phrase that keyword identification is extracted in ciphertext data request packet to be compared, if being not present in the crucial phrase
With the consistent keyword of the first predetermined keyword, then being considered as the test that user terminal carries out service interface is non-MOCK
Mode, generation error prompting message are simultaneously sent to the user terminal to remind user, wherein the error prompting packet
First predetermined keyword and current point in time are included, in order to which user modifies to data request packet by user terminal.
Judging result acquiring unit 123, if consistent with second predetermined keyword for existing in the crucial phrase
Keyword, then determine in the crucial phrase exist and the consistent keyword of the key word information.
If in the crucial phrase exist with the consistent keyword of the second predetermined keyword, crucial phrase can be obtained
The middle judging result existed with the consistent keyword of the key word information that is to say to exist in crucial phrase and close with request address
The consistent keyword of keyword.
Request address information acquiring unit 130, if consistent with the key word information for existing in the crucial phrase
Keyword, obtain the request address information in the ciphertext data request packet.
In the crucial phrase exist with the consistent keyword of the key word information, i.e., user terminal is to service interface institute
The test of progress be MOCK test and exist in crucial phrase with the consistent keyword of request address keyword, then according to should be with the
The consistent keyword of two predetermined keywords obtains corresponding request address information, in order to according to the request address information to corresponding
Service interface be called and obtain corresponding data information.
Target returned data acquiring unit 140, for call corresponding with request address information service interface with
Acquire target returned data.
In the embodiment of the present application, it is stored with preset interface call list in management server, passes through accessed request
Address information, and service interface associated with the request address information is inquired according to preset interface call list, it can call
The service interface simultaneously acquires target returned data.
In other application embodiments, as shown in figure 11, the target returned data acquiring unit 140 includes subelement: clothes
Business interface acquiring unit 141, service interface call unit 142 and Date Conversion Unit 143.
Service interface acquiring unit 141, for obtaining opposite with the request address information according to preset interface call list
The service interface answered.
In the embodiment of the present application, preset interface call list, the preset interface call list are stored in management server
The corresponding relationship of request address information and service interface is had recorded, specifically, a request address information and a service interface
It is corresponding, by the preset interface call list, can get corresponding with request address information transmitted by user terminal unique
One service interface.
Service interface call unit 142 for calling the service interface, and receives the initial of the service interface feedback
Data.
In the embodiment of the present application, service interface is the server interface provided by third party system for test,
By calling the service interface primary data ready to receive fed back to the service interface.
Date Conversion Unit 143 is obtained for carrying out conversion to the primary data according to preset data transformation rule
To target returned data.
In the embodiment of the present application, preset data transformation rule is also stored in management server, the preset data turns
The data format specifications that rule is management server and user terminal has been reached an agreement are changed, include data in the data conversion rule
The specific format specification such as types entail and data length requirement is advised according to the data format of institute's agreement in data conversion rule
Model can carry out data conversion according to the data format specifications to primary data, be returned with obtaining target corresponding with primary data
Return data.
Target returned data transmission unit 150, for the target returned data to be sent to the user terminal, so that
The user terminal carries out MOCK test according to the target returned data.
By the way that target returned data is back to the user terminal, in order to which the user terminal is returned according to the target
It returns data and MOCK test is carried out to service interface.
The MOCK test device provided by the embodiment of the present application applies above-mentioned MOCK test method, the MOCK test method
The encryption data request packet sent by obtaining user terminal;It is solved according to encryption data request packet described in preset secret key pair
It is close, to generate ciphertext data request packet;If in the crucial phrase exist with the consistent key word information of the first predetermined keyword,
Obtain the request address information in the ciphertext data request packet;Call service interface corresponding with the request address information
To acquire target returned data;The target returned data is sent to the user terminal, so that the user terminal
MOCK test is carried out according to the target returned data.It, can be conveniently and efficiently right using MOCK test method provided by the invention
Third party system interface carries out MOCK test, has good convenience and flexibility, is added significantly to connect third party system
Mouth carries out the efficiency of MOCK test.
Above-mentioned MOCK test device can be implemented as a kind of form of computer program, which can such as scheme
It is run in computer equipment shown in 12.
Figure 12 is please referred to, Figure 12 is the schematic block diagram of computer equipment provided in an embodiment of the present invention.
Refering to fig. 12, which includes processor 502, memory and the net connected by system bus 501
Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program
5032 are performed, and processor 502 may make to execute MOCK test method.
The processor 502 supports the operation of entire computer equipment 500 for providing calculating and control ability.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should
When computer program 5032 is executed by processor 502, processor 502 may make to execute MOCK test method.
The network interface 505 is for carrying out network communication, such as the transmission of offer data information.Those skilled in the art can
To understand, structure shown in Figure 12, only the block diagram of part-structure relevant to the present invention program, is not constituted to this hair
The restriction for the computer equipment 500 that bright scheme is applied thereon, specific computer equipment 500 may include than as shown in the figure
More or fewer components perhaps combine certain components or with different component layouts.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following function
Can: if receiving encryption data request packet transmitted by user terminal, according to encryption data request packet described in preset secret key pair into
Row decryption is to obtain ciphertext data request packet;According to predetermined keyword information to the corresponding keyword of the ciphertext data request packet
It whether there is in group and judged with the consistent keyword of the key word information, the crucial phrase includes multiple keywords;
If in the crucial phrase exist with the consistent keyword of the key word information, obtain asking in the ciphertext data request packet
Seek address information;Call service interface corresponding with the request address information to acquire target returned data;By institute
It states target returned data and is sent to the user terminal, so that the user terminal carries out MOCK according to the target returned data
Test.
In one embodiment, processor 502 is being executed according to predetermined keyword information to the ciphertext data request packet pair
Before whether there is the step of being judged with the consistent keyword of the key word information in the crucial phrase answered, also execute such as
Lower operation: keyword identification is carried out to the ciphertext data request packet to obtain and the decryption according to predetermined keyword database
The corresponding crucial phrase of data request packet.
In one embodiment, processor 502 is being executed according to predetermined keyword information to the ciphertext data request packet pair
When in the crucial phrase answered with the presence or absence of the step judged with the consistent keyword of the key word information, following behaviour is executed
Make: judging to whether there is and the consistent keyword of the first predetermined keyword in the crucial phrase, wherein described first is pre-
If keyword is the keyword of characterization test mode;If existing in the crucial phrase consistent with first predetermined keyword
Keyword, judges to whether there is in the crucial phrase and the consistent keyword of the second predetermined keyword, wherein described the
Two predetermined keywords are the keyword for characterizing request address;If existing and second predetermined keyword one in the crucial phrase
The keyword of cause then determines exist and the consistent keyword of the key word information in the crucial phrase.
In one embodiment, processor 502 judges to preset in the crucial phrase with the presence or absence of with described first in execution
It after the step of keyword consistent keyword, also performs the following operations: if being not present in the crucial phrase and described first
The consistent keyword of predetermined keyword, generation error prompting message are simultaneously sent to the user terminal, the error prompting information
Including first predetermined keyword and current point in time.
In one embodiment, processor 502 execute call corresponding with request address information service interface with
It when acquiring the step of target returned data, performs the following operations: according to preset interface call list, obtaining and the request ground
The corresponding service interface of location information;The service interface is called, and receives the primary data of the service interface feedback;According to
Preset data transformation rule is converted the primary data to obtain target returned data.
It will be understood by those skilled in the art that the embodiment of computer equipment shown in Figure 12 is not constituted to computer
The restriction of equipment specific composition, in other embodiments, computer equipment may include components more more or fewer than diagram, or
Person combines certain components or different component layouts.For example, in some embodiments, computer equipment can only include depositing
Reservoir and processor, in such embodiments, the structure and function of memory and processor are consistent with embodiment illustrated in fig. 12,
Details are not described herein.
It should be appreciated that in embodiments of the present invention, processor 502 can be central processing unit (Central
ProcessingUnit, CPU), which can also be other general processors, digital signal processor (Digital
Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit,
ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices
Part, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or
The processor is also possible to any conventional processor etc..
Computer readable storage medium is provided in another embodiment of the invention.The computer readable storage medium can be with
For non-volatile computer readable storage medium.The computer-readable recording medium storage has computer program, wherein calculating
If machine program performs the steps of when being executed by processor receives encryption data request packet transmitted by user terminal, according to
Encryption data request packet described in preset secret key pair is decrypted to obtain ciphertext data request packet;According to predetermined keyword information pair
With the presence or absence of being sentenced with the consistent keyword of the key word information in the corresponding crucial phrase of the ciphertext data request packet
Disconnected, the crucial phrase includes multiple keywords;If existing and the consistent key of the key word information in the crucial phrase
Word obtains the request address information in the ciphertext data request packet;Call service corresponding with the request address information
Interface is to acquire target returned data;The target returned data is sent to the user terminal, so that the user
Terminal carries out MOCK test according to the target returned data.
In one embodiment, it is described according to predetermined keyword information to the corresponding crucial phrase of the ciphertext data request packet
In with the presence or absence of judged with the consistent keyword of the key word information the step of before, further includes: according to default key
Word database carries out keyword identification to the ciphertext data request packet to obtain pass corresponding with the ciphertext data request packet
Keyword group.
In one embodiment, it is described according to predetermined keyword information to the corresponding crucial phrase of the ciphertext data request packet
In with the presence or absence of judged with the consistent keyword of the key word information the step of, comprising: judge in the crucial phrase
With the presence or absence of with the consistent keyword of the first predetermined keyword, wherein first predetermined keyword be characterization test mould
The keyword of formula;If in the crucial phrase exist with the consistent keyword of the first predetermined keyword, judge the key
It whether there is and the consistent keyword of the second predetermined keyword in phrase, wherein second predetermined keyword is characterization
The keyword of request address;If in the crucial phrase exist with the consistent keyword of the second predetermined keyword, determine
Exist and the consistent keyword of the key word information in the crucial phrase.
In one embodiment, with the presence or absence of consistent with first predetermined keyword in the judgement crucial phrase
After the step of keyword, further includes: if being not present and the consistent key of the first predetermined keyword in the crucial phrase
Word, generation error prompting message are simultaneously sent to the user terminal, and the error prompting information includes the described first default key
Word and current point in time.
In one embodiment, described to call service interface corresponding with the request address information to acquire target
The step of returned data, comprising: according to preset interface call list, obtain service corresponding with the request address information and connect
Mouthful;The service interface is called, and receives the primary data of the service interface feedback;According to preset data transformation rule to institute
Primary data is stated to be converted to obtain target returned data.
It is apparent to those skilled in the art that for convenience of description and succinctly, foregoing description is set
The specific work process of standby, device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Those of ordinary skill in the art may be aware that unit described in conjunction with the examples disclosed in the embodiments of the present disclosure and algorithm
Step can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and software
Interchangeability generally describes each exemplary composition and step according to function in the above description.These functions are studied carefully
Unexpectedly the specific application and design constraint depending on technical solution are implemented in hardware or software.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
In several embodiments provided by the present invention, it should be understood that disclosed unit and method, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only logical function partition, there may be another division manner in actual implementation, can also will be with the same function
Unit set is at a unit, such as multiple units or components can be combined or can be integrated into another system or some
Feature can be ignored, or not execute.In addition, shown or discussed mutual coupling, direct-coupling or communication connection can
Be through some interfaces, the indirect coupling or communication connection of device or unit, be also possible to electricity, mechanical or other shapes
Formula connection.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.Some or all of unit therein can be selected to realize the embodiment of the present invention according to the actual needs
Purpose.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, is also possible to two or more units and is integrated in one unit.It is above-mentioned integrated
Unit both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention substantially or
Person says that all or part of the part that contributes to existing technology or the technical solution can body in the form of software products
Reveal and, which is stored in a computer readable storage medium, including some instructions are used so that one
Platform computer equipment (can be personal computer, server or the network equipment etc.) executes described in each embodiment of the present invention
The all or part of the steps of method.And computer readable storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory
The various media that can store program code such as (ROM, Read-Only Memory), magnetic or disk.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace
It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right
It is required that protection scope subject to.
Claims (10)
1. a kind of MOCK test method characterized by comprising
If receiving encryption data request packet transmitted by user terminal, according to encryption data request packet described in preset secret key pair into
Row decryption is to obtain ciphertext data request packet;
It whether there is and the key according to predetermined keyword information in the corresponding crucial phrase of the ciphertext data request packet
The consistent keyword of word information is judged that the crucial phrase includes multiple keywords;
If in the crucial phrase exist with the consistent keyword of the key word information, obtain in the ciphertext data request packet
Request address information;
Call service interface corresponding with the request address information to acquire target returned data;
The target returned data is sent to the user terminal, so that the user terminal is according to the target returned data
Carry out MOCK test.
2. MOCK test method according to claim 1, which is characterized in that it is described according to predetermined keyword information to described
It whether there is in the corresponding crucial phrase of ciphertext data request packet and carry out judging it with the consistent keyword of the key word information
Before, further includes:
Keyword identification is carried out to obtain and the decryption number to the ciphertext data request packet according to predetermined keyword database
According to the corresponding crucial phrase of request packet.
3. MOCK test method according to claim 1, which is characterized in that include first default in the key word information
Keyword and the second predetermined keyword, it is described according to predetermined keyword information to the corresponding keyword of the ciphertext data request packet
It whether there is in group and judged with the consistent keyword of the key word information, comprising:
Judge to whether there is and the consistent keyword of the first predetermined keyword in the crucial phrase, wherein described first
Predetermined keyword is the keyword of characterization test mode;
If in the crucial phrase exist with the consistent keyword of the first predetermined keyword, judge be in the crucial phrase
It is no to exist and the consistent keyword of the second predetermined keyword, wherein second predetermined keyword is characterization request address
Keyword;
If in the crucial phrase exist with the consistent keyword of the second predetermined keyword, determine in the crucial phrase
In the presence of with the consistent keyword of the key word information.
4. MOCK test method according to claim 3, which is characterized in that described to judge whether deposit in the crucial phrase
After the keyword consistent with first predetermined keyword the step of, the method also includes:
If in the crucial phrase there is no with the consistent keyword of the first predetermined keyword, generation error prompting message is simultaneously
It is sent to the user terminal, the error prompting information includes first predetermined keyword and current point in time.
5. MOCK test method according to claim 1, which is characterized in that the calling and the request address information phase
Corresponding service interface is to acquire target returned data, comprising:
According to preset interface call list, service interface corresponding with the request address information is obtained;
The service interface is called, and receives the primary data of the service interface feedback;
The primary data is converted according to preset data transformation rule to obtain target returned data.
6. a kind of MOCK test device characterized by comprising
Data request packet decryption unit, if for receiving encryption data request packet transmitted by user terminal, according to preset secret
The encryption data request packet is decrypted to obtain ciphertext data request packet in key;
Keyword judging unit is used for according to predetermined keyword information in the corresponding crucial phrase of the ciphertext data request packet
Judged with the presence or absence of with the consistent keyword of the key word information, the crucial phrase includes multiple keywords;
Request address information acquiring unit, if for existing and the consistent key of the key word information in the crucial phrase
Word obtains the request address information in the ciphertext data request packet;
Target returned data acquiring unit, for calling service interface corresponding with the request address information to acquire
Target returned data;
Target returned data transmission unit, for the target returned data to be sent to the user terminal, so that the use
Family terminal carries out MOCK test according to the target returned data.
7. MOCK test device according to claim 6, which is characterized in that described device further include:
Crucial phrase acquiring unit, for carrying out keyword knowledge to the ciphertext data request packet according to predetermined keyword database
Not to obtain crucial phrase corresponding with the ciphertext data request packet.
8. MOCK test device according to claim 6, which is characterized in that the keyword judging unit includes:
First judging unit whether there is and the consistent key of the first predetermined keyword in the crucial phrase for judging
Word, wherein first predetermined keyword is the keyword of characterization test mode;
Second judgment unit, if for exist in the crucial phrase with the consistent keyword of the first predetermined keyword, sentence
It whether there is in the crucial phrase of breaking and the consistent keyword of the second predetermined keyword, wherein described second default closes
Keyword is the keyword for characterizing request address;
Judging result acquiring unit, if for existing and the consistent key of the second predetermined keyword in the crucial phrase
Word then determines exist and the consistent keyword of the key word information in the crucial phrase.
9. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor
The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 5 when executing the computer program
Any one of MOCK test method.
10. a kind of computer readable storage medium, which is characterized in that the storage medium is stored with computer program, the meter
Calculation machine program makes the processor execute the test side MOCK according to any one of claims 1 to 5 when being executed by a processor
Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910610941.XA CN110489322A (en) | 2019-07-08 | 2019-07-08 | MOCK test method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910610941.XA CN110489322A (en) | 2019-07-08 | 2019-07-08 | MOCK test method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110489322A true CN110489322A (en) | 2019-11-22 |
Family
ID=68546714
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910610941.XA Pending CN110489322A (en) | 2019-07-08 | 2019-07-08 | MOCK test method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110489322A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111294359A (en) * | 2020-02-27 | 2020-06-16 | 平安养老保险股份有限公司 | Pressure testing method and device, computer equipment and storage medium |
CN111752625A (en) * | 2020-06-23 | 2020-10-09 | 京东数字科技控股有限公司 | Method and device for interface mock |
CN112783787A (en) * | 2021-02-04 | 2021-05-11 | 中国工商银行股份有限公司 | Interface test method, device and system and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528400A (en) * | 2016-09-22 | 2017-03-22 | 深圳峰创智诚科技有限公司 | MOCK testing method and device |
CN109446071A (en) * | 2018-09-26 | 2019-03-08 | 深圳壹账通智能科技有限公司 | Interface test method, interface test device, electronic equipment and storage medium |
CN109743222A (en) * | 2018-12-25 | 2019-05-10 | 瑞庭网络技术(上海)有限公司 | A kind of data test method and relevant device |
-
2019
- 2019-07-08 CN CN201910610941.XA patent/CN110489322A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528400A (en) * | 2016-09-22 | 2017-03-22 | 深圳峰创智诚科技有限公司 | MOCK testing method and device |
CN109446071A (en) * | 2018-09-26 | 2019-03-08 | 深圳壹账通智能科技有限公司 | Interface test method, interface test device, electronic equipment and storage medium |
CN109743222A (en) * | 2018-12-25 | 2019-05-10 | 瑞庭网络技术(上海)有限公司 | A kind of data test method and relevant device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111294359A (en) * | 2020-02-27 | 2020-06-16 | 平安养老保险股份有限公司 | Pressure testing method and device, computer equipment and storage medium |
CN111294359B (en) * | 2020-02-27 | 2023-09-05 | 平安养老保险股份有限公司 | Pressure testing method, pressure testing device, computer equipment and storage medium |
CN111752625A (en) * | 2020-06-23 | 2020-10-09 | 京东数字科技控股有限公司 | Method and device for interface mock |
CN112783787A (en) * | 2021-02-04 | 2021-05-11 | 中国工商银行股份有限公司 | Interface test method, device and system and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI706665B (en) | Blockchain-based data checking system, method, computing equipment and storage media | |
CN110266896A (en) | Method of calling, device, computer equipment and storage medium based on virtual-number | |
CN110009321B (en) | Transfer method and system based on block chain intelligent contract | |
CN110489322A (en) | MOCK test method, device, computer equipment and storage medium | |
CN109240838A (en) | Interface call method, device, computer equipment and storage medium | |
CN110148003A (en) | A kind of carbon emissions trading method and system | |
MX2007005660A (en) | Method and apparatus for provisioning software. | |
CN113268336B (en) | Service acquisition method, device, equipment and readable medium | |
US10310970B2 (en) | Method of automatically testing smart device application program using permission booster | |
CN110162523A (en) | Date storage method, system, device and equipment | |
CN110362318A (en) | Using dispositions method, device, equipment and storage medium | |
CN108829467A (en) | Third-party platform docks implementation method, device, equipment and storage medium | |
CN110197707A (en) | Medical record information processing method, device, medium and electronic equipment based on block chain | |
CN110147685A (en) | Data verification method, system, device and equipment | |
CN112364049A (en) | Data synchronization script generation method, system, terminal and storage medium | |
CN110298167A (en) | Method for managing user right, device, computer equipment and storage medium | |
CN107273250A (en) | The method of testing and device of electronic declaration form automatic cover system | |
US20090169008A1 (en) | System and method for tracking testing of software modification projects from a wireless mobile device | |
CN112989422A (en) | Block chain system assembling method and device, electronic equipment and storage medium | |
CN108343315A (en) | Key management method and terminal device | |
CN106981146B (en) | Billing method based on multiple gold tax discs | |
CN116662132A (en) | Evaluation method, virtual deployment method, computer device, and storage medium | |
WO2022241945A1 (en) | Data processing method and device, and computer-readable storage medium | |
CN115052053A (en) | Message processing method and simulator for bank system test | |
US20110137746A1 (en) | Content distribution system and content distribution method |
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 |