A kind of test data acquisition methods and system
Technical field
The present invention relates to testing fields, and in particular to a kind of test data acquisition methods and system.
Background technique
As mobile terminal is increasingly becoming the trend of internet development, the application and emergence of mobile Internet are irresistible, this
Just there is higher requirement to the test of traditional internet based on front end, i.e. the suitable end PC is not only wanted in internet product application
Characteristic, it is also necessary to the demand that compatible mobile terminal iOS and android and OTT etc. is respectively held, and the corresponding business field in different front ends
Scape is also possible to difference.
In traditional test process based on front end, for different front ends, different testers is needed to cover
Lid test, on the basis of previous, everybody is the test data for respectively designing each end in their own needs, is thus needed
The tester of head end test that will be all needs the calculating logic and business scenario for requiring to understand program, and according to reality
Testing requirement, design reasonable test case.And actual conditions are, personnel's most of the time of test function all opens in tracking
Unit testing and interface testing that programmer submits program are sent out, seldom carrys out design test case in conjunction with front-end business scene application,
And the tester of front end applications scene, then it often structurally meets difficulty in test data.If the two combines, multiplexing is single
The test data of member test and interface testing, then can be provided for head end test more, more fully test data.
Summary of the invention
In order to solve the above-mentioned technical problem, the invention proposes a kind of test data acquisition methods and system, a kind of application
In the test method and system of income test of heuristics.The present invention by generation test data and saves test data, from
And it forms for providing the data bank of test data to different front ends, and test data is multiplexed in front end.The present invention will
Both the test data of functional test and practical application of front end combine, the test number of Multiplexing Unit test and interface testing
According to more, more fully test data can be provided for head end test.The multiplexing of test data can support multiple front ends into
Row concurrent test.
The present invention is realized with following technical solution, a kind of test data acquisition methods, and the test data includes surveying
Example parameter and test oracle fruit data on probation, comprising:
Test case parameter, the test case parameter and the tested object are generated at random according to tested object
Application scenarios are related;
It is pre- according to the test corresponding with the test case parameter acquisition test case of preset test case algorithm
Phase result data;
Save test case parameter test oracle result data corresponding with the test case parameter.
Preferably, further includes:
For multiple tested objects, a test object mark is distributed for each tested object;
Save test object mark and the corresponding test case parameter of tested object and corresponding with tested object
Test oracle result data.
Preferably, further includes:
The test data is multiplexed into different front ends, the front end includes the end PC, Android and/or iOS.
A kind of test method applied to income test of heuristics, based on above-mentioned test data acquisition methods, comprising:
The test case parameter for obtaining income is generated at random;
The deserved prospective earnings of the test case parameter are obtained according to preset test case algorithm;
Actual measurement income is obtained according to the test case parameter and income algorithm to be tested;
Test data is saved, the test data includes test case parameter, the corresponding expection of the test case parameter
Income and actual measurement income;
The test data is multiplexed to front end;
According to the Relation acquisition test result of the actual measurement income and the prospective earnings.
Preferably, the Relation acquisition test result according to the actual measurement income and the prospective earnings includes:
Judge whether the actual measurement income is equal with the prospective earnings: if so, test passes through;Otherwise, it tests obstructed
It crosses, determines that there are mistakes for the income algorithm to be tested.
Preferably, further includes:
Multiple accounts are obtained, each account corresponds to a kind of income algorithm;
The test data is saved, the test data includes account, test case parameter corresponding with account, the survey
The corresponding prospective earnings of example parameter on probation and actual measurement income.
A kind of test data acquisition system, comprising:
Test case parameter acquisition module, for generating test case parameter, the test at random according to tested object
Use-case parameter is related to the application scenarios of the tested object;
Test oracle result data obtains module, for according to preset test case algorithm and the test case parameter
Obtain the corresponding test oracle result data of the test case;
Test data memory module, for saving test case parameter test corresponding with the test case parameter
Expected results data.
Preferably, further includes:
Distribution module is identified, for distributing a test object for each tested object for multiple tested objects
Mark;
The test data memory module also saves test object mark, test case parameter corresponding with tested object
And test oracle result data corresponding with tested object.
A kind of test macro applied to income test of heuristics, comprising:
Test case parameter acquisition module, for generating the test case parameter for obtaining income at random;
Prospective earnings obtain module, deserved for obtaining the test case parameter according to preset test case algorithm
Prospective earnings;
It surveys income and obtains module, received for obtaining actual measurement according to the test case parameter and income algorithm to be tested
Benefit;
Test data preserving module, for saving test data, the test data includes test case parameter, the survey
The corresponding prospective earnings of example parameter on probation and actual measurement income;
Test data Multiplexing module, for being multiplexed the test data to front end;
Test result obtains module, tests and ties for the Relation acquisition according to the actual measurement income and the prospective earnings
Fruit.
Preferably, further includes:
Account obtains module, and for obtaining multiple accounts, each account corresponds to a kind of income algorithm;
The test data preserving module saves the test data, the test data packet for saving test data
Include account, test case parameter corresponding with account, the corresponding prospective earnings of the test case parameter and actual measurement income.
The beneficial effects of the present invention are:
The invention proposes a kind of test data acquisition methods and system, a kind of test side applied to income test of heuristics
Method and system.The invention has the following beneficial effects:
(1) present invention is by generating test data, and test data is saved, so as to form being used for not the same
End provides the data bank of test data, and test data is multiplexed in front end, improves data user rate.
(2) present invention combines both the test data of functional test and practical application of front end, and Multiplexing Unit is surveyed
The test data of examination and interface testing, can be provided for head end test more, more fully test data.
(3) multiplexing of test data also avoids the test environment for needing to construct different application scene for different front ends
And the manpower and material resources cost generated, multiple front ends can be supported to carry out concurrent test.
Detailed description of the invention
Fig. 1 is a kind of test data acquisition methods method flow diagram provided in embodiment 1;
Fig. 2 is a kind of test method flow chart applied to income test of heuristics provided in embodiment 2;
Fig. 3 is the generation operation flow process figure of the virtual gold coin provided in embodiment 2;
Fig. 4 is the router test method flow chart provided in embodiment 2;
Fig. 5 is the router test method schematic diagram provided in embodiment 2;
Fig. 6 is that a kind of test data provided in embodiment 3 obtains system schematic;
Fig. 7 is a kind of test macro schematic diagram applied to income test of heuristics provided in embodiment 4.
Specific implementation method
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work
It encloses.
It should be noted that term " includes " and " having " and their any deformation, it is intended that covering is non-exclusive
Include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to clearly arrange
Those of out step or unit, but may include be not clearly listed or it is solid for these process, methods, product or equipment
The other step or units having.
Embodiment 1:
A kind of test data acquisition methods, the test data include test case parameter and test oracle fruit data, such as
Shown in Fig. 1, comprising:
S101. test case parameter is generated according to tested object at random, the test case parameter is tested with described
The application scenarios of object are related.
S102. it is corresponding the test case to be obtained with the test case parameter according to preset test case algorithm
Test oracle result data.
S103. test case parameter test oracle result data corresponding with the test case parameter is saved.
Specifically, the corresponding application scenarios of a test object, multiple application scenarios, then have multiple tests pair if it exists
As further including following steps in this case:
For multiple tested objects, a test object mark is distributed for each tested object;
Save test object mark and the corresponding test case parameter of tested object and corresponding with tested object
Test oracle result data.
Specifically, further includes:
The test data is multiplexed into different front ends, the front end includes the end PC, Android and/or iOS.
The present embodiment proposes a kind of Reuse of Test Cases based on back end test to the test data acquisition methods of front end,
The present embodiment method testing method person of outstanding talent is relied on to can be avoided the repetitive construct of test case data, when saving a large amount of test
Between and link up cost.
Embodiment 2:
A kind of test method applied to income test of heuristics, the test data acquisition methods based on embodiment 1, such as Fig. 2
It is shown, comprising:
S201. the test case parameter for obtaining income is generated at random.
S202. the deserved prospective earnings of the test case parameter are obtained according to preset test case algorithm.
S203. actual measurement income is obtained according to the test case parameter and income algorithm to be tested.
S204. test data is saved, the test data includes test case parameter, test case parameter correspondence
Prospective earnings and actual measurement income.
S205. the test data is multiplexed to front end.
S206. according to the Relation acquisition test result of the actual measurement income and the prospective earnings:
Judge whether the actual measurement income is equal with the prospective earnings: if so, test passes through;Otherwise, it tests obstructed
It crosses, determines that there are mistakes for the income algorithm to be tested.
Wherein S205 and S206 do not have specific precedence relationship.
Specifically, further includes:
Multiple accounts are obtained, each account corresponds to a kind of income algorithm;
The test data is saved, the test data includes account, test case parameter corresponding with account, the survey
The corresponding prospective earnings of example parameter on probation and actual measurement income.
Below for it can obtain the router of income, the present embodiment the method is explained.
As the general favour financial product in internet is more and more, for the upper layer application that can obtain the router of income
The front-end business process of virtual gold coin becomes increasingly complex, and settlement mode is more and more diversified, at the same the application terminal being related to and
Corresponding application scenarios are also more and more, and this method can be applied to pass through test data in complicated front-end business process
Multiplexing realize test data driving test.
The generation operation flow of virtual gold coin is as shown in figure 3, below make router service logic related with income
Briefly introduce:
Business model 1:
In order to avoid user has purchased router, after installation, without income, so the business model of high yields irrespective of drought or water logging is taken,
It pushes user to use the enthusiasm of router, it is expected to increase user's income.Any active ues participation.The business model 1 uses
Income ensure algorithm come increase user with income, thus push user use router enthusiasm.
Business model 2:
After avoiding user from buying router installation, the volatitle revenue dynamic of some day is excessive or too small, uses
Undulated control algorithm, that is to say, that its income ring ratio must not be lower than 90% within the same period (such as one week, one month), no
It obtains and is higher than 120%, can ensure the stability of user's income.
Business model 3: with its other party cooperative marketing, such as user first from Jingdone district informal voucher, Taobao spend etc. approach payment it is hard
The purchase money of part, then reselection supports the purchasing model of hardware with virtual gold coin income, and the logical comparison of business model 3 is multiple
Miscellaneous, the aspect of consideration is relatively more, and after having arrived the repayment date cooperated with third party on the whole, the virtual gold coin of income is converted automatically
Change RMB into, get to third-party informal voucher, flower etc. accounts, refunded automatically.
Business model 4: the cooperation with operator includes the cooperation with Beijing connection operator here: promoting installation road
By the uploading bandwidth of device user.In view of the cost problem of both sides, the settlement mode of the business model is as follows:
A account is tax revenue account (accounts of router vendors), and B account is the account of connection, and C account is the account of user
50% tax is collected at family by router vendors from the account income of the business model, and then B account is again in remaining account
In collect 80% profit, remaining 20% is obtained by user.The equal income of tripartite in this way.It is equal that this kind of business model can be referred to as interests
Enjoy mode or the general favour mode of interests.
Business model 5: exempting from ad revenue, and the mode is related to the video VIP account that router vendors provide:
If user takes part in after viewing video exempts from advertisement mode, bind what the account of main website was provided in router vendors
When video website watches video, then it is defaulted as light member and exempts from advertisement mode.
Business model 6: the revenue source of ordinary user, i.e., in addition to the other income mode in above 5.
6 under above 6 kinds of different business logical schemas can be possessed according to different mode combinations, such as the same user
A router.
In this case, corresponding application scenarios have the combination of 6 kinds of service logics:
N=C(6,1)+C(6,2)+C(6,3)+C(6,4)+C(6,5)+C(6,6)
63 kinds of business accounting logics are obtained by the permutation and combination of 6 kinds of service logics above.So the application different for correspondence
63 uid(member accounts are distributed in scene, front end), each member account corresponds to a kind of application scenarios, each application scenarios pair
The algorithm answered is required to be tested.By comprehensively testing, the clearing of corresponding full-service model are carried out in testing to guarantee
The correctness that the correct and each end for the clearing logic respectively held is shown.
In this concrete application, test method is as shown in Figure 4, comprising:
(1) it serializes relevant uid and gives different service logic identity.
Each uid is an account, and each account corresponds to a kind of income algorithm.
(2) rule generated according to virtual gold coin, it is random to generate the virtual flow for meeting the rule.
The virtual flow is the corresponding test case parameter of each income algorithm.The virtual flow is stored in
One database.
(3) the deserved prospective earnings of the virtual flow are obtained according to preset income algorithm.
The preset income algorithm is the algorithm that tester uses, and thinks that the algorithm is correct during the test
Algorithm, the prospective earnings be used for measure developer for state income algorithm code correctness.
Prospective earnings are the expected receipts that the corresponding preset income algorithm of uid is calculated for virtual flowmeter in the present embodiment
Benefit.
(4) according to virtual flow, the program write by developer, the actual measurement for calculating the corresponding virtual flow of uid is received
Benefit.
(5) test data is saved, the test data includes test case parameter, test case parameter correspondence
Prospective earnings and actual measurement income.
Specifically, the test data is that uid, virtual flow corresponding with uid and the virtual flowmeter calculate
Prospective earnings and actual measurement income.The test data is stored in the second database, and second database is also referred to as data
Bank.
Specifically, the test data is saved in data bank, the data bank is to save the test data
Server, by issuing the reusability that test data promotes test data, the front end to the front end where each application scenarios
Show test data.
(6) according to the Relation acquisition test result of the actual measurement income and the prospective earnings:
Judge whether the actual measurement income is equal with the prospective earnings: if so, test passes through;Otherwise, it tests obstructed
It crosses, determines that there are mistakes for the income algorithm.
This test method for the data based on virtual bank's account settlement business in the Data Representation of each terminal as shown in figure 5, drive
Dynamic test.It is display together by the way that income and prospective earnings will be surveyed at each end, various businesses is patrolled to meet different terminals
The adaptation collected.By multiplex data, avoid the business scenario that multiple terminals need to construct itself, save manpower and material resources at
This, and the terminal for theoretically supporting quantity unlimited is tested simultaneously.
It is obtained with this, the test model is when each new product is online during the router iteration of research and development, each end
It holds existing type of service not influenced by new business form, new data is only obtained from data bank, thus greatly
Ground improves testing efficiency, and improves testing reliability.
In addition, the present embodiment has the advantages that
1, shared data model is established between different terminals, uses common data bank, it is no longer necessary to be different ends
It holds corresponding different service logic individually to set up business scenario, but is uniformly transferred from data bank, thus before simplifying
Hold the complexity of test.
2, the uncertainty generated using virtual gold coin (i.e. income), design test case, in conjunction with practical application scene,
Different uid is taken out in test environment and constructs the virtual flow based on different business logic, and examines different test logics
Under income algorithm.It is clear that the test method provided in the present embodiment carries out data management by using two databases
Mode tested, clear logic, in the scene applied to service logic complexity, advantage is particularly evident.
Embodiment 3
A kind of test data acquisition system, as shown in Figure 6, comprising:
Test case parameter acquisition module 301, for generating test case parameter, the survey at random according to tested object
Example parameter on probation is related to the application scenarios of the tested object;
Test oracle result data obtains module 302, for according to preset test case algorithm and the test case
Parameter obtains the corresponding test oracle result data of the test case;
Test data memory module 303, it is corresponding with the test case parameter for saving the test case parameter
Test oracle result data.
Specifically, further includes:
Distribution module 304 is identified, for distributing a test pair for each tested object for multiple tested objects
As mark.
The test data memory module also saves test object mark, test case parameter corresponding with tested object
And test oracle result data corresponding with tested object.
Embodiment 4:
A kind of test data applied to income test of heuristics, as shown in fig. 7, comprises:
Test case parameter acquisition module 401, for generating the test case parameter for obtaining income at random;
Prospective earnings obtain module 402, answer for obtaining the test case parameter according to preset test case algorithm
The prospective earnings obtained;
It surveys income and obtains module 403, it is real for being obtained according to the test case parameter and income algorithm to be tested
Survey income;
Test data preserving module 404, for saving test data, the test data includes test case parameter, institute
State the corresponding prospective earnings of test case parameter and actual measurement income;
Test data Multiplexing module 405, for being multiplexed the test data to front end;
Test result obtains module 406, for being tested according to the Relation acquisition of the actual measurement income and the prospective earnings
As a result.
Specifically, further includes:
Account obtains module 407, and for obtaining multiple accounts, each account corresponds to a kind of income algorithm;
The test data preserving module saves the test data, the test data packet for saving test data
Include account, test case parameter corresponding with account, the corresponding prospective earnings of the test case parameter and actual measurement income.
The modules in technical solution in the present invention can be realized by terminal or other equipment.The meter
Calculation machine terminal includes processor and memory.The memory is used to store program instruction/module in the present invention, the processing
Program instruction/module that device is stored in memory by operation realizes corresponding function of the present invention.
Technical solution in the present invention substantially the part that contributes to existing technology or the technical solution in other words
All or part can be embodied in the form of software products, which is stored in a storage medium, packet
Some instructions are included with so that one or more computer equipment (can be personal computer, server or network equipment etc.) is held
Row all or part of the steps of the method according to each embodiment of the present invention.
The division of heretofore described module/unit, only a kind of logical function partition can have another in actual implementation
Outer division mode, such as multiple units or components can be combined or can be integrated into another system or some features can
To ignore, or do not execute.It can select some or all of the modules/unit therein according to the actual needs to reach and realize this
The purpose of scheme of the invention.
It, can also be in addition, each module/unit in each embodiment of the present invention can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.