A kind of automated testing method and device exporting report data
Technical field
The present invention relates to computer testing technology field more particularly to a kind of automated testing methods for exporting report data
And device.
Background technique
Such as the table of record traffic statistics initial data is stored in the database of the operation systems such as financial system, pass through industry
Report guiding system (such as application software derived from report) in business system exports field (column) required in table
Obtain the report of such as excel format, wherein the content in derived report be in table corresponding initial data after translating
Obtained readable text, in order to user's reading.
Operation system storing data, which is constantly accumulated, to be increased, derived report may including, for example, up to 70 fields, 30,000
The data volume of row left and right, each field have already passed through specified logic rules translation, different numerical value will be stored as in database
Initial data translates to different readable texts.
User (such as financial staff) is usually very high to the correctness and integrity demands of this export report data,
But due to the mistake that is likely to occur during translation, export report data there may be not being inconsistent with initial data, this
With regard to needing correctness and integrality to export report data to test.
However the report very big for data volume, the workload of manual testing are very big, for example, in view of field it
Between logical associations during translation, in order to guarantee finally to export the correctness and integrality of report data, in additional word
In the case where exporting report again after section, the data to additional field are not only needed to test, it is also necessary to for largely chasing after
The data of field are tested before adding, and the test of so big workload not only inefficiency, at high cost is carried out by manually
It is high, and since manually-operated error rate is higher, it not can guarantee the correctness of test result, and probably because workload
Report can not comprehensively be tested beyond the ability manually born.
Summary of the invention
Technical problem
In view of this, the technical problem to be solved by the present invention is to manual testing exports inefficiency, the cost of report data
Correctness that is high, not can guarantee test result not can guarantee comprehensive test problem.
Solution
To solve the above-mentioned problems, on the one hand, propose a kind of automated testing method for exporting report data, the side
Method includes: according to scheduled translation rule, and each field translated for the needs in table is translated respectively, generated for each
The translation field data of a field;It is each for needing to translate described in table using function of unity test UFT software analog subscriber
A field carries out export Report Operations, obtains export report data;Compare the translation field data and the export report number
According to the data of middle respective field, test result is generated.
To solve the above-mentioned problems, on the other hand, a kind of automatic test device for exporting report data is proposed, it is described
Device includes: translation component, for according to scheduled translation rule, each field translated for the needs in table to carry out respectively
Translation generates the translation field data for being directed to each field;Component is exported, for simulating using function of unity test UFT software
User carries out export Report Operations for each field for needing to translate described in table, obtains export report data;Component is compared,
For comparing the data of respective field in the translation field data and the export report data, test result is generated.
Beneficial effect
By the way that according to scheduled translation rule, each field translated for the needs in table is translated respectively, is generated
For the translation field data of each field;It is directed to using function of unity test UFT software analog subscriber and needs to turn described in table
The each field translated carries out export Report Operations, obtains export report data;Compare the translation field data and the export
The data of respective field in report data generate test result, the automation of export report data according to an embodiment of the present invention
Test method and device can in an automatic fashion test export report data, avoid artificial test operation, improve
The efficiency of test export report data reduces testing cost and ensure that the correctness of test result.
According to below with reference to the accompanying drawings becoming to detailed description of illustrative embodiments, other feature of the invention and aspect
It is clear.
Detailed description of the invention
Comprising in the description and constitute the attached drawing of part of specification and specification together illustrate it is of the invention
Exemplary embodiment, feature and aspect, and principle for explaining the present invention.
Fig. 1 shows the flow chart of the automated testing method of export report data according to an embodiment of the invention.
Fig. 2 shows the structure charts of the automatic test device of export report data according to an embodiment of the invention.
Fig. 3 shows the knot of the automatic test device of one according to an embodiment of the invention exemplary export report data
Composition.
Fig. 4 shows the automatic test device of another exemplary export report data according to an embodiment of the invention
Structure chart.
Fig. 5 shows a kind of structure of the automated test device of export report data of another embodiment of the invention
Block diagram.
Specific embodiment
Below with reference to attached drawing various exemplary embodiments, feature and the aspect that the present invention will be described in detail.It is identical in attached drawing
Appended drawing reference indicate element functionally identical or similar.Although the various aspects of embodiment are shown in the attached drawings, remove
It non-specifically points out, it is not necessary to attached drawing drawn to scale.
Dedicated word " exemplary " means " being used as example, embodiment or illustrative " herein.Here as " exemplary "
Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, in order to better illustrate the present invention, numerous details is given in specific embodiment below.
It will be appreciated by those skilled in the art that without certain details, the present invention equally be can be implemented.In some instances, for
Method, means, element and circuit well known to those skilled in the art are not described in detail, in order to highlight purport of the invention.
Embodiment 1
Fig. 1 shows the flow chart of the automated testing method of export report data according to an embodiment of the invention.Such as Fig. 1
Shown, which specifically includes that
Step 101, according to scheduled translation rule, each field translated for the needs in table is translated respectively,
Generate the translation field data for being directed to each field;
Step 102, using function of unity test UFT software analog subscriber for each field for needing to translate described in table
Export Report Operations are carried out, export report data is obtained;
Step 103, the data for comparing respective field in the translation field data and the export report data, generate and survey
Test result.
It was recognized by the inventor that the export Report Operations error rate for batch field is higher, and the translation behaviour of field one by one
It is very high to make then correctness.The automated testing method of export report data according to an embodiment of the present invention is translated by field one by one
It obtains accurately translating field data, then operates to obtain the reality that user obtains by exporting Report Operations by software analog subscriber
The two is compared using computer for the export report data on border, and export report is tested based on accurate translation field data
The correctness and integrality of table data avoid artificial so as to test in an automatic fashion export report data
Test operation improves the efficiency of test export report data, reduces testing cost and ensure that the correct of test result
Property.
In one example, before carrying out automatic test to export report data, some test beam workers can be carried out
Make, it may include build hardware environment, software environment and determine scheduled translation rule.For example, can test system building or platform,
Database server and the corresponding network equipment, installation operating system, installation UFT automatic test software etc..It can be according to export
Report demand (i.e. data translation logic demand) determines scheduled translation rule, after referring to the explanation of specific translation rule
The example in face.
Translate the acquisition of field data
In one example, it is translated according to scheduled translation rule for the needs in table described in above-mentioned steps 101
Each field is translated respectively can include: is connected database, is stored with the table in the database;It is inquired from the table
Obtain each field for needing to translate;The each field translated is needed to carry out respectively according to scheduled translation rule to described
Translation.
In this example, database can be the various types databases such as Oracle, DB2, MySQL, and the present invention is to data
The type in library is with no restriction.Have various tables in database, can be inquired from table by SQL statement acquisition need translate it is each
Field, such as SELECT statement can be used and obtain 2 fields as shown in Table 1 (such as " userbase " field and " flat from table
Equal moon sales volume " field).Above-mentioned 2 fields can be translated according to scheduled translation rule.For example, scheduled translation rule
When could dictate that numerical value is 1 in " userbase " field in then, " 1 to 10,000 userbase " can be translated to;When being 2, " 1 can be translated to
Ten thousand to 100,000 userbases ";When for sky, " not carrying out this business temporarily " can be translated to." average moon sales volume " field is and " uses
The associated field of family scale " field can translate to " actual average when the value of corresponding " userbase " field is non-empty
Moon sales volume XXXX platform (XXXX is the numerical value in " average moon sales volume " field) ", when the value of corresponding " userbase " field
It when for sky, can translate to that " (XXXX is in " average moon sales volume " field to average moon sales volume XXXX platform after estimating expansion business
Numerical value) ".The translation field data generated for field each in table 1 can be found in table 2.Scheduled translation rule can be with business system
The translation rule that the export reporting system of system is based on is consistent, so that being directed to the translation field data and lead that identical field obtains
Report data is identical in the case where export Report Operations are errorless out, in order to compare.
Userbase |
Average moon sales volume |
1 |
3896 |
2 |
49800 |
|
9000 |
Table 1
Userbase |
Average moon sales volume |
1 to 10,000 userbase |
Actual average moon sales volume 3896 |
10000 to 100,000 userbases |
Actual average moon sales volume 49800 |
This business is not carried out temporarily |
Estimate average moon sales volume 9000 after expansion business |
Table 2
In one example, translation field data can be obtained based on UFT software.For example, UFT software energy can be write
The script enough run connects data library by Run Script automatically and inquires each field for obtaining and needing to translate.And it can
To write translation rule language that UFT software can be run, for each field for needing to translate based on scheduled translation rule
Sentence obtains translation field data by running these sentences.
In one example, the method, which may also include that, assigns uniquely each row of data in the translation field data
Line identifier.For example, as shown in table 3, unique line identifier as shown in table 3 can be assigned to each row of data in above-mentioned table 2
(also known as record identification, such as area ID or other traffic IDs).The line identifier can be obtained with user by exporting Report Operations
Export report data line identifier it is consistent, in order to subsequent comparison and location of mistake.
|
Userbase |
Average moon sales volume |
Regional A |
1 to 10,000 userbase |
Actual average moon sales volume 3896 |
Regional B |
10000 to 100,000 userbases |
Actual average moon sales volume 49800 |
Regional C |
This business is not carried out temporarily |
Estimate average moon sales volume 9000 after expansion business |
Table 3
Export the acquisition of report data
In one example, using the Identifying Technique of Object of UFT software, analog subscriber automatically opens browser login and leads
Reporting system out, the export reporting system are connected with above-mentioned database, and can be set as maximizing by open browser
State, analog is used to automatically open the export page of data in export reporting system, and analog subscriber clicks export data page
Export button on face is derived automatically from the export report with each field translated for needs from the table of the database
Data (such as export report excel file).Wherein it is possible to by the operation of UFT software analog subscriber in export page of data
Each field that upper selection needs to translate, can also be directly in the phase of the export Report Operations for analog subscriber of UFT software
The each field specified in Run Script and need to translate is closed, the present invention is without limitation.It can will also export report excel file
It is automatically saved to specified directory position.For example, UFT software analog user is derived automatically from the export for field each in table 1
The export report data of the export report data of excel file format, the excel file is as shown in table 4.
|
Userbase |
Average moon sales volume |
Regional A |
1 to 10,000 userbase |
Actual average moon sales volume 3896 |
Regional B |
10000 to 100,000 userbases |
Actual average moon sales volume 37658 |
Regional C |
This business is not carried out temporarily |
Estimate average moon sales volume 9000 after expansion business |
Table 4
The export report data automatically derived in this way is obtained with user by manually carrying out export Report Operations
Export report data it is identical, therefore the export report data is tested, required test result can be obtained.
In one example, the method may also include that the export report data (excel format derived from such as
Export report data) carry in the deposit UFT software for temporarily saving the grid virtual table Data Table of data
In.
In one example, the translation field data and phase in the export report data are compared in above-mentioned steps 103
Answer the data of field can include: the export report data being stored in the comparison translation field data and the grid virtual table
The data of middle respective field.For example, can be successively in the data and grid virtual table in contrast table 3 in field " average moon sales volume "
Data in the export reporting data table 4 being stored in respective field " average moon sales volume ", carry out certainly export report data
Dynamic test.The comparison of step 103 can be realized by UFT software.
In one example, the data of respective field in the translation field data and the export report data are compared,
Generate test result, it may include: it is different in the data of the translation field data and respective field in the export report data
In the case where cause, inconsistent data and information relevant to the inconsistent data are shown, wherein the packet includes institute
State the corresponding field identification of inconsistent data and line identifier.For example, can be successively in contrast table 3 in field " average moon sales volume "
Data and grid virtual table in data in the export reporting data table 4 that is stored in respective field " average moon sales volume ",
When the data in comparison to the corresponding field of row " regional B " " average moon sales volume ", it is possible to find " the actual average moon in table 3
Sales volume 49800 " and " the actual average moon sales volume 37658 " in table 4 are inconsistent, then can after comparison pop-up window,
Above-mentioned inconsistent data and the corresponding field identification of inconsistent data " average moon sales volume " and row are shown in pop-up window
It identifies " regional B " (i.e. position in table locating for inconsistent data).
In one example, the data of respective field in the translation field data and the export report data are compared,
Generate test result, it may include: the number of respective field in whole translation field datas and the export report data
According under unanimous circumstances (such as in the export reporting data table 4 being stored in the translation field data in table 3 and grid virtual table
In the case that the data of respective field are completely the same), then can be after comparison, pop-up window prompt is completely the same, indicates export report
Table data are completely correct.
In one example, test result is generated can include: generate the test report of expandable mark language XML format.
Since the readability of the test report of XML format is strong, can intuitively check in a browser, tester can view each step pair
Than whether run pass through or failure and automatic test comparison time-consuming, convenient for user understand automatic test process and survey
Try efficiency.
In one example, the method may also include that the export report for automatically saving and being stored in the grid virtual table
Table data.For example, UFT software can automatically save the export reporting data table 4 being stored in grid virtual table, so as to user's progress
It checks again, regression analysis exports the reason that mistake occurs in report data, statistics error probability.
Embodiment 2
Fig. 2 shows the structure charts of the automatic test device of export report data according to an embodiment of the invention.The reality
The automatic test device 20 for applying example can be used for realizing the operation of each step of method in embodiment 1, wherein various specific examples and
Beneficial effect can be found in embodiment 1, and description is not repeated herein for simplicity.
As shown in Fig. 2, the automatic test device 20 of the embodiment includes: translation component 21, for according to scheduled turn
Rule is translated, each field translated for the needs in table is translated respectively, generates the translation Field Count for being directed to each field
According to;Component 22 is exported, for being directed to each word for needing to translate described in table using function of unity test UFT software analog subscriber
Duan Jinhang exports Report Operations, obtains export report data;Compare component 23, for compare the translation field data with it is described
The data of respective field in report data are exported, test result is generated.
Fig. 3 shows the knot of the automatic test device of one according to an embodiment of the invention exemplary export report data
Composition.In this example, the translation component 21 includes: connection unit 211, for connecting database, is deposited in the database
Contain the table;Acquiring unit 212 is inquired, for the inquiry acquisition each field for needing to translate from the table;Translation
Unit 213, for needing each field translated to translate respectively according to scheduled translation rule to described.
In one example, Report Operations are exported can include: report guiding system is logged in, wherein the report guiding system
It is connected with the database;Open the export page of data in the report guiding system;It clicks in export page of data
Button is exported, to need each field translated to be derived automatically from the export report number from the table of the database for described
According to.
In one example, the described device further include: the first storage unit, for the export report data to be deposited
Enter in the grid virtual table in the UFT software for temporarily saving data.
In one example, the comparison component 23 is specifically used for: the comparison translation field data and the grid are empty
The data of respective field in the export report data being stored in quasi- table.
Fig. 4 shows the automatic test device of another exemplary export report data according to an embodiment of the invention
Structure chart.In this example, described device 20 further include: mark component 24, for every row in the translation field data
Data assign unique line identifier.
In one example, the comparison component 23 is specifically used for: in the translation field data and the export report
In the case that the data of respective field are inconsistent in data, inconsistent data and relevant to the inconsistent data are shown
Information, wherein the packet includes the corresponding field identification of the inconsistent data and line identifier.
In one example, the comparison component 23 is specifically used for: leading in whole translation field datas with described
Out in report data under the data unanimous circumstances of respective field, prompt completely the same.
In one example, the comparison component 23 is also used to: generating the test report of expandable mark language XML format
It accuses.
In one example, described device 20 further include: the second storage unit, for automatically saving the grid virtual table
Middle be stored in export report data.
Embodiment 3
Fig. 5 shows a kind of structure of the automated test device of export report data of another embodiment of the invention
Block diagram.The automated test device 1100 can be the host server for having computing capability, personal computer PC or can
The portable computer of carrying or terminal etc..The specific embodiment of the invention does not limit the specific implementation of calculate node.
The automated test device 1100 includes processor (processor) 1110, communication interface
(Communications Interface) 1120, memory (memory) 1130 and bus 1140.Wherein, processor 1110,
Communication interface 1120 and memory 1130 pass through bus 1140 and complete mutual communication.
Communication interface 1120 is used for and network device communications, and wherein the network equipment includes such as Virtual Machine Manager center, is total to
Enjoy storage etc..
Processor 1110 is for executing program.Processor 1110 may be a central processor CPU or dedicated collection
At circuit ASIC (Application Specific Integrated Circuit), or it is arranged to implement the present invention
One or more integrated circuits of embodiment.
Memory 1130 is for storing file.Memory 1130 may include high speed RAM memory, it is also possible to further include non-
Volatile memory (non-volatile memory), for example, at least a magnetic disk storage.Memory 1130 is also possible to deposit
Memory array.Memory 1130 is also possible to by piecemeal, and described piece can be combined into virtual volume by certain rule.
In a kind of possible embodiment, above procedure can be the program code for including computer operation instruction.The journey
Sequence is particularly used in each step operation for realizing method in embodiment 1.
Those of ordinary skill in the art may be aware that each exemplary cell and algorithm in embodiment described herein
Step can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions actually with hardware also
It is software form to realize, the specific application and design constraint depending on technical solution.Professional technician can be directed to
It is specific that described function is realized using different methods is selected, but this realization is it is not considered that exceed model of the invention
It encloses.
If realizing the function and when sold or used as an independent product in the form of computer software,
To a certain extent it is believed that all or part (such as the part that contributes to existing technology) of technical solution of the present invention is
It embodies in form of a computer software product.The computer software product is generally stored inside computer-readable non-volatile
In storage medium, including some instructions are used so that computer equipment (can be personal computer, server or network to set
It is standby etc.) execute all or part of the steps of various embodiments of the present invention method.And storage medium above-mentioned include USB flash disk, mobile hard disk,
Read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic
The various media that can store program code such as dish or CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.