Embodiment
The application is described in further detail below in conjunction with the accompanying drawings.
Fig. 1, which shows to be returned according to a kind of emulating server of the application one side, customizes the of data
The structural representation of one node serve equipment.The first node service equipment includes the He of presetter device 11
Blocking apparatus 12.
Wherein, application implementation method of the presetter device 11 based on first node service equipment, matches somebody with somebody
Put correlation method blocker, and preset virtual objects test condition and satisfaction in methods described blocker
Corresponding expection return value during the virtual objects test condition;The acquisition device 12 is when reception
It is described using the methods described blocker acquisition first service request, parsing to first service request
First service asks to obtain the specified parameter information of service and judge that the specified parameter information of the service is
It is no to meet the virtual objects test condition, the corresponding expected return value is fed back if meeting, if
It is unsatisfactory for, exits methods described blocker.
Here, the first node service equipment includes but is not limited to service equipment or service equipment and net
Network equipment is integrated constituted equipment by network.The service equipment its include but is not limited to any one
The mobile electronic product of man-machine interaction, such as smart mobile phone, PDA can be carried out with user by touch pad by planting
Any operating system can be used Deng, the mobile electronic product, such as android operating systems, iOS are grasped
Make system etc..Wherein, the network equipment include it is a kind of can according to the instruction for being previously set or storing,
The automatic electronic equipment for carrying out numerical computations and information processing, its hardware include but is not limited to microprocessor,
Application specific integrated circuit (ASIC), programmable gate array (FPGA), digital processing unit (DSP), insertion
Formula equipment etc..The network includes but is not limited to internet, wide area network, Metropolitan Area Network (MAN), LAN, VPN nets
Network, wireless self-organization network (Ad Hoc networks) etc..Preferably, first node service equipment may be used also
Be operate in the service equipment or service equipment and the network equipment, touch terminal or the network equipment with
Touch terminal is integrated the shell script in constituted equipment by network.Certainly, people in the art
Member will be understood that above-mentioned first node service equipment is only for example, and other are existing or are likely to occur from now on
First node service equipment is such as applicable to the application, should also be included within the application protection domain, and
It is incorporated herein by reference herein.
Constantly worked between above-mentioned each device, here, it will be understood by those skilled in the art that " lasting "
Refer to above-mentioned each device respectively in real time or according to the mode of operation requirement of setting or real-time adjustment.
It should be noted that the first node service equipment includes one or more, and each
The first node service equipment is deployed in Distributed Application deployed environment on each node respectively, then institute
Stating first node service equipment includes running on the first node service equipment and other node serves
Equipment or customer equipment are made up of system integrating in equipment shell script or application program.It is excellent
Application program in selection of land, the first node service equipment has independent database and single service
Device is disposed, and multiple first node service equipments in Distributed Application deployed environment are corresponded to respectively
The original complete application program of application program composition, a complete application journey that will be originally
Sequence is split as multiple application programs by application, and is respectively deployed in the first node service equipment,
It disclosure satisfy that validation test of the different testers to the different business scene of same complete applications is needed
Ask.In addition, those skilled in the art should be understood that:Any node of Distributed Application deployed environment
The second clothes that service equipment can call for first service node device and by other service node devices simultaneously
Business node device.
In embodiments herein, the presetter device 11 in the first node service equipment
Application implementation method based on first node service equipment, configures correlation method blocker, and described
Preset virtual objects test condition and the virtual objects test condition when institute is met in method blocker
Corresponding expected return value so that, being capable of effective and rapid simulation server when carrying out service call
Return to corresponding expected return value;The blocking apparatus 12 is utilized when receiving first service request
Methods described blocker obtains the first service request, parses the first service request to obtain clothes
Business specifies parameter information and judges that the service is specified parameter information whether to meet the virtual objects and surveyed
Strip part, feeds back the corresponding expected return value if meeting, methods described is exited if being unsatisfactory for
Blocker, effectively economizes on resources and improves simulated object and test the use in service invocation procedure
Flexibility.
Further, the presetter device 11 is used for:Answering based on the first node service equipment
With the execution logic and virtual objects test target of implementation method, the preset void in methods described blocker
Intend object test condition and meet expection return value corresponding during the virtual objects test condition.
It should be noted that the application implementation method of the first node service equipment can be include but
It is not limited to include the technological frame of application program, application program and realizes technical approach or application program
Source program.In embodiments herein, the presetter device 11 is taken based on the first node
The difference of the technological frame of the application program for equipment of being engaged in, configures corresponding method blocker and writes accordingly
Intercept logic program is simultaneously deployed on the first node service equipment.For example, in Open Framework
Under (spring frameworks), then collocation method blocker (Method Interceptor);Based on model
Under view controller (MVC) framework (struts2 frameworks), then collocation method filter interceptors (Method
Filter Interceptor);In the Object Relation Mapping framework (Hibernate frameworks) of open source code
Under, then configure blank blocker (Empty Interceptor).In the preferred embodiment of the application
In, corresponding method blocker (Method is preferably configured under the Open Framework (spring frameworks)
Interceptor).Certainly, those skilled in the art will be understood that above-mentioned in the Open Framework (spring
Framework) under configure one that corresponding method blocker (Method Interceptor) is only the application
Preferred embodiment, other it is existing or be likely to occur from now on can be based on the first node service equipment
The technological frame of application program configure corresponding method blocker, be such as applicable to the application, also should
Within the application protection domain, and it is incorporated herein by reference herein.
In embodiments herein, the execution of the application implementation method of the first node service equipment
Logic can be include but is not limited to be included in described in actual test apply implementation method during, base
A part of or all actual test result letter obtained from the virtual objects test target
Breath.For example, execution logic (the bank paying industry of the application implementation method in first node service equipment
The payment of business returns to situation test) during based on the virtual objects test target (input card number
3 afterwards) tested, wherein, it is likely to occur during test and pays successfully or pay failure
Situations such as, then the preset of actual test object information is carried out according to latter 3 of bank's card number of input,
If input card number after 3 be 123, return pays successfully, if input card number after 3 be 456,
Then return and pay failure.It is preset virtual right in methods described blocker (Method Interceptor)
As test condition (mock conditions) is { 3 are 123 after the card number of input;{ after the card number of input
3 are 456 } }, then meet corresponding during the mock conditions { 3 are 123 after the card number of input }
Expection return value is { paying successfully } or meet the mock conditions { 3 are after the card number of input
Corresponding expection return value is { paying failure } when 456 } so that entered in virtual objects test process
During row service call, can effective and rapid simulation server return to corresponding expected return value.
Further, the presetter device 11 includes:The (not shown) of dispensing unit 111, for base
Tested in different virtual objects, configuring multiple methods describeds in the first node service equipment intercepts
Device;The (not shown) of determining unit 112, for determining that multiple methods described blockers obtain described first
The sequencing of service request.
In embodiments herein, the (not shown) of dispensing unit 111 is based on different virtual
Object is tested, and multiple methods described blockers are configured in first node service equipment.For example, in identity
During demonstrate,proving information gathering application, it can be tested by ID card information in different virtual objects
Is tested accordingly in (business scenario), wherein, the virtual objects test can be include but
It is not limited to include according to by identification card number code check householder sex and by identification card number code check householder
Place province.Then have in the business scenario by identification card number code check householder's sex, if identity card
Number penultimate is odd number, then the householder is male, if ID card No. penultimate is even
Number, then the householder is women;In the business scenario in province where by identification card number code check householder,
If ID card No. front two is 11, the householder is Beijing personage, if ID card No. front two
For 31, then the householder is Shanghai City personage, and ID card No. front two is 44, then the householder is wide
East saves personage.Virtual objects test based on above-mentioned two situations, in the first node service equipment
Corresponding two methods described blockers are configured, wherein, it is preset virtual in methods described blocker 1
Object test condition (mock conditions) is { { ID card No. penultimate is odd number };{ identity
It is even number to demonstrate,prove number penultimate } }, then meeting the mock conditions, { ID card No. is second from the bottom
Position be odd number } when corresponding expection return value be { householder is male }, meet the mock conditions
Corresponding expection return value is { householder is women } when { ID card No. penultimate is even number };
Preset virtual objects test condition (mock conditions) is { { identity card in methods described blocker 2
Number front two is 11 };{ part card number front two is 31 };{ ID card No. front two is 44 } },
Corresponding expection return value is when then meeting the mock conditions { ID card No. front two is 11 }
{ householder is Beijing personage }, meets the mock conditions { ID card No. front two is 31 } when institute
Corresponding expected return value is { householder is Shanghai City personage }, meets the mock conditions { identification card number
Code front two be 44 } when corresponding expection return value be { householder is Guangdong Province personage }.
In the (not shown) of determining unit 112, first service request can have one or
Multiple, the time order and function that the first service got according to multiple methods described blockers is asked is suitable
Sequence, respective virtual object is carried out to determine that multiple methods described blockers are based on first service request
The judgement of test condition, it is pre- in different virtual objects test process to allow to effectively quickly return
Phase return value.
Further, the blocking apparatus 12 is used for:Using methods described blocker to described first
Service request carries out parameter extraction, and parameter information is specified to obtain the service.
In embodiments herein, the first service request includes one or more call parameters
Information and its relevant parameter information, wherein, the service specify parameter information to be blocked by methods described
Cutting device one or more of ask the first service call parameters information and its relevant parameter to be believed
Breath is carried out determined by parameter extraction.For example, in bank's transacting business application, the first service
The call parameters information that request includes opens a bank account householder, bank's card number, bank card number binding hand
Machine number, bank card amount paid and bank card amount received etc., then it is silver to have the relevant parameter information
Capable householder's name information of opening an account, bank's card number specifying information, bank card expenditure detailed bill information and silver
Row card income detailed bill information, if virtual objects test condition preset in methods described blocker
The service judged in (mock conditions) specifies parameter information to be the householder that opens a bank account, then
Call parameters information and its related ginseng in being asked by methods described blocker the first service
Number information carries out parameter extraction, to obtain open a bank account householder and its corresponding householder's name that opens a bank account,
So that it is determined that service specifies parameter information to be open a bank account householder and its name information.
Fig. 2, which shows to be returned according to a kind of emulating server of the application one side, customizes the of data
Service call between one node serve equipment and customer equipment and Section Point service equipment, which coordinates, to be shown
It is intended to.
Wherein, when the customer equipment calls the first node service equipment, then the first segment
Point service equipment obtains the first service request from the customer equipment, and utilizes the first node
Method blocker in service equipment obtains the first service request and the first service is asked
Parameter extraction is carried out, to determine to service specified parameter information;In the first node service equipment
Judge whether the specified services parameter information meets the virtual objects test-strips in method blocker
Part (mock conditions), if meeting, is sent to the client by the corresponding expected return value and sets
It is standby.
For example, when client buys train ticket, all have selected a specific bank and paid the bill, client
Application A in equipment is used to test in the successful situation of bank's return payment, first node service equipment
Application B be used for test bank return pay failure situation, then in the first node service equipment
One method blocker of middle configuration, wherein, methods described blocker, which includes preset virtual objects, to be tested
Condition (mock conditions) and its expection return value corresponding during the mock conditions is met, that is, surveyed
Examination personnel A is during being tested, and the customer equipment (applying A) need to call described first
During node serve equipment (applying B), methods described blocker simulation first node service equipment (should
With B) in be possible to occur test result information:If after preset input card number 3 be 123 when,
Then return pays successfully, if after preset input card number 3 be 456, return pay fail, by
The test result information for being possible to occur is predisposed to corresponding pre- when meeting the mock conditions
Phase return value, and call the first node service equipment (applying B) in customer equipment (applying A)
Test process in, if service specify parameter information meet the mock conditions input card number after 3
For 456 } when, corresponding expected return value { paying successfully } is sent to the customer equipment (applying A),
Realize rapidly emulating server return and meet expection return value corresponding during the mock conditions.
In embodiments herein, in the blocking apparatus 12, when in first service request
Service specify parameter information be unsatisfactory for the virtual objects test condition, then exit methods described interception
Device.
As shown in Fig. 2 wherein, solid line is represented:Tester A test process, dotted line is represented:
Tester B test process.Then have in the test process for the tester A that solid line is represented,
When customer equipment (applying A) calls first node service equipment (applying B), if Application way is blocked
Cutting device asks the service extracted to be specified after parameter information first service, gets a string of mess codes,
Then a string of mess codes specify parameter information to judge the virtual objects test condition as the service
When (mock conditions), it is impossible to meet pre- in the method blocker in the first node service equipment
The mock conditions put, then can exit methods described blocker.
Further, the first node service equipment also includes:The (not shown) of performs device 13,
For after methods described blocker is exited, the first node to be performed based on first service request
The application implementation method of service equipment simultaneously feeds back corresponding executed result.
In above-described embodiment of the application, tester A is in test process, and customer equipment (should
With A) when calling first node service equipment (applying B), if Application way blocker takes to first
The service that business request is extracted specifies parameter information to be a string of mess codes, then a string of mess codes are used as institute
State service and specify parameter information when judging the virtual objects test condition (mock conditions), it is impossible to
The mock conditions are met, then exit methods described blocker;Based on from customer equipment (application
A the application implementation method that first service request) continues executing with the first node service equipment (should
With B source program), to determine the execution knot of the application implementation method (application B source program)
Really, and by the implementing result customer equipment (applying A) is fed back to.
Further, the (not shown) of performs device 13 also includes:First execution unit (does not show
Go out), the second execution unit (not shown) and the 3rd execution unit (not shown), wherein, described
When one execution unit performs the application implementation method of the first node service equipment, when needing to call the
During the application implementation method of two node serve equipment, then second is sent to the Section Point service equipment
Service request;Second execution unit obtains the Section Point service equipment and is based on the described second clothes
The feedback information of business request;3rd execution unit continues executing with described based on the feedback information
The application implementation method of one node serve equipment.
As shown in Fig. 2 in whole applied business scene, performing the first node service equipment
Application implementation method when, realized when needing to call the application of Section Point service equipment (applying C)
During method, the dotted line in wherein Fig. 2 represents tester B test process, then tester B
During being tested, the first node service equipment (applying B) needs to call second section
, then (should to the Section Point service equipment during application implementation method of point service equipment (applying C)
With C) send after second service request, obtain the Section Point service equipment (applying C) and be based on
The feedback information of the second service request, and the first segment is continued executing with based on the feedback information
Application implementation method (application B source program) in point service equipment (applying B).
In above-described embodiment of the application, tester A is during being tested, the visitor
When family equipment (applying A) calls first node service equipment (the applying B), from the visitor
Service in the first service request of family equipment (applying A) specifies parameter information to meet the first segment
The virtual objects test condition (mock conditions) of method blocker in point service equipment (applying B)
When directly return to the expected return value;Tester B is during being tested, and described first
When node serve equipment (applying B) need to call Section Point service equipment (the applying C), to
The Section Point service equipment (applying C) is sent after second service request, and is obtained from described
The feedback information that Section Point service equipment (applying C) is asked based on the second service, and be based on
The feedback information continues executing with the application implementation method of the first node service equipment (applying B),
So as to meet the test under different business scene of two testers in same set of environmental testing
Demand.
Further, the feedback information of the second service request in the (not shown) of performs device 13
Including:The Section Point service equipment is based on its method blocker institute's feedack or based on described
Result performed by the application implementation method of Section Point service equipment.
In embodiments herein, it is anti-that the Section Point service equipment is based on its method blocker institute
The information of feedback includes:Service in the second service request specifies parameter information to meet the second section
Virtual objects test condition (mock conditions) when institute in method blocker in point service equipment is right
The expection return value answered;Performed by the application implementation method based on the Section Point service equipment
Result include:Service in the second service request specifies parameter information to be unsatisfactory for the second section
When putting virtual objects test condition (the mock conditions) in the method blocker in service equipment, move back
After the method blocker for going out the Section Point service equipment, institute is performed based on second service request
State the result obtained by the application implementation method of Section Point service equipment.
For example, the feedback information of the second service request includes:The Section Point service is met to set
Institute is right during virtual objects test condition (the mock conditions) of the method blocker in standby (applying C)
The expection return value answered, or the execution Section Point service equipment is asked based on the second service
Using the result of the gained of implementation method (application C source program).
Fig. 3 shows one kind according to the application one side in first node service equipment end analog service
Device returns to the method flow schematic diagram for customizing data.The method comprising the steps of S11 and step S12.
Wherein, application implementation methods of the step S11 based on first node service equipment, configures phase
Induction method blocker, and preset virtual objects test condition and satisfaction are described in methods described blocker
Corresponding expection return value during virtual objects test condition;The step S12, which works as, receives the first clothes
Business request, obtains the first service request using methods described blocker, parses the first service
Ask to obtain the specified parameter information of service and judge that the service specifies whether parameter information meets institute
Virtual objects test condition is stated, the corresponding expected return value is fed back if meeting, if being unsatisfactory for
Exit methods described blocker.
It should be noted that the first node service equipment includes one or more, and each
The first node service equipment is deployed in Distributed Application deployed environment on each node respectively, then institute
Stating first node service equipment includes running on the first node service equipment and other node serves
Equipment or customer equipment are made up of system integrating in equipment shell script or application program.It is excellent
Application program in selection of land, the first node service equipment has independent database and single service
Device is disposed, and multiple first node service equipments in Distributed Application deployed environment are corresponded to respectively
The original complete application program of application program composition, a complete application journey that will be originally
Sequence is split as multiple application programs by application, and is respectively deployed in the first node service equipment,
It disclosure satisfy that validation test of the different testers to the different business scene of same complete applications is needed
Ask.
In embodiments herein, applications of the step S11 based on first node service equipment is real
Existing method, configures correlation method blocker, and the preset virtual objects test in methods described blocker
Condition and meet expection return value corresponding during the virtual objects test condition so that taken
Business is when calling, can effective and rapid simulation server return to corresponding expected return value;The step
S12, which works as, receives first service request, asked using the methods described blocker acquisition first service,
The first service request is parsed to obtain the specified parameter information of service and judge that ginseng is specified in the service
Whether number information meets the virtual objects test condition, feeds back the corresponding expection if meeting and returns
Return value, methods described blocker is exited if being unsatisfactory for, effectively economize on resources and improve simulation pair
As testing the use flexibility in service invocation procedure.
Further, the step S11 includes:Realization side is applied based on first node service equipment
Method, configures correlation method blocker, and the preset virtual objects test condition in methods described blocker
And meet expection return value corresponding during the virtual objects test condition;Specifically, the step
S11 includes:The execution logic of application implementation method based on the first node service equipment and virtual
Object test target, preset virtual objects test condition and the void is met in methods described blocker
Intend expection return value corresponding during object test condition.
It should be noted that the application implementation method of the first node service equipment can be include but
It is not limited to include the technological frame of application program, application program and realizes technical approach or application program
Source program.In embodiments herein, the step S11 is set based on the first node service
The difference of the technological frame of standby application program, configures corresponding method blocker and writes corresponding interception
Logical program is simultaneously deployed on the first node service equipment.For example, in Open Framework (spring
Framework) under, then collocation method blocker (Method Interceptor);Controlled based on model view
Under device (MVC) framework (struts2 frameworks), then collocation method filter interceptors (Method Filter
Interceptor);Under the Object Relation Mapping framework (Hibernate frameworks) of open source code, then
Configure blank blocker (Empty Interceptor).It is excellent in the preferred embodiment of the application
It is selected under the Open Framework (spring frameworks) and configures corresponding method blocker (Method
Interceptor).Certainly, those skilled in the art will be understood that above-mentioned in the Open Framework (spring
Framework) under configure one that corresponding method blocker (Method Interceptor) is only the application
Preferred embodiment, other it is existing or be likely to occur from now on can be based on the first node service equipment
The technological frame of application program configure corresponding method blocker, be such as applicable to the application, also should
Within the application protection domain, and it is incorporated herein by reference herein.
In embodiments herein, the execution of the application implementation method of the first node service equipment
Logic can be include but is not limited to be included in described in actual test apply implementation method during, base
A part of or all actual test result letter obtained from the virtual objects test target
Breath.For example, execution logic (the bank paying industry of the application implementation method in first node service equipment
The payment of business returns to situation test) during based on the virtual objects test target (input card number
3 afterwards) tested, wherein, it is likely to occur during test and pays successfully or pay failure
Situations such as, then the preset of actual test object information is carried out according to latter 3 of bank's card number of input,
If input card number after 3 be 123, return pays successfully, if input card number after 3 be 456,
Then return and pay failure.It is preset virtual right in methods described blocker (Method Interceptor)
As test condition (mock conditions) is { 3 are 123 after the card number of input;{ after the card number of input
3 are 456 } }, then meet corresponding during the mock conditions { 3 are 123 after the card number of input }
Expection return value is { paying successfully } or meet the mock conditions { 3 are after the card number of input
Corresponding expection return value is { paying failure } when 456 } so that entered in virtual objects test process
During row service call, can effective and rapid simulation server return to corresponding expected return value.
Further, the step S11 includes:Realization side is applied based on first node service equipment
Method, configures correlation method blocker, and the preset virtual objects test condition in methods described blocker
And meet expection return value corresponding during the virtual objects test condition;Specifically, the step
S11 includes step S111 (not shown) and step S112 (not shown), wherein, the step S111
(not shown) includes:Tested, matched somebody with somebody in the first node service equipment based on different virtual objects
Put multiple methods described blockers;The step S112 (not shown) includes:Determine multiple sides
Method blocker obtains the sequencing of the first service request.
In embodiments herein, the step S111 (not shown) is based on different virtual objects
Test, multiple methods described blockers are configured in first node service equipment.For example, in identity card letter
During ceasing acquisition applications, (business can be tested in different virtual objects by ID card information
Scene) in tested accordingly, wherein, it can include but is not limited to that the virtual objects, which are tested,
Including according to by identification card number code check householder sex and by being saved where identification card number code check householder
Part.Then have in the business scenario by identification card number code check householder's sex, if ID card No. is fallen
Number second is odd number, then the householder is male, if ID card No. penultimate is even number,
The householder is women;In the business scenario in province where by identification card number code check householder, if body
Part card number front two is 11, then the householder is Beijing personage, if ID card No. front two is
31, then the householder is Shanghai City personage, and ID card No. front two is 44, then the householder is Guangdong Province
Personage.Virtual objects test based on above-mentioned two situations, in first node service equipment configuration
Corresponding two methods described blockers, wherein, preset virtual objects in methods described blocker 1
Test condition (mock conditions) is { { ID card No. penultimate is odd number };{ identification card number
Code penultimate is even number } }, then meeting the mock conditions, { ID card No. penultimate is
Odd number } when corresponding expection return value be { householder is male }, meet the mock conditions { identity
It is even number to demonstrate,prove number penultimate } when corresponding expection return value be { householder is women };It is described
Preset virtual objects test condition (mock conditions) is { { ID card No. in method blocker 2
Front two is 11 };{ part card number front two is 31 };{ ID card No. front two is 44 } }, then
Corresponding expection return value is when meeting the mock conditions { ID card No. front two is 11 }
{ householder is Beijing personage }, meets the mock conditions { ID card No. front two is 31 } when institute
Corresponding expected return value is { householder is Shanghai City personage }, meets the mock conditions { identification card number
Code front two be 44 } when corresponding expection return value be { householder is Guangdong Province personage }.
In the step S112 (not shown), the first service request can have one or more,
The time order and function order that the first service got according to multiple methods described blockers is asked, with
Determine that multiple methods described blockers are based on first service request and carry out respective virtual object test
The judgement of condition, to allow to effectively quickly return to the expection in different virtual objects test process and return
Return value.
Further, the parsing first service request in the step S12 is specified with obtaining service
Parameter information includes:Parameter extraction is carried out to first service request using methods described blocker,
Parameter information is specified to obtain the service.
In embodiments herein, the first service request includes one or more call parameters
Information and its relevant parameter information, wherein, the service specify parameter information to be blocked by methods described
Cutting device one or more of ask the first service call parameters information and its relevant parameter to be believed
Breath is carried out determined by parameter extraction.For example, in bank's transacting business application, the first service
The call parameters information that request includes opens a bank account householder, bank's card number, bank card number binding hand
Machine number, bank card amount paid and bank card amount received etc., then it is silver to have the relevant parameter information
Capable householder's name information of opening an account, bank's card number specifying information, bank card expenditure detailed bill information and silver
Row card income detailed bill information, if virtual objects test condition preset in methods described blocker
The service judged in (mock conditions) specifies parameter information to be the householder that opens a bank account, then
Call parameters information and its related ginseng in being asked by methods described blocker the first service
Number information carries out parameter extraction, to obtain open a bank account householder and its corresponding householder's name that opens a bank account,
So that it is determined that service specifies parameter information to be open a bank account householder and its name information.
Fig. 2, which shows to be returned according to a kind of emulating server of the application one side, customizes the of data
Service call flow between one node serve equipment and customer equipment and Section Point service equipment is shown
It is intended to.
Wherein, when the customer equipment calls the first node service equipment, then the first segment
Point service equipment obtains the first service request from the customer equipment, and utilizes the first node
Method blocker in service equipment obtains the first service request and the first service is asked
Parameter extraction is carried out, to determine to service specified parameter information;In the first node service equipment
Judge whether the specified services parameter information meets the virtual objects test-strips in method blocker
Part (mock conditions), if meeting, is sent to the client by the corresponding expected return value and sets
It is standby.
For example, when client buys train ticket, all have selected a specific bank and paid the bill, client
Application A in equipment is used to test in the successful situation of bank's return payment, first node service equipment
Application B be used for test bank return pay failure situation, then in the first node service equipment
One method blocker of middle configuration, wherein, methods described blocker, which includes preset virtual objects, to be tested
Condition (mock conditions) and its expection return value corresponding during the mock conditions is met, that is, surveyed
Examination personnel A is during being tested, and the customer equipment (applying A) need to call described first
During node serve equipment (applying B), methods described blocker simulation first node service equipment (should
With B) in be possible to occur test result information:If after preset input card number 3 be 123 when,
Then return pays successfully, if after preset input card number 3 be 456, return pay fail, by
The test result information for being possible to occur is predisposed to corresponding pre- when meeting the mock conditions
Phase return value, and call the first node service equipment (applying B) in customer equipment (applying A)
Test process in, if service specify parameter information meet the mock conditions input card number after 3
For 456 } when, corresponding expected return value { paying successfully } is sent to the customer equipment (applying A),
Realize rapidly emulating server return and meet expection return value corresponding during the mock conditions.
In embodiments herein, in the step S12, the clothes in first service request
Business specifies parameter information to be unsatisfactory for the virtual objects test condition, then exits methods described blocker.
As shown in Fig. 2 wherein, solid line is represented:Tester A test process, dotted line is represented:
Tester B test process.Then have in the test process for the tester A that solid line is represented,
When customer equipment (applying A) calls first node service equipment (applying B), if Application way is blocked
Cutting device asks the service extracted to be specified after parameter information first service, gets a string of mess codes,
Then a string of mess codes specify parameter information to judge the virtual objects test condition as the service
When (mock conditions), it is impossible to meet pre- in the method blocker in the first node service equipment
The mock conditions put, then can exit methods described blocker.
Further, methods described also includes:Step S13 (not shown), wherein, the step
S13 (not shown) includes:After methods described blocker is exited, based on first service request
Perform the application implementation method of the first node service equipment and feed back corresponding executed result.
In above-described embodiment of the application, tester A is in test process, and customer equipment (should
With A) when calling first node service equipment (applying B), if Application way blocker takes to first
The service that business request is extracted specifies parameter information to be a string of mess codes, then a string of mess codes are used as institute
State service and specify parameter information when judging the virtual objects test condition (mock conditions), it is impossible to
The mock conditions are met, then exit methods described blocker;Based on from customer equipment (application
A the application implementation method that first service request) continues executing with the first node service equipment (should
With B source program), to determine the execution knot of the application implementation method (application B source program)
Really, and by the implementing result customer equipment (applying A) is fed back to.
Further, the step S13 (not shown) also includes:Perform the first node service
During the application implementation method of equipment, when the application implementation method for needing to call Section Point service equipment,
Then second service request is sent to the Section Point service equipment;The Section Point service is obtained to set
The standby feedback information asked based on the second service;Described is continued executing with based on the feedback information
The application implementation method of one node serve equipment.
As shown in Fig. 2 in whole applied business scene, performing the first node service equipment
Application implementation method when, realized when needing to call the application of Section Point service equipment (applying C)
During method, the dotted line in wherein Fig. 2 represents tester B test process, then tester B
During being tested, the first node service equipment (applying B) needs to call second section
, then (should to the Section Point service equipment during application implementation method of point service equipment (applying C)
With C) send after second service request, obtain the Section Point service equipment (applying C) and be based on
The feedback information of the second service request, and the first segment is continued executing with based on the feedback information
Application implementation method (application B source program) in point service equipment (applying B).
In above-described embodiment of the application, tester A is during being tested, the visitor
When family equipment (applying A) calls first node service equipment (the applying B), from the visitor
Service in the first service request of family equipment (applying A) specifies parameter information to meet the first segment
The virtual objects test condition (mock conditions) of method blocker in point service equipment (applying B)
When directly return to the expected return value;Tester B is during being tested, and described first
When node serve equipment (applying B) need to call Section Point service equipment (the applying C), to
The Section Point service equipment (applying C) is sent after second service request, and is obtained from described
The feedback information that Section Point service equipment (applying C) is asked based on the second service, and be based on
The feedback information continues executing with the application implementation method of the first node service equipment (applying B),
So as to meet the test under different business scene of two testers in same set of environmental testing
Demand.
Further, the feedback information bag of the second service request in the step S13 (not shown)
Include:The Section Point service equipment is based on its method blocker institute's feedack or based on described the
Result performed by the application implementation method of two node serve equipment.
In embodiments herein, it is anti-that the Section Point service equipment is based on its method blocker institute
The information of feedback includes:Service in the second service request specifies parameter information to meet the second section
Virtual objects test condition (mock conditions) when institute in method blocker in point service equipment is right
The expection return value answered;Performed by the application implementation method based on the Section Point service equipment
Result include:Service in the second service request specifies parameter information to be unsatisfactory for the second section
When putting virtual objects test condition (the mock conditions) in the method blocker in service equipment, move back
After the method blocker for going out the Section Point service equipment, institute is performed based on second service request
State the result obtained by the application implementation method of Section Point service equipment.
For example, the feedback information of the second service request includes:The Section Point service is met to set
Institute is right during virtual objects test condition (the mock conditions) of the method blocker in standby (applying C)
The expection return value answered, or the execution Section Point service equipment is asked based on the second service
Using the result of the gained of implementation method (application C source program).
Fig. 4 shows one kind according to a preferred embodiment of the application another aspect in first node
Service equipment end emulating server returns to the method overall flow schematic diagram for customizing data.This method bag
Include step S101, step S102, step S103, step S104, step S105, step S106.
Wherein, the step S101 configurations correlation method blocker, and preset virtual objects test-strips
Part (mock conditions) and corresponding expected return value;The step S102 obtains first service request;
The step S103 carries out parameter extraction to first service request;The step S104 judges
It is no to meet mock conditions, if meeting, step S105 is performed, if it is not satisfied, then performing step S106;
The step S105 sends corresponding expected return value;The step S106 exits method blocker simultaneously
Perform the application implementation method of first node service equipment.
In the application above preferred embodiment, the step S101 is based on first node service equipment
Application implementation method, configure correlation method blocker, and preset virtual in methods described blocker
Object test condition and meet expection return value corresponding during the virtual objects test condition;It is described
Step S102 obtains the first service request from customer equipment, wherein, the first service request
Parameter information is specified comprising service;The step S103 is using methods described blocker to described first
Service request carries out parameter extraction, and parameter information is specified to obtain the service;The step S104
Judge that the service specifies whether parameter information meets the virtual objects using methods described blocker
Test condition, performs step S105 if meeting, if it is not satisfied, then performing step S106;It is described
Step S105 feedbacks meet during the virtual objects test condition the corresponding expected return value to institute
State customer equipment;If the step S106 services are specified parameter information to be unsatisfactory for methods described and blocked
Virtual objects test condition preset in device is cut, then exits methods described blocker;Based on described first
Service request continues executing with the application implementation method of the first node service equipment, determines implementing result
And feed back.
Compared with prior art, one kind according to embodiments herein is set in first node service
Standby end emulating server returns to the method and apparatus for customizing data, by being set based on first node service
Standby application implementation method, configures correlation method blocker, and the preset void in methods described blocker
Intend object test condition and meet expection return value corresponding during the virtual objects test condition, make
Obtain before needing to carry out the virtual objects test in advance in each first service node device upper-level threshold
It has been worth the virtual objects test condition and has met corresponding expection during the virtual objects test condition
Return value, can when carrying out service call, can effective and rapid simulation server return it is corresponding
It is expected that return value;Further, when receiving first service request, obtained using methods described blocker
Take first service request, parse the first service request with obtain service specify parameter information,
And judge that the service specifies whether parameter information meets the virtual objects test condition, if meeting
The corresponding expected return value is fed back, methods described blocker is exited if being unsatisfactory for, is effectively saved
About resource and improve simulated object and test use flexibility in service invocation procedure.
Further, a kind of emulating server according to embodiments herein, which is returned, customizes number
According to method and apparatus, after methods described blocker is exited, based on the first service ask perform
The application implementation method of the first node service equipment simultaneously feeds back corresponding executed result, effectively improves
Simulated object tests the use flexibility in service invocation procedure.
It should be noted that the application can be carried out in the assembly of software and/or software and hardware, example
Such as, it can be set using application specific integrated circuit (ASIC), general purpose computer or any other similar hardware
It is standby to realize.In one embodiment, the software program of the application can be realized by computing device
Steps described above or function.Similarly, the software program (including related data structure) of the application
Can be stored in computer readable recording medium storing program for performing, for example, RAM memory, magnetically or optically driver or
Floppy disc and similar devices.In addition, some steps or function of the application can employ hardware to realize, example
Such as, as coordinating with processor so as to performing the circuit of each step or function.
In addition, the part of the application can be applied to computer program product, such as computer journey
Sequence is instructed, and when it is computer-executed, by the operation of the computer, can be called or be provided
According to the present processes and/or technical scheme.And the programmed instruction of the present processes is called, can
It can be stored in fixed or moveable recording medium, and/or be held by broadcast or other signals
Carry the data flow in media and be transmitted, and/or be stored in the meter according to described program instruction operation
In the working storage for calculating machine equipment.Here, including a dress according to one embodiment of the application
Put, the device includes being used to store the memory of computer program instructions and for execute program instructions
Processor, wherein, when the computer program instructions are by the computing device, trigger the device
The methods and/or techniques scheme based on foregoing multiple embodiments according to the application of operation.
It is obvious to a person skilled in the art that the application is not limited to the thin of above-mentioned one exemplary embodiment
Section, and in the case of without departing substantially from spirit herein or essential characteristic, can be with other specific
Form realizes the application.Therefore, no matter from the point of view of which point, embodiment all should be regarded as exemplary
, and be nonrestrictive, scope of the present application is limited by appended claims rather than described above
It is fixed, it is intended that all changes fallen in the implication and scope of the equivalency of claim are included
In the application.The right that any reference in claim should not be considered as involved by limitation will
Ask.Furthermore, it is to be understood that the word of " comprising " one is not excluded for other units or step, odd number is not excluded for plural number.Dress
Software can also be passed through by a unit or device by putting the multiple units stated in claim or device
Or hardware is realized.The first, the second grade word is used for representing title, and is not offered as any specific
Order.