Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind
State report automatic test approach, device, computer storage medium and the equipment of problem.
The first aspect of the present invention provides a kind of report automatic test approach, comprising:
Extract each index for including in preset report form formula specification document;
It generates the corresponding source data file of each index at random according to testing requirement, and the source data file is reported into report
List server, so that the report server generates according to the testing requirement and the source data file report of each index
File;
The end value of each index, and root are calculated separately using the calculation formula of each index according to the source data file
Report test file is generated according to the end value of each index;
The report file that the report server generates is obtained, according to the report test file to the report file of acquisition
Carry out accuracy test.
Optionally, each index for including in report form formula specification document is extracted, comprising:
Python interface is configured, the python interface is used to read the index classification in the report form formula specification document
With the index name in each index classification including index;
The each index for including in the report form formula specification document is extracted based on the python interface.
It is optionally, described to generate the corresponding source data file of each index at random according to testing requirement, comprising:
Testing requirement file is obtained, includes the device identification and report form type of network element in the testing requirement file;
The corresponding source data template of the network element is searched according to the device identification;
The corresponding source data file of each index of generating random number using the source data template and currently generated.
Optionally, the report file for obtaining the report server and generating, comprising:
Matched sql query statement is generated according to testing requirement, it is corresponding from report server using the sql query statement
Database in extract the report file.
The second aspect of the present invention provides a kind of report automatic testing equipment, comprising:
Extraction module, for extracting each index for including in preset report form formula specification document;
Generation module, for generating the corresponding source data file of each index at random according to testing requirement, and by the source
Data file reports report server, so that the report server is generated according to the testing requirement and the source data file
The report file of each index;
Computing module, for calculating separately each index using the calculation formula of each index according to the source data file
End value, and according to the end value of each index generate report test file;
Test module, the report file generated for obtaining the report server, according to the report test file pair
The report file of acquisition carries out accuracy test.
Optionally, the extraction module, comprising:
Configuration unit, for configuring python interface, the python interface is for reading the report form formula specification text
It include the index name of index in index classification and each index classification in shelves;
Extraction unit, for extracting each finger for including in the report form formula specification document based on the python interface
Mark.
Optionally, the generation module, comprising:
Acquiring unit includes the device identification of network element for obtaining testing requirement file, in the testing requirement file with
And report form type;
Searching unit, for searching the corresponding source data template of the network element according to the device identification;
Generation unit, each index of generating random number for using the source data template and currently generating are corresponding
Source data file.
Optionally, the test module is specifically used for generating matched sql query statement according to testing requirement, utilizes institute
It states sql query statement and extracts the report file from the corresponding database of report server.
In addition, it is stored thereon with computer program the present invention also provides a kind of computer readable storage medium, the program
The step of report automatic test approach as described in relation to the first aspect is realized when being executed by processor.
In addition, the present invention also provides a kind of equipment, including memory, processor and storage on a memory and can located
The computer program run on reason device realizes that report is tested automatically as described in relation to the first aspect when the processor executes described program
The step of method.
Report automatic test approach, device, computer storage medium and equipment provided in an embodiment of the present invention, using random
The truthful data of the source data file analog network equipment of generation reports report server, passes through the report generated to report server
List file is compared with the report test file that local computing obtains, and realizes the accuracy test of report.The present invention solves
Manual testing not comprehensively, low efficiency, it is at high cost, test errors rate is high the problems such as, effectively increase report test accuracy rate and
Testing efficiency can preferably ensure the stability and accuracy of product.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in fields of the present invention.Should also
Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art
The consistent meaning of meaning, and unless otherwise will not be explained in an idealized or overly formal meaning by specific definitions.
In order to solve, manual testing's report accuracy is existing in the process to test not comprehensive, inefficiency, at high cost, test
The problems such as error rate is high, the invention proposes a kind of report automated testing methods based on robotframework platform.Make
For a kind of example, invention will be illustrated so that the report in communication equipment is tested as an example.All standard base stations of communications industry, such as
The standard of this test method tested K PI index can be used in GSM, TD-SCDMA, WCDMA, TD-LTE, FDD-LTE, BBU, EPC etc.
True property.
Fig. 1 diagrammatically illustrates the flow chart of the report automatic test approach of the embodiment of the present invention.Referring to Fig.1, of the invention
The report automatic test approach of embodiment specifically includes the following steps:
S11, each index for including in preset report form formula specification document is extracted.
In the present embodiment, each index for including in report form formula specification document is extracted, can specifically pass through following steps reality
Existing: configuration python interface is called for robotframework;The python interface is for reading the report form formula specification
It include the index name of index in index classification and each index classification in document;Based on described in python interface extraction
The each index for including in report form formula specification document.Wherein, the present embodiment middle finger is designated as the KPI index of communication equipment.
Wherein, report form formula specification document is as test specification, include each index for including in report to be tested with
And the corresponding calculation formula of each index.Further, it after extracting each index in report form formula specification document, goes back
It include: that report displayed page is opened by the library Selenium in robotframework platform, to obtain the parameter tree of report,
Realize that the parameter of KPI index is mating according to the parameter tree of report for subsequent.Parameter is mating, is to verify report and show
Index classification and index name should all be consistent with report form formula specification document.The matched specific implementation process of parameter is to use
The classification that python interface is read searches in parameter tree and classifies with the presence or absence of this, and so on, then lookup pair in corresponding classification
The index name answered.
Wherein, Robot Framework is the Function Test Automation frame that a python writes.Have it is good can
Scalability supports crucial word drive, can test a plurality of types of clients or interface simultaneously, can carry out distributed testing
It executes.
S12, the corresponding source data file of each index is generated at random according to testing requirement, and will be on the source data file
Report server is reported, so that the report server generates each index according to the testing requirement and the source data file
Report file.
In the present embodiment, need in robotframework top layer input test demand file, testing requirement file
Device identification and report form type including network element etc., such as network element+hour+period.Report form type includes small Times, day
Report, weekly etc..If it is small Times, then 4 source data files in this period are automatically generated.Because there are two the numbers of hour
According to can then calculate day report.So then automatically generating 8 source data files for day report.
Wherein, it generates the corresponding source data file of each index at random according to testing requirement, can specifically pass through following steps
It realizes: obtaining testing requirement file;The corresponding source data template of the network element is searched according to the device identification;Utilize the source
Data template and the corresponding source data file of each index of the generating random number currently generated.
Specifically, the corresponding XML template of different network elements equipment is different, XML template can from GSM, TD-SCDMA, WCDMA,
The equipment such as TD-LTE, FDD-LTE, BBU, EPC side obtains, and unlimited customized type is applied widely.It can be modified according to testing requirement
The filename and content of XML template generate four source data files if a hour, there are four source data files at this time,
And random number is inserted into each source data file, test scene is generated at random.The source data file of generation is uploaded into report at this time
It on list server, by the parsing of server, is put in storage after server successfully resolved, is finally presented in report interface.
S13, the end value for calculating separately each index using the calculation formula of each index according to the source data file,
And report test file is generated according to the end value of each index.
When according to generating random number source data file, it is also necessary to random number is recorded in execl with corresponding index,
For calculating the end value of each index using the calculation formula of each index according to the random number in source data file, and according to
The end value of each index generates report test file.
S14, the report file that the report server generates is obtained, according to the report test file to the report of acquisition
File carries out accuracy test, and ultimately generates test result.
Specifically, matched sql query statement can be generated according to testing requirement, using the sql query statement from report
The report file is extracted in the corresponding database of list server, to realize obtaining for the report file generated to report server
It takes.Specifically, report server can be logged on by sshlibrary, sql sentence is combined to search report according to testing requirement
The report messages of the network element, are then introduced into execl in the corresponding database of server, locally downloading.
Report automatic test approach provided in an embodiment of the present invention solves communications industry KPI index mostly and calculates complexity,
Artificial detection is such as used, not only error rate is high and the problems such as spending working hour more.The present invention is based on robotframework platforms to open
The automatic test KPI tool of hair not only can be with simple operations web, number using the distinctive advantage of robotframework itself
According to library, python interface may call upon, aspect is developed with regard to script, transplantability is high, and development difficulty is low, just test aspect, not only
Improve accuracy rate, also greatly reduce cost of labor, test it is not comprehensive the problems such as, preferably ensure product stability and
Accuracy.
In embodiments of the present invention, the generation of report test file and the extraction of server database report file can be determined
Shi Zhihang, if inquiring small Times, next time integral point is executed, if inquiry day report, daily morning execute, if inquiry
Weekly, then morning next Sunday executes, and so on.
The present invention is divided into two parts, a part is used to by robotframework input test demand
Robotframework is calculated automatically, and another part is exported for being put in storage after successfully resolved of uploading onto the server by database
It is that report program calculates to compare as a result, then passing through the two, show that report program calculates the accuracy of KPI, it is accurate to improve
Cost of labor greatly reduces in rate.
Report provided by the invention is tested automatically, and implementation is simple, and code for code compatibility is good, transplantability is high, is convenient for the later period
Continuous integrating.Intelligible, this method is not only applicable in communication equipment, and any associated report business, statistics calculate industry
Business or the mating business of parameter, consider such test mode.
For embodiment of the method, for simple description, therefore, it is stated as a series of action combinations, but this field
Technical staff should be aware of, and embodiment of that present invention are not limited by the describe sequence of actions, because implementing according to the present invention
Example, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know that, specification
Described in embodiment belong to preferred embodiment, the actions involved are not necessarily necessary for embodiments of the present invention.
Fig. 2 diagrammatically illustrates the structural schematic diagram of the report automatic testing equipment of the embodiment of the present invention.Referring to Fig. 2, originally
The report automatic testing equipment of inventive embodiments specifically includes extraction module 201, generation module 202, computing module 203 and surveys
Die trial block 204, in which:
Extraction module 201, for extracting each index for including in preset report form formula specification document;
Generation module 202, for generating the corresponding source data file of each index at random according to testing requirement, and will be described
Source data file reports report server, so that the report server is raw according to the testing requirement and the source data file
At the report file of each index;
Computing module 203, it is each for being calculated separately according to the source data file using the calculation formula of each index
The end value of index, and report test file is generated according to the end value of each index;
Test module 204, the report file generated for obtaining the report server, according to the report test file
Accuracy test is carried out to the report file of acquisition.
In the embodiment of the present invention, the extraction module 201, including configuration unit and extraction unit, in which:
Configuration unit, for configuring python interface, the python interface is for reading the report form formula specification text
It include the index name of index in index classification and each index classification in shelves;
Extraction unit, for extracting each finger for including in the report form formula specification document based on the python interface
Mark.
In the embodiment of the present invention, the generation module 202, including acquiring unit, searching unit, generation unit, in which:
Acquiring unit includes the device identification of network element for obtaining testing requirement file, in the testing requirement file with
And report form type;
Searching unit, for searching the corresponding source data template of the network element according to the device identification;
Generation unit, each index of generating random number for using the source data template and currently generating are corresponding
Source data file.
Further, the test module 204 is specifically used for generating matched sql query statement, benefit according to testing requirement
The report file is extracted from the corresponding database of report server with the sql query statement.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simple
Place illustrates referring to the part of embodiment of the method.
The apparatus embodiments described above are merely exemplary, wherein described, unit can as illustrated by the separation member
It is physically separated with being or may not be, component shown as a unit may or may not be physics list
Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs
In some or all of the modules achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying creativeness
Labour in the case where, it can understand and implement.
Report automatic test approach provided in an embodiment of the present invention, device utilize the source data file simulation generated at random
The truthful data of the network equipment reports report server, is obtained by the report file and local computing that generate to report server
Report test file be compared, realize report accuracy test.The present invention solve manual testing not comprehensively, efficiency
Low, at high cost, the problems such as test errors rate is high, effectively increases the accuracy rate and testing efficiency of report test, can be better
Ensure the stability and accuracy of product.
In addition, it is stored thereon with computer program the embodiment of the invention also provides a kind of computer readable storage medium,
The program realizes the step of any embodiment the method as above when being executed by processor.
In the present embodiment, if module/unit that above-mentioned report automatic testing equipment integrates is with the shape of SFU software functional unit
Formula realize and when sold or used as an independent product, can store in a computer readable storage medium.It is based on
Such understanding, the present invention realize above-described embodiment method in all or part of the process, can also by computer program come
Relevant hardware is instructed to complete, the computer program can be stored in a computer readable storage medium, the computer
Program is when being executed by processor, it can be achieved that the step of above-mentioned each embodiment of the method.Wherein, the computer program includes meter
Calculation machine program code, the computer program code can be source code form, object identification code form, executable file or certain
Intermediate form etc..The computer-readable medium may include: can carry the computer program code any entity or
Device, recording medium, USB flash disk, mobile hard disk, magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software
Distribution medium etc..It should be noted that the content that the computer-readable medium includes can be according to making laws in jurisdiction
Requirement with patent practice carries out increase and decrease appropriate, such as in certain jurisdictions, according to legislation and patent practice, computer
Readable medium does not include electric carrier signal and telecommunication signal.
Equipment provided in an embodiment of the present invention, including memory, processor and storage are on a memory and can be in processor
The computer program of upper operation, the processor realize above-mentioned each report automatic test approach when executing the computer program
The each index for including in step in embodiment, such as S11 shown in FIG. 1, the preset report form formula specification document of extraction.
S12, it generates the corresponding source data file of each index at random according to testing requirement, and reports report to take the source data file
Be engaged in device, for the report server according to the testing requirement and the source data file generate each index report text
Part.S13, the end value for calculating separately each index using the calculation formula of each index according to the source data file, and root
Report test file is generated according to the end value of each index.S14, the report file that the report server generates is obtained, according to
The report test file carries out accuracy test to the report file of acquisition.Alternatively, the processor executes the computer
The function of each module/unit in above-mentioned each report automatic testing equipment embodiment, such as extraction mould shown in Fig. 2 are realized when program
Block 201, generation module 202, computing module 203 and test module 204.
Illustratively, the computer program can be divided into one or more module/units, one or more
A module/unit is stored in the memory, and is executed by the processor, to complete the present invention.It is one or more
A module/unit can be the series of computation machine program instruction section that can complete specific function, and the instruction segment is for describing institute
State implementation procedure of the computer program in corresponding report automatic testing equipment.
The equipment may include, but be not limited only to, processor, memory.It will be understood by those skilled in the art that described set
The standby restriction not constituted to equipment, may include more or fewer components, perhaps combine certain components or different portions
Part, such as the equipment can also include input-output equipment, network access equipment, bus etc..
The processor can be central processing unit (Central Processing Unit, CPU), can also be it
His general processor, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng the processor is the control centre of the equipment, utilizes the various pieces of various interfaces and connection whole equipment.
The memory can be used for storing the computer program and/or module, and the processor is by operation or executes
Computer program in the memory and/or module are stored, and calls the data being stored in memory, described in realization
The various functions of equipment.The memory can mainly include storing program area and storage data area, wherein storing program area can deposit
Application program (such as sound-playing function, image player function etc.) needed for storing up operating system, at least one function etc.;Storage
Data field, which can be stored, uses created data (such as audio data, phone directory etc.) etc. according to mobile phone.In addition, memory can
It can also include nonvolatile memory, such as hard disk, memory, plug-in type hard disk, intelligence to include high-speed random access memory
Energy storage card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash
Card), at least one disk memory, flush memory device or other volatile solid-state parts.
In embodiments of the present invention, it should be understood that disclosed device and method, it can be real by another way
It is existing.For example, the apparatus embodiments described above are merely exemplary, for example, the division of the unit or unit, only
A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of equipment or unit
It connects, can be electrical or other forms.
It will be appreciated by those of skill in the art that although some embodiments in this include included in other embodiments
Certain features rather than other feature, but the combination of the feature of different embodiments means to be within the scope of the present invention simultaneously
And form different embodiments.For example, in the following claims, the one of any of embodiment claimed all may be used
Come in a manner of in any combination using.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.