Summary of the invention
This specification embodiment be intended to provide it is a kind of more effectively automatic testing scheme, with solve it is in the prior art not
Foot.
To achieve the above object, this specification provides a kind of automatic test approach on one side, comprising:
Obtain first test profile corresponding with the first object to be tested, wherein first test profile
In include at least one tactic test case, include to one in prefabricated multiple functional modules in each test case
The configuration of the calling of a functional module and input data and output data to the functional module, wherein each functional module with
An operation in test corresponds to;And
Each survey is based on according to putting in order at least one test case for the described first object to be tested
To the configuration of the input data and output data of the corresponding function module in example on probation, the function in each test case is sequentially called
Module, to obtain test result corresponding with first test profile.
In one embodiment, the described first object to be tested is the first node in block chain.
In one embodiment, it correspond respectively in following operation one of each functional module: creates an account, turn
Account, transmission transaction, verifying transaction, query messages, inquiry account balance, numerical value compares, creates intelligent contract, calling intelligence is closed
About, intelligent contract is executed, block is generated, sends block, memory block.
In one embodiment, the method executes in testing service device, and the method also includes obtaining and first
After corresponding first test profile of object to be tested, the connection configuration information of first node is obtained, and be based on the company
It connects configuration information and connects the first node.
It in one embodiment, include the first functional module, first Functional Module in the multiple functional module
The operation included includes: the predetermined operation in the instruction first node progress block chain, is received from the first node described pre-
Surely the implementing result operated and output.
In one embodiment, the method also includes matching obtaining to test with the first object corresponding first to be tested
After setting file, which is converted into the readable form of program.
In one embodiment, the method also includes obtaining test knot corresponding with first test profile
After fruit, it is based on the test result, carries out result statistics.
In one embodiment, at least one described tactic test case, for wherein continuously arranged
Two test cases, configure the output data of the test case of front to the input data of subsequent test case.
On the other hand this specification provides a kind of automatic testing equipment, comprising:
Acquiring unit is configured to, and obtains first test profile corresponding with the first object to be tested, wherein described
Include at least one tactic test case in first test profile, includes to prefabricated more in each test case
The configuration of the calling and input data and output data to the functional module of a functional module in a functional module,
In, each functional module is corresponding with an operation in test;And
Call unit is configured to, for the described first object to be tested, according to the arrangement of at least one test case
Sequentially, it based on the configuration in each test case to the input data and output data of the corresponding function module, sequentially calls each
Functional module in test case, to obtain test result corresponding with first test profile.
In one embodiment, the described first object to be tested is the first node in block chain, wherein described device portion
In testing service device, described device further includes that connection unit is configured to for administration, corresponding with the first object to be tested obtaining
After first test profile, the connection configuration information of first node is obtained, and institute is connected based on the connection configuration information
State first node.
In one embodiment, described device further includes that interface unit is configured to, and is being obtained and the first object to be tested
After corresponding first test profile, which is converted into the readable form of program.
In one embodiment, described device further includes that statistic unit is configured to, and is being obtained and first test configurations
After the corresponding test result of file, it is based on the test result, carries out result statistics.
On the other hand this specification provides a kind of computer readable storage medium, be stored thereon with computer program, work as institute
When stating computer program and executing in a computer, computer is enabled to execute any of the above-described method.
On the other hand this specification provides a kind of calculating equipment, including memory and processor, which is characterized in that described to deposit
It is stored with executable code in reservoir, when the processor executes the executable code, realizes any of the above-described method.
By the automatic testing scheme according to this specification embodiment, configurable, plug-in unit data-driven is realized
Auto-testing-framework, tester only needs to configure corresponding test file when writing test case, without being familiar with
Specific development language reduces test case and writes cost, improves testing efficiency.
Specific embodiment
This specification embodiment is described below in conjunction with attached drawing.
Fig. 1 shows the schematic diagram of the auto-testing-framework 100 according to this specification embodiment.As shown in Figure 1, frame 100
Including input module 11, calling module 12, functional module 13 and output module 14.The test frame 100 can for example be disposed
In testing service device, which for example passes through each node test block chain by each node in connection block chain
In respective service.For example, being obtained first by input module 11 when that will test the first node in block chain
The connection configuration information of first node and test profile corresponding with the node.For example, can be by input module 11 with defeated
Enter the file of the connection configuration information and test profile corresponding with first node of the form input first node of order line
Path, so as to obtain the test profile by file path, and by the connection configuration information of first node with it is described
First node establishes connection.Wherein, in the test profile include calling at least one functional module 13.It is described defeated
Entering in module 11 to include interface module (not shown), convert for the data mode to test profile.It adjusts
It is generated after obtaining each test profile based on each test profile with module 12 by frame 100, a calling
Module is corresponding with a test profile, is shown here only a calling module for schematically illustrating.In calling module 12
In, the calling at least one described (schematically illustrating 3 in figure) functional module 13 is executed based on test profile, and obtain
Test result, wherein each functional module corresponds to the concrete function operation in test.Then, calling module 12 will be tested
As a result output module 14 is sent to handle for statistics, generation report, the configuration log etc. to the test result.It is above-mentioned to be
Illustratively illustrate, rather than limits the range of this specification embodiment.For example, being deployed in test frame described above non-
In the case where the testing service device of node, in input module 11, can obtain it is tactic it is multiple (node connect configuration information,
At least one test profile corresponding with the node) information group, so as to sequentially be executed pair by multiple calling modules 12
The test of multiple nodes, wherein passing through connection configuration information corresponding with the node before executing to the test of each node
Connect the node;It is local that the test frame can also be deployed in node to be tested, the step of without connecting node;Separately
Outside, the test frame is not limited to use in test block catenary system, and can be used for testing other softwares, software systems etc..
Test process above by auto-testing-framework is described below in detail.
Fig. 2 shows a kind of automatic test approach flow charts according to this specification embodiment, comprising:
In step S202, first test profile corresponding with the first object to be tested is obtained, wherein first survey
It tries to include at least one tactic test case in configuration file, includes to prefabricated multiple functions in each test case
The configuration of the calling and input data and output data to the functional module of a functional module in module, wherein each
Functional module is corresponding with an operation in test;
In step S204, for the described first object to be tested, according to putting in order at least one test case,
Based on the configuration in each test case to the input data and output data of the corresponding function module, each test is sequentially called to use
Functional module in example, to obtain test result corresponding with first test profile.
This method is executed for specific object to be tested, and the object to be tested is, for example, any section in block chain
Point, such as first node.It as shown in fig. 1, include prefabricated multiple functional modules, each function in the auto-testing-framework
Module is corresponding with an operation in test.The embodiment is not limited to use in test block catenary system.When the automatic test block
When the system difference of frame application, including prefabricated functional module it is also correspondingly different, that is, the functional module with testing
The operations that may need to use when test system to be measured are corresponding.For example, in auto-testing-framework for block catenary system
When test, the corresponding feature operation of the functional module include: create an account, transfer accounts, sending transaction, verifying transaction, inquiry disappear
Breath, inquiry account balance, numerical value compare, create intelligent contract, call intelligent contract, execute intelligent contract, generate block, send
Block, memory block etc..
In one embodiment, this method can be locally executed in first node.In one embodiment, this method is being tested
Server executes, and testing service device carries out the test for being directed to first node by connecting first node.It is appreciated that according to this
Specification embodiment can disposably input multipacket message, every group of letter for the auto-testing-framework being deployed in testing service device
Breath includes connection configuration information corresponding with a node and at least one test profile, so as to automatically successively with it is multiple
Node connection, and method shown in Fig. 2 is carried out for multiple nodes to carry out at least one test respectively to it.Below to this method
Each step be specifically described.
Firstly, in step S202, first test profile corresponding with the first object to be tested is obtained, wherein described
Include at least one tactic test case in first test profile, includes to prefabricated more in each test case
The configuration of the calling and input data and output data to the functional module of a functional module in a functional module,
In, each functional module is corresponding with an operation in test.
As described above, auto-testing-framework can read corresponding test configurations text by obtaining test file path
Part.First test profile corresponds to a test to the first object (such as first node) to be tested, the test
It include at least one tactic test case in configuration file, which corresponds to
At least single stepping that sequentially executes in this test, operation described in every step is by a function mould shown in calling figure 1
What block was implemented, include to the calling of functional module and to the input of the functional module in each test case therefore
The configuration of data and output data.As described above, in the case where the auto-testing-framework is applied to test block chain, institute
It states functional module and corresponds respectively to following any operation: creating an account, transfer accounts, send transaction, verifying transaction, query messages, look into
Ask account balance, numerical value compare, create intelligent contract, call intelligent contract, execute intelligent contract, generate block, transmission block,
Memory block.
In the case where the auto-testing-framework is deployed on testing service device, the method also includes, obtain with
After corresponding first test profile of first node, the connection configuration information of first node is obtained, and be based on the connection
Configuration information connects the first node.The IP address and port that configuration information is connected for example including first node, first
The key information etc. of node.Testing service device can be attached first node by IP address and port numbers, and pass through first
The key information and first node that node provides carry out coded communication etc..
In the case where above-mentioned testing service device, when corresponding first operation of the functional module is needed by block chain
When node executes, so that all operationss that the functional module includes include: node (the i.e. first segment indicated in server connection
Point) first operation is executed, the implementing result of the first operation, and output implementing result are received from first node, thus real
The node of existing remote control testing service device connection completes test.
The test profile can be realized by various configuration file formats, such as Json file, XML file etc., only
Will the configuration file include above-mentioned every content and can be parsed by a program.The test that Json document form has been illustrated below is matched
Set a test case for including in file.
Wherein, " Test-N-001 " is the number of the test case, which operates corresponding to " account inquiries ",
In " type " indicate the calling to functional module " QueryAccount (inquiry Account Features module) ", " input " table therein
Show the configuration of the input data to the functional module " QueryAccount ", i.e. input is account address " c60a9d48 ... ",
In " output " indicate the configuration to the output data of the functional module, i.e., the result for inquiring account is assigned to parameter
" { abcde } " etc..It correspondingly, can also include being arranged in after test case " Test-N-001 " in the test profile
Test case " Test-N-002 ", which can for example call the function of comparing corresponding to numerical value
Module (Asserter (asserting functional module)), with the output (i.e. real account remaining sum) of test case " Test-N-001 " and phase
It hopes account balance as input, and it is compared, and using comparison result as output.To pass through test case " Test-
The test of N-001 " and test case " Test-N-002 " achievable inquiry account balance service to first node.
In step S204, for the described first object to be tested, according to putting in order at least one test case,
Based on the configuration in each test case to the input data and output data of the corresponding function module, each test is sequentially called to use
Functional module in example, to obtain test result corresponding with first test profile.
Such as the first node in above-mentioned block chain, when using it is above-mentioned include two test case (Test-N-001
And Test-N-002) test profile first node is tested in the case where, according to putting in order for test case,
Corresponding call is executed for first node, that is to say, that is first adjusted to the inquiry Account Features module in Test-N-001
With so that then first node asserts function mould in Test-N-002 using the service for inquiring account in block chain
Block is called, to determine whether account balance that first node inquires is consistent with expection.Call each functional module it
Before, the preposition processing of test case can be carried out, such as object formation is carried out based on configuration file (such as above-mentioned Json) file, it is right
Input data carries out type conversion etc..After the output valve for obtaining calling functional modules every time, after test case being carried out
Processing is set, such as output data is formatted, i.e., output data is packaged into specific format.Match sequentially performing the test
After setting each test case in file, the corresponding survey that queries the balance to first node of the test profile is finally obtained
Whether the test result of examination is normally carried out test so as to the inquiry account balance service to test block chain.
After obtaining the test result, it can be based on the test result, carry out result statistics.
The test result is only the test result of a test to the first object (such as first node) to be tested, example
Such as, the feelings various functions of block chain, performance tested in the auto-testing-framework by being deployed in testing service device
At least one of in condition, test frame may test at least one node in block chain, each node is carried out
Test, therefore, the statistics to test result can be increases the test in the statistics to the test result of individual node
As a result, being also possible to increase the test result in the statistics of the test result of multiple nodes in block chain.
Fig. 3 schematically illustrates the circulation figure that method shown in Fig. 2 is performed a plurality of times in testing block chain.In Fig. 3
It is shown, test frame obtain at least one node connection configuration information and it is corresponding with each node at least one survey
After trying file path, test frame carries out the outermost loop at least one node, for each survey of each node
The middle layer circulation of configuration file is tried, and for the innermost loop of each test case in each test profile.Tool
Body is, in step S302, test frame obtain first each node connection configuration information and it is corresponding with each node extremely
A few file path, wherein each file path is corresponding with for a test profile of the node.In step
S304 starts to execute the circulation relative to each node, for one of node, the connection configuration information based on the node
The node is connected, and at least one test configurations text corresponding with the node is obtained based at least one corresponding file path
Part.In step S306, start to execute middle layer circulation, and execute innermost loop under middle layer circulation, that is, for each
A test profile in test profile, each test in innermost loop based on the test profile are used
Example call to the sequence of each functional module."Yes" in figure indicates that circulation terminates, and "No" indicates that circulation is not finished.When most
At the end of interior loop, step S308 is executed, that is, for the node that the circulation is directed to, count for the result of the node.
After step S308, determine whether middle layer circulation terminates, that is to say, that determine each test configurations text for the node
Whether part has been carried out the interior loop of step S306, in the case where middle layer circulation is not finished, returns to step S306, continues
The functional module of test case each in next test profile is called, recycles the case where terminating in middle layer
In, in step S310 can count for the result of block chain, i.e., increase in the statistics for block chain and be directed to the node
Statistics.Later, determine whether outermost loop terminates, that is, determine whether to corresponding each with each node link information
Whether node carried out above-mentioned steps, in the case where being not finished, returns to step S304, re-executes above-mentioned steps, is terminating
In the case where, which terminates.
After the result statistics shown in Fig. 3 for carrying out node level and the result statistics for carrying out block chain grade, it is also based on institute
It states statistics and generates test report, and/or carry out the configuration management of test log based on the statistics, such as adjust each rank
Whether visible parameter of test log etc..
Fig. 4 shows the execution flow chart of the auto-testing-framework according to this specification embodiment.The flow chart corresponds to
The example that multinomial test is carried out to node in block chain, it will be understood that the flow chart is only schematical, is not limited to
The range of this specification embodiment.Specifically, in step S401, frame executing subject generates framework instance, frame executing subject
Namely the main program of frame.In step S402, tester can input the text of column such as each test profile by order line
Part path, so that frame can obtain each test profile based on this document path, by being deployed in testing service device (its
Any node in block chain) frame each node is tested in the case where, in this step, frame can also obtain
The connection configuration information of each node inputted by tester by order line, such as IP address, port numbers are taken, and described
Each test profile is corresponding with each node respectively, wherein a node can correspond at least one test configurations text
Part carries out at least one test to a node.In step S403, which loads and registers existing prefabricated
Multiple functional modules.In step S404, the test profile that frame executing subject will acquire is sent to interface module, to this
Test profile carries out data conversion treatment, to be converted into program readable data.In step S405, interface module will be through
The test profile of conversion is sent to executing subject.
It is circulation 1 from step S406-S412, the number of the circulation 1 corresponds to the number of test profile.Wherein, when
In the case where the example tests multiple nodes, which includes outer loop and middle layer circulation in Fig. 3, wherein
For different nodes, include the steps that connecting node (not shown).It is circulation 2 from step S407- step S410, it should
The number of circulation 2 corresponds to the number for the test case for including in a test profile.Specifically, it in step S406, holds
Row main body creates corresponding tune for a test profile in multiple test profiles, based on the test profile
With module, for executing subsequent invocation step.In step S407, a test in above-mentioned test profile is used
Example, calling module, which executes, calls preposition processing.In step S408, calling module based in the test case to function to be called
The configuration of energy module, calls corresponding functional module, during calling, the input data configured in the test case is defeated
Enter corresponding functional module.In step S409, functional module is based on above-mentioned input data and exports implementing result, and is used based on test
The configuration of input data handles the implementing result in example, and returns to call result.In step S410, calling module pair
Call result is called postpositive disposal.
In step S411, after the circulation 2 for the multiple test cases for including to above-mentioned test profile terminates, for
Corresponding node carries out the other result statistics of node level.In step S412, the result statistics for the node level that calling module will acquire
It is sent to executing subject.It include pair in the circulation 1 after the circulation 1 to each test profile terminates in step S413
In the case where the circulation of multiple nodes, the result statistics of block chain rank is carried out.Wherein, in executing subject carry out step S411 and
The part of step S413 corresponds to a part of output module in Fig. 1.
Fig. 5 shows a kind of automatic testing equipment 500 according to this specification embodiment, comprising:
Acquiring unit 51, is configured to, and obtains first test profile corresponding with the first object to be tested, wherein institute
Stating includes at least one tactic test case in the first test profile, includes to prefabricated in each test case
The configuration of the calling and input data and output data to the functional module of a functional module in multiple functional modules,
Wherein, each functional module is corresponding with an operation in test;And
Call unit 52, is configured to, for the described first object to be tested, according to the row of at least one test case
Column sequence, based on the configuration in each test case to the input data and output data of the corresponding function module, sequence is called each
Functional module in a test case, to obtain test result corresponding with first test profile.
In one embodiment, the described first object to be tested is the first node in block chain, wherein described device portion
In testing service device, described device further includes that connection unit 53 is configured to for administration, corresponding with the first object to be tested obtaining
The first test profile after, obtain the connection configuration information of first node, and based on connection configuration information connection
The first node.
In one embodiment, described device further includes that interface unit 54 is configured to, to be tested right in acquisition and first
After corresponding first test profile, which is converted into the readable form of program.
In one embodiment, described device further includes that statistic unit 55 is configured to, and is matched obtaining with first test
After setting the corresponding test result of file, it is based on the test result, carries out result statistics.
On the other hand this specification provides a kind of computer readable storage medium, be stored thereon with computer program, work as institute
When stating computer program and executing in a computer, computer is enabled to execute any of the above-described method.
On the other hand this specification provides a kind of calculating equipment, including memory and processor, which is characterized in that described to deposit
It is stored with executable code in reservoir, when the processor executes the executable code, realizes any of the above-described method.
By the automatic testing scheme according to this specification embodiment, configurable, plug-in unit data-driven is realized
Auto-testing-framework, tester only needs to configure corresponding test file when writing test case, without being familiar with
Specific development language reduces test case and writes cost, improves testing efficiency.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
Those of ordinary skill in the art should further appreciate that, describe in conjunction with the embodiments described herein
Each exemplary unit and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clear
Illustrate to Chu the interchangeability of hardware and software, generally describes each exemplary group according to function in the above description
At and step.These functions hold track actually with hardware or software mode, depending on technical solution specific application and set
Count constraint condition.Those of ordinary skill in the art can realize each specific application using distinct methods described
Function, but this realization is it is not considered that exceed scope of the present application.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can hold track with hardware, processor
Software module or the combination of the two implement.Software module can be placed in random access memory (RAM), memory, read-only storage
Device (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology neck
In any other form of storage medium well known in domain.
Above-described specific embodiment has carried out further the purpose of the present invention, technical scheme and beneficial effects
It is described in detail, it should be understood that being not intended to limit the present invention the foregoing is merely a specific embodiment of the invention
Protection scope, all within the spirits and principles of the present invention, any modification, equivalent substitution, improvement and etc. done should all include
Within protection scope of the present invention.