Specific embodiment
To keep the purposes, technical schemes and advantages of the application clearer, below in conjunction with the application specific embodiment and
Technical scheme is clearly and completely described in corresponding attached drawing.Obviously, described embodiment is only the application one
Section Example, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not doing
Every other embodiment obtained under the premise of creative work out, shall fall in the protection scope of this application.
Fig. 1 is the process of service test method provided by the embodiments of the present application, specifically includes the following steps:
S101: at least two business function API that package platforms are provided according to service node generate the industry of the service node
Be engaged in node API.
S102: for package platforms when receiving first call request of the test macro to the service node API, determining should
Corresponding first call result of first call request, and return to test macro.
In the embodiment of the present application, the package platforms can be used for that (business includes to the business of service node
But it is not limited to: business function API and other business datums etc.) platform that is packaged and verifies, the package platforms can be with
It is equipped in server or terminal.The server includes but is not limited to: large and medium-sized computer, computer cluster etc..The end
End includes but is not limited to: personal computer, mobile phone, tablet computer, smartwatch, vehicle-mounted mobile platform etc..It carries and described executes master
The equipment of body does not constitute the restriction to the application.
The application to the particular content of the business and without limitation, the business can be electric business business, payment transaction,
Application in the terminals such as financial business, communication traffic, communication service, multimedia service can provide business.The test macro
It can be any application system, for example, service application, the automatic test platform based on nominative testing frame, semi-automatic survey
Try platform, manual test platform, etc..
Service test method provided by the embodiments of the present application can be used for testing any one based on software or software and hardware combining
Business, each service node that may be used for different business, when testing the business may also be different.For it is to be based on institute
It states the business to be measured that service test method is tested and is known as business to be measured, then the service node in step S101 can
To be to need any one service node to be used when testing the business to be measured.Wherein, each service node can be located at the same industry
It is engaged on server, can also be located on different service servers.
It is illustrated by taking payment transaction as an example.Under the business scenario that user is paid using credit card, corresponding industry
The service node that business link includes is successively are as follows: the business section of the service node of entitled " cashier ", entitled " charging core "
Point, the service node of entitled " payment core ", etc..For ease of description, it is indicated directly below with the title of service node
The service node.
Correspondingly, after having submitted a service request Fig. 2 shows hypothesis user, the processing stream of corresponding each service node
(some steps are omitted) in journey schematic diagram, mainly comprise the steps that
S201: user sends payment request to cashier by terminal.
S202: cashier sends pre- accounting request according to the payment request, to charging core.
S203: charging core takes request on the estimation, generates pre- charging result and returns to cashier.
S204: cashier sends payment request to create to payment core.
S205: payment core generates payment creation result and returns to cashier according to payment request to create.
S206: cashier takes result and payment creation as a result, generating payment result, and return to terminal on the estimation.
It can be seen that cashier provides S202, S204, S206 these three steps correlation in above service link
Business, charging core provides the relevant business of S203 the step, and it is relevant that payment core provides S205 the step
Business.For these three service nodes, each node both provides multiple business function API and realizes the corresponding industry of the service node
Business.
According to explanation in the background technology, in the prior art, test is carried out to a service link and is specifically included: according to
The business that secondary each service node on the service link provides is tested, and therefore, research staff is writing test case,
For each service node, multiple business function API of the service node will be used, correspondingly, test macro is executing survey
When example on probation, also to call these business functions API in large quantities, therefore, the processing load of test macro is larger, testing efficiency compared with
It is low.
It is illustrated by taking charging core as an example, for charging core when realizing step S203, the business provided specifically includes that production
Product creation, contract creation, billing of services this three (in practical applications, may include more).Wherein, each single item specifically may be used
To correspond to one or more business function API that charging core provides, specifically, assuming above three corresponding business functions
API is respectively as follows: product creation API, contract creation API, billing of services API.Then in the prior art, the industry of charging core is tested
The particular number for needing to call these three types API, these three types of API when business is at least three.In this case, test macro is being surveyed
When trying the business of charging core, these three types of API are called respectively, the processing load of test macro is larger, and testing efficiency is lower.
To solve the above-mentioned problems, in the embodiment of the present application, for any service node, package platforms can be right in advance
The service node provides each business function API and is packaged, and the API generated after encapsulation is known as by the application: the service node
Service node API (function of the service node API includes but is not limited to: the function of each business function API).
In this case, when research staff constructs test logic in test case, the industry of service node can be called
Be engaged in node API, and does not have to each business function API for calling service node one by one.It, can be with after research staff has write test case
The implementation of test cases in test macro, when executing to for calling the code section of each business function API, test macro phase
Sending to package platforms with answering (in the embodiment of the present application, can will be to service node to the call request of service node API
The call request of API is known as: the first call request), in turn, package platforms can execute step S102.
By the above method, compared with the prior art, it is possible to reduce the API that test macro is called when testing service link
Quantity therefore can reduce the processing load of test macro, improve testing efficiency, used it is also possible to reduce and write test
The cost of example.
In the embodiment of the present application, for above-mentioned steps S101, the service node API of the service node is generated, specifically may be used
To comprise determining that at least two business function API of service node offer;Object assembling component based on a specified, to described
At least two business function API are packaged, and generate the service node API of the service node.Wherein, the object assembling component
For being assembled to data such as the attributes and function for including in each business function API with encapsulation, the object assembling component
It can directly obtain in general tool assembly from the prior art, in this case, it is possible to reduce the constructions cost of package platforms.
Certainly, business higher for security level can also be not based on institute to reduce service node API risk under attack
It states object assembling component package and generates service node API, but non-universal component can be developed by research staff for encapsulating
Generate service node API.
It further, in practical applications, can also be according to business scenario, to business function when generating service node API
Energy API carries out heavy duty, the number of the parameter of business function API can be reduced by the operation of the heavy duty, and/or change business
The type of the parameter of function API, the business function API after making heavy duty is more suitable for the business scenario, then based on a specified again
Object assembling component is packaged the business function API, generates service node API.
In the prior art, it will not generally be verified in test script, but manual analysis service link is final
Calculated result, if it is problematic, then problem investigation is carried out to each service node on the service link and therefore not only expends people
Power resource, and it is lower to the verification efficiency of service link.
And in the embodiment of the present application, in addition to the corresponding call result of the first call request (is properly termed as first below
Call result), and return to except test macro, it is also based on the verification API of the pre-generated service node of package platforms,
The first call result of the service node API of the service node is verified, and check results are returned into test macro.From
And package platforms may be implemented, service link is verified automatically, this verification mode has liberated human resources, and to industry
The verification efficiency of business link is higher.
Specifically, other than executing step S101 and S102 following steps can also be performed: package platforms in package platforms
According at least two business function API that the service node provides, the verification API of the service node is generated;Package platforms, which are worked as, to be connect
Receive test macro (in the embodiment of the present application, can will ask the call request of the verification API to the calling of verification API
Ask referred to as: the second call request) when, the first call result of the service node API is verified, using check results as
Corresponding second call result of second call request, and return to test macro.
More specifically, the verification API for generating the service node, can specifically include: determine that the service node provides extremely
Few two business function API;By Data Access Components based on a specified and object assembling component, at least two business
Function API is packaged, and generates the verification API of the service node.
It should be noted that similar with object assembling component, the Data Access Components can also lead to from the prior art
It is directly obtained in tool assembly, the Data Access Components for checking procedure for providing to the relevant data of service node
The access in library is supported.In general, the industry encapsulated in the service node API and service node API the two of the same service node
Business function API be it is different, behind can illustrate and be illustrated.
According to above-mentioned explanation, under a business scenario, package platforms can give birth to for each service node respectively in advance
It, should at a service node API and verification an API, service node API for calculating the business of the service node
Verification API is for verifying calculated result.In this case, when testing service link, test macro can
To receive each service node in the service link to the calculated result and the corresponding verifying of each calculated result of business
As a result.
It is mainly based upon package platforms encapsulation service node API and verification API above, illustrates that the embodiment of the present application provides
Service test method process, further, below based on package platforms receive test macro business processing request field
Scape illustrates the process of another service test method provided by the embodiments of the present application, as shown in figure 3, specifically includes the following steps:
S301: package platforms receive the business processing request of test macro, wherein include pair in the business processing request
The first call request of the service node API of each service node, service node API are at least two business function to service node
What energy API was generated after being packaged.
In the embodiment of the present application, the business processing request can be test macro in implementation of test cases to encapsulation
What platform was sent.It can preassign that (referred to as: use-case refers in business processing request to the calling of each service node API sequence
Determine scheme), alternatively, can also be determined by package platforms after receiving the business processing request according to preset rules
(referred to as: package platforms specified scheme).
S302: package platforms call each business function API encapsulated in each service node API;
S303: package platforms receive the first call result that each service node returns, and described first is called and is tied
Fruit returns to test macro.
By the above method, compared with the prior art, it is possible to reduce the API that test macro is called when testing service link
Quantity therefore can reduce the processing load of test macro, improve testing efficiency, used it is also possible to reduce and write test
The cost of example.
In the embodiment of the present application, the output of any service node API may be as the defeated of another service node API
Entering, the input of any service node API is also likely to be the output of another service node API, in this case, package platforms
According to different processing sequences, when handling each first call request, corresponding each first call result determined may not also
Together, in general, package platforms can be handled each according to the sequence of each service node in test macro service link to be tested
First call request.
Therefore, for step S302, each business function API encapsulated in each service node API is called, it specifically can be with
It include: that service link is determined according to each first call request for including in business processing request;According to the service link
On each service node sequence, successively handle corresponding first call request of each service node, wherein it is every processing one
When corresponding first call request of service node, each business function API encapsulated in service node API is called.
Further, each business function API encapsulated in each service node API is called, can specifically include: according to
Each first call request for including in the business processing request, determines service link;According to each industry on the service link
The sequence of business node, successively handles corresponding first call request of each service node, wherein one service node of every processing
When corresponding first call request, each business function API encapsulated in service node API is called.
Further, it according to each first call request for including in business processing request, determines service link, has
Body may include: the corresponding service node of each first call request for including in the determining business processing request;According to each
Sequence of one call request in business processing request, the corresponding service node of each first call request is connect according to described
It receives sequential series, constitutes service link (corresponding to above-mentioned use-case specified scheme);Alternatively, according to each first call request
Corresponding service node is constituted service link according to preset rules (corresponding to above-mentioned package platforms specified scheme).
In the embodiment of the present application, the verification to each service node can also be included in the business processing request
The second call request of API, verification API is generated after being packaged at least two business function API of service node, institute
The method of stating can also include: to verify to the first call result of each service node API, using check results as this
Corresponding second call result of two call requests, and return to test macro.
In order to make it easy to understand, below by taking the payment transaction in practical application as an example, to business provided by the embodiments of the present application
The process of test method is illustrated, as shown in figure 4, can specifically include following steps:
S401: user (such as research staff) triggers test macro and executes payment test case, wherein in the test case
It at least may include the code segment being called for the service node API to charging core with verification API, and to payment core
The code segment that the service node API and verification API of the heart are called.
It should be noted that for this service node of cashier, since its major function is turned to business information
Hair, and and business calculation processing it is less, the probability that traffic issues occur is relatively low.Therefore, write test case when
It waits, test case directly can be written with by the relevant code of forwarding logic, can not have to generate business for this service node
Node API and verification API, so that the processing load of package platforms can also be reduced.
S402: test macro sends the first call request to the service node API of charging core to package platforms, and
Send the first call request of the service node API to payment core.
S403: package platforms, which determine charging core respectively and pay core, calls knot for the first of the first call request
Fruit, and return to test macro.
S404: test macro sends the second call request of the verification API to charging core to package platforms.
S405: package platforms are called according to second call request, to charging core for the first of the first call request
As a result it is verified, and check results is returned into test macro.
S406: test macro sends the second call request to the verification API of payment core to package platforms.
S407: package platforms are called according to second call request, to payment core for the first of the first call request
As a result it is verified, and check results is returned into test macro.
S408: test macro to each first call result and corresponding each check results that receive carry out integration and/
Or analysis, the test result to service link is obtained, and test result is returned into user.
It should be noted that in practical applications, it can be after the calculated result for determining each service node at once to this
Calculated result is verified, and can also be carried out respectively to each calculated result again after the calculated result for determining whole service nodes
Verification, etc..Therefore, the process under a kind of practical application scene is illustrated only in Fig. 4, the application is to each step in Fig. 4
Execution sequence and without limitation.
In order to make it easy to understand, the embodiment of the present application provides a kind of system architecture diagram of the package platforms, such as Fig. 5 institute
Show.
Package platforms in Fig. 5 may include four layers: business and the verification service shop front, business and verification encapsulated layer, business
Dependent Layer, general utility tool layer.The package platforms can be right in business and verification encapsulated layer based on the component in general utility tool layer
The business (specifically can be business function API) of business Dependent Layer is packaged, thus, it generates business and verifies each in the shop front
To be supplied to user and test macro (3 test macros are shown in FIG. 5 in service node API and corresponding each verification API
Interaction between package platforms) it uses.
Further, the embodiment of the present application provide additionally provide it is a kind of in the package platforms of Fig. 5, it is raw for charging core
At the schematic diagram of service node API and verification API, as shown in Figure 6.
It can be seen that basically illustrating the encapsulation of the business to charging core in Fig. 6.After call charge service API is encapsulation
The service node API of generation;Charging verification API is the verification API generated after encapsulating.It wherein, can be in call charge service API
The corresponding business function API of several business such as encapsulating products creation, contract creation, billing of services, can be in charging verification API
The corresponding business function API of several business such as encapsulating products inquiry, charge bill inquiry.
The above are service test methods provided by the embodiments of the present application, are based on same thinking, and the embodiment of the present application also mentions
For corresponding operational trials device, as shown in Figure 7, Figure 8.
Fig. 7 is the operational trials apparatus structure schematic diagram provided by the embodiments of the present application corresponding to Fig. 1, is specifically included:
First generation module 701, at least two business function API for being provided according to service node, generates the business
The service node API of node;
First determining module 702 receives first call request of the test macro to the service node API for working as
When, determine corresponding first call result of first call request, and return to test macro.
First generation module 701 is specifically used for: determining at least two business function API that the service node provides;
Object assembling component based on a specified is packaged at least two business functions API, generates the business of the service node
Node API.
Described device further include:
Second generation module 703, at least two business function API for being provided according to the service node, generates the industry
The verification API of business node;
Second determining module 704, for when receive test macro to it is described verification API the second call request when, it is right
The first call result of the service node API is verified, using check results as second call request corresponding second
Call result, and return to test macro.
Second generation module 703 is specifically used for: determining at least two business function API that the service node provides;
By Data Access Components based on a specified and object assembling component, at least two business functions API is packaged, it is raw
At the verification API of the service node.
Specific above-mentioned device as shown in Figure 7 can be on terminal, server.
Fig. 8 is the operational trials apparatus structure schematic diagram provided by the embodiments of the present application corresponding to Fig. 3, is specifically included:
Receiving module 801 receives the business processing request of test macro, wherein includes pair in the business processing request
The first call request of the service node API of each service node, service node API are at least two business function to service node
What energy API was generated after being packaged;
Calling module 802, for calling each business function API encapsulated in each service node API;
Return module 803, the first call result returned for receiving each service node, and described first is called
As a result test macro is returned to.
The calling module 802 is specifically used for: according to each first call request for including in business processing request, really
Determine service link;According to the sequence of each service node on the service link, it is corresponding successively to handle each service node
First call request, wherein when corresponding first call request of one service node of every processing, call in service node API
Each business function API of encapsulation.
The calling module 802 is specifically used for: determining each first call request pair for including in the business processing request
The service node answered;According to sequence of each first call request in business processing request, by each first call request pair
The service node answered constitutes service link according to the reception sequential series;Alternatively, corresponding according to each first call request
Service node constitute service link according to preset rules.
The second call request in the business processing request also comprising the verification API to each service node, verification
API is generated after being packaged at least two business function API of service node, described device further include:
Correction verification module 804 is verified for the first call result to each service node API, by check results
As corresponding second call result of second call request, and return to test macro.
Specific above-mentioned device as shown in Figure 8 can be on terminal, server.
The embodiment of the present application provides a kind of service test method and device, this method comprises: package platforms are according to business section
At least two business function API that point provides, generate the service node API of the service node;When receiving test macro to institute
When stating the first call request of service node API, corresponding first call result of first call request is determined, and return to survey
Test system.It by the above method, is carried out in test process to service link, when wanting the function using service node, no
It is called with each business function API that a pair of service node provides, as long as but the industry of the preparatory service node of calling
The service node API that business generates after being packaged is called, and therefore, can be reduced the processing load of test macro, be mentioned
High testing efficiency.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product.
Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application
Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code
The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The above description is only an example of the present application, is not intended to limit this application.For those skilled in the art
For, various changes and changes are possible in this application.All any modifications made within the spirit and principles of the present application are equal
Replacement, improvement etc., should be included within the scope of the claims of this application.