CN106055692A - Automatic testing method and system for comparison files or folders - Google Patents
Automatic testing method and system for comparison files or folders Download PDFInfo
- Publication number
- CN106055692A CN106055692A CN201610407746.3A CN201610407746A CN106055692A CN 106055692 A CN106055692 A CN 106055692A CN 201610407746 A CN201610407746 A CN 201610407746A CN 106055692 A CN106055692 A CN 106055692A
- Authority
- CN
- China
- Prior art keywords
- file
- consistent
- cryptographic hash
- comparison
- inconsistent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides an automatic testing method and system for comparison files or folders. The method comprises: by comparison of hash values, judging whether contents and attributes of the various files are consistent or not, and determining that the various files are consistent if the contents and the attributes of the various files are consistent; and by comparison of the harsh values, judging various files in various corresponding directory levels and directory attributes of the various folders are consistent or not, and determining that the various folders are consistent if the various files in the various corresponding directory levels and directory attributes of the various folders are consistent. The invention also provides a method and a system for verifying whether various files or various folders stored in different computers are consistent or not, corresponding hash values are obtained by setting an XML-RPC server framework on a computer of a storage party, and the comparisons are completed on a third-party computer provided with an xmlrpcli module, thereby implementing judgment on whether the various files or the various folders are consistent or not. The invention also provides an automatic testing tool for a test case composed by the method so as to implement verification of the files or folders, which replaces cumbersome manual tests and improves testing efficiency and accuracy.
Description
Technical field
The present invention relates to computer software automatic test field, particularly relate to the automatization of comparison file or folder
Method of testing and system.
Background technology
Along with the development of computer software, Experience of Software Testing Work seems more and more important.But, traditional manual test meeting
There is substantial amounts of repetitive operation, expend the time long, and mistake easily occurs.In the development that computer technology is maked rapid progress
In, the amount of file (folder) is increasing, more and more higher to the accuracy requirement of data, and slightly mistake is possible to cause very
Serious problem.Visible, the traditional comparative approach by artificial comparison file (folder) one by one, cannot meet current need
Ask.
Summary of the invention
The shortcoming of prior art in view of the above, it is an object of the invention to provide the automatic of comparison file or folder
Change method of testing and system, be used for the problems such as manual test file (folder) efficiency is low, error rate is high in prior art that solve.
For achieving the above object and other relevant purposes, the present invention provides the automated testing method of comparison file, is used for
Verifying that each described file is the most consistent, described method includes: judge that the content of each described file is the most consistent, including: calculate each
First cryptographic Hash of file;Respectively by each described first cryptographic Hash write first text literary composition the most each with each described file
In Dang;Calculate the second cryptographic Hash of each described first text document respectively;Each described second cryptographic Hash being compared, comparison is tied
The content of the fruit each file corresponding to inconsistent each second cryptographic Hash is inconsistent;Comparison result is that consistent each second breathes out
The content of each file corresponding to uncommon value is consistent;Judge that the attribute of each described file is the most consistent, including: obtain each file
Each property value;Respectively by each described property value of each described file with sequence write second literary composition the most each with each described file
In this document;Calculate the 3rd cryptographic Hash of each described second text document respectively;Each described 3rd cryptographic Hash is compared, than
To result be the attribute of the inconsistent each file corresponding to each 3rd cryptographic Hash be inconsistent;Comparison result is consistent each
The attribute of each file corresponding to three cryptographic Hash is consistent;Judge that the content of each described file and attribute are the most all consistent, if
It is that the most each described file is consistent;If it is not, the most each described file is inconsistent.
In one embodiment of the invention, described first cryptographic Hash, the second cryptographic Hash and the 3rd cryptographic Hash include: MD5 value,
Or SHA1 value.
In one embodiment of the invention, each property value of each described file of described acquisition includes: based on Python
Os.stat method obtains.
For achieving the above object and other relevant purposes, the present invention provides the automatization test system of comparison file, is used for
Verifying that each described file is the most consistent, described system includes: the first processing module, for calculating the first cryptographic Hash of each file;
Respectively by each described first cryptographic Hash write and the most each first text document of each described file;Calculate each institute respectively
State the second cryptographic Hash of the first text document;First test module, for each described second cryptographic Hash being compared, comparison is tied
The content of the fruit each file corresponding to inconsistent each second cryptographic Hash is inconsistent;Comparison result is that consistent each second breathes out
The content of each file corresponding to uncommon value is consistent;Second processing module, for obtaining each property value of each file;Respectively will be each
The each described property value of described file is with in sequence write and the most each second text document of each described file;Calculate respectively
3rd cryptographic Hash of each described second text document;Second test module, for each described 3rd cryptographic Hash is compared, than
To result be the attribute of the inconsistent each file corresponding to each 3rd cryptographic Hash be inconsistent;Comparison result is consistent each
The attribute of each file corresponding to three cryptographic Hash is consistent;3rd test module, for when described first test module and second
When the comparison result of test module is all consistent, it is determined that each described file is consistent;Otherwise, it is determined that each described file is for differing
Cause.
In one embodiment of the invention, described first cryptographic Hash, the second cryptographic Hash and the 3rd cryptographic Hash include: MD5 value,
Or SHA1 value.
In one embodiment of the invention, each property value of each described file of described acquisition includes: based on Python
Os.stat method obtains.
For achieving the above object and other relevant purposes, the present invention provides the automated testing method of comparison file, uses
In verifying that each described file is the most consistent, described method includes: judge the catalogue layer of each correspondence of each described file respectively
Each file in Ji is the most consistent, including: the automated testing method of arbitrary described comparison file;Judge each institute respectively
The directory attribute of the catalogue level stating each correspondence of file is the most consistent, including: obtain each mesh in each described file respectively
The property value of record, and with in sequence write and the most each 3rd text document of each described file;Calculate each described respectively
4th cryptographic Hash of the 3rd text document;Each described 4th cryptographic Hash being compared, comparison result is inconsistent each 4
Each directory attribute corresponding to cryptographic Hash is inconsistent;Comparison result is that the consistent each catalogue corresponding to each 4th cryptographic Hash belongs to
Property is consistent;Judge each described file each correspondence catalogue level in each file and each directory attribute be the most all one
Causing, the most each described file is consistent;If it is not, the most each described file is inconsistent.
Each literary composition in one embodiment of the invention, in the catalogue level of the described each correspondence judging each described file respectively
Whether part consistent, also includes: os.walk based on Python and os.path.join method travel through each described file from
And obtain the path of each file in each described file, for the first cryptographic Hash calculating each described file.
For achieving the above object and other relevant purposes, the present invention provides the automatization test system of comparison file, uses
In verifying that each described file is the most consistent, described system includes: the first judge module, for according to arbitrary described comparison literary composition
The automated testing method of part, judge respectively each described file each correspondence catalogue level in each file the most consistent;
Second judge module, the most consistent for judging the directory attribute of the catalogue level of each correspondence of each described file respectively, bag
Include: obtain the property value of each catalogue in each described file respectively, and the most each with each described file with sequence write
In 3rd text document;Calculate the 4th cryptographic Hash of each described 3rd text document respectively;Each described 4th cryptographic Hash is carried out
Comparison, each directory attribute corresponding to each 4th cryptographic Hash that comparison result is inconsistent is inconsistent;Comparison result is consistent
The each directory attribute corresponding to each 4th cryptographic Hash be consistent;3rd judge module, for judging each of each described file
The corresponding each file in catalogue level and each directory attribute are the most all consistent, and the most each described file is consistent;
If it is not, the most each described file is inconsistent.
Each literary composition in one embodiment of the invention, in the catalogue level of the described each correspondence judging each described file respectively
Whether part consistent, also includes: os.walk based on Python and os.path.join method travel through each described file from
And obtain the path of each file in each described file, for the first cryptographic Hash calculating each described file.
For achieving the above object and other relevant purposes, the present invention provides the automatic test side of comparison file or folder
Method, is used for verifying that each described file or each described file are the most consistent, wherein, and each described file or the storage of each described file
In different computers, including respectively: XML-RPC server framework in each described computer, described method includes: each described
In computer, automatic according to the automated testing method of arbitrary described comparison file or arbitrary described comparison file
Change method of testing and obtain corresponding cryptographic Hash;Each corresponding cryptographic Hash is taken by each described computer by respective XMLRPC
Business device framework passes to third party's computer, judges each described file or each institute for described third party's computer after comparing
Whether consistent state file, wherein, described third party's computer includes: is used for calling and is registered in each described XML-RPC service
The xmlrpcli module of the function in device framework.
For achieving the above object and other relevant purposes, the present invention provides the automatic test system of comparison file or folder
System, is used for verifying that each described file or each described file are the most consistent, wherein, and each described file or the storage of each described file
In different computers, described system includes: each service framework module, for each described computer according to arbitrary described comparison
The automated testing method of file or the automated testing method of arbitrary described comparison file obtain corresponding cryptographic Hash;
Each corresponding cryptographic Hash is passed to third party's computer;Xmlrpcli module, for described third party's computer comparison
Each corresponding cryptographic Hash, thus judge that each described file or each described file are the most consistent.
For achieving the above object and other relevant purposes, the present invention provides a kind of automatic test device, including: according to appointing
The automated testing method of the comparison file described in, the automated testing method of arbitrary described comparison file and/or institute
The test case that the automated testing method of the comparison file or folder stated is write, described test case is for according to input
The path of each file or each file judges that each described file or each described file are the most consistent.
As it has been described above, the automated testing method of the comparison file or folder of the present invention and system, it is adaptable to
The comparison of the various types of file or folders in Windows, Linux, AIX operating system so that enter under these circumstances
Go to compare and become simple, efficient, it is possible to avoid the mistake caused by human negligence.
Accompanying drawing explanation
Figure 1A is shown as the automated testing method flow chart of the comparison file of one embodiment of the invention.
Figure 1B is shown as the automated testing method flow chart of the comparison file content of one embodiment of the invention.
Fig. 1 C is shown as the automated testing method flow chart of the comparison file attribute of one embodiment of the invention.
Fig. 2 is shown as the automatization test system module map of the comparison file of one embodiment of the invention.
Fig. 3 A is shown as the automated testing method flow chart of the comparison file of one embodiment of the invention.
Fig. 3 B is shown as the automated testing method flow chart of the directory attribute of the comparison file of one embodiment of the invention.
Fig. 4 is shown as the automatization test system module map of the comparison file of one embodiment of the invention.
Element numbers explanation
The automatization test system of 2 comparison files
201 first processing modules
202 first test modules
203 second processing modules
204 second test modules
205 the 3rd test modules
The automatization test system of 4 comparison files
401 first judge modules
402 second judge modules
403 the 3rd judge modules
Detailed description of the invention
Below by way of specific instantiation, embodiments of the present invention being described, those skilled in the art can be by this specification
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also be by the most different concrete realities
The mode of executing is carried out or applies, the every details in this specification can also based on different viewpoints and application, without departing from
Various modification or change is carried out under the spirit of the present invention.It should be noted that, in the case of not conflicting, following example and enforcement
Feature in example can be mutually combined.
It should be noted that the diagram provided in following example illustrates the basic structure of the present invention the most in a schematic way
Think, the most graphic in component count, shape and size time only display with relevant assembly in the present invention rather than is implemented according to reality
Drawing, during its actual enforcement, the kenel of each assembly, quantity and ratio can be a kind of random change, and its assembly layout kenel is also
It is likely more complexity.
For two files, it is ensured that the two is identical, then to meet: 1, the content of the two is identical simultaneously;2、
The attribute of the two is identical.For two files, owing to file having different catalogue levels and corresponding file,
Ensure that the two is identical, then need to meet: 1, the content of the file of each catalogue level of file is identical simultaneously;2, literary composition
The attribute of the file that part presss from both sides each catalogue level is identical;3, the complete phase of attribute of catalogue in each catalogue level of file
With.
Preferably, the present invention (is called for short: RF) automated test frame based on Robot Framework, uses Python language
Speech realizes related algorithm, is compared by the data calling these methods in RF with obtain test object, thus reaches literary composition
The test purpose that part or file compare automatically.Concrete, can first judge that comparison other A, B are file or file;If
File, then directly the content of comparison document and attribute;If file, then need to travel through owning under all catalogues and catalogue
File, the file of the most each catalogue level and directory attribute.Concrete analysis is following will be developed in details in.
Referring to Figure 1A 1C, the present embodiment provides the automated testing method of a kind of comparison file, including step S101,
S102 and S103, wherein, step S101, the order of S102 do not limit, and cryptographic Hash can be MD5 value, SHA1 value etc..
Step S101: judge that the content of each described file is the most consistent, including:
Step S1011: calculate the first cryptographic Hash of each file;
Step S1012: respectively by each described first cryptographic Hash write and the most each first text of each described file
In document;
Step S1013: calculate the second cryptographic Hash of each described first text document respectively;
Step S1014: each described second cryptographic Hash compared, comparison result is inconsistent each second cryptographic Hash institute
The content of corresponding each file is inconsistent;Comparison result is that the content of the consistent each file corresponding to each second cryptographic Hash is
Unanimously.It is implemented as follows:
Use Python, obtain the MD5 value of file, then MD5 value is write in a text document, then obtain
The MD5 value of this text document, returns MD5 value, is used for comparing.For file A, B, the most according to the method, obtain its content
The MD5 value of corresponding text document, if MD5 value is identical, then A, B content is consistent;Otherwise A, B content is inconsistent.
Step S102: judge that the attribute of each described file is the most consistent, including:
Step S1021: obtain each property value of each file;
Step S1022: respectively by each described property value of each described file with sequence write and each described file one_to_one corresponding
Each second text document in;
Step S1023: calculate the 3rd cryptographic Hash of each described second text document respectively;
Step S1024: each described 3rd cryptographic Hash compared, comparison result is inconsistent each 3rd cryptographic Hash institute
The attribute of corresponding each file is inconsistent;Comparison result is that the attribute of the consistent each file corresponding to each 3rd cryptographic Hash is
Unanimously.It is implemented as follows:
Use Python, use os.stat () method, obtain every property value of file, then every attribute
Value is write in a text document in a fixed order, then obtains the MD5 value of this text document, returns MD5 value, be used for than
Relatively.For file A, B, the most according to the method, obtain the MD5 value of its attribute correspondence text document, if MD5 value is identical, then
A, B attribute is consistent;Otherwise A, B attribute is inconsistent.
Step S103: judging that the content of each described file and attribute are the most all consistent, the most each described file is
Unanimously;If it is not, the most each described file is inconsistent.
Referring to Fig. 2, with said method embodiment principle similarly, the present invention provides the automatic test of comparison file
System 2, owing to the technical characteristic in embodiment of the method can apply to native system embodiment, thus it is no longer repeated.System 2
Including: the first processing module 201, first is tested module the 202, second processing module 203, second and is tested module the 204, the 3rd test
Module 205.
First processing module 201 is for calculating the first cryptographic Hash of each file;Respectively by each described first cryptographic Hash write
In the first text document the most each with each described file;Calculate the second Hash of each described first text document respectively
Value.First test module 202 is for comparing each described second cryptographic Hash, and comparison result is inconsistent each second Hash
The content of each file corresponding to value is inconsistent;Comparison result is the interior of the consistent each file corresponding to each second cryptographic Hash
It is consistent for holding.Second processing module 203 is for obtaining each property value of each file;Respectively by each described attribute of each described file
It is worth with in sequence write and the most each second text document of each described file;Calculate each described second text document respectively
3rd cryptographic Hash.Second test module 204 is for comparing each described 3rd cryptographic Hash, and comparison result is inconsistent each
The attribute of each file corresponding to the 3rd cryptographic Hash is inconsistent;Comparison result is each corresponding to consistent each 3rd cryptographic Hash
The attribute of file is consistent.3rd test module 205 for testing the comparison knot of module and the second test module when described first
When fruit is all consistent, it is determined that each described file is consistent;Otherwise, it is determined that each described file is inconsistent.
It should be noted that described first cryptographic Hash, the second cryptographic Hash and the 3rd cryptographic Hash include: MD5 value or SHA1
Value.Each property value of each described file of described acquisition includes: os.stat method based on Python obtains.
Referring to Fig. 3 A 3B, the present embodiment provides the automated testing method of a kind of comparison file, including step
S301, S302 and S303, wherein, step S301, the order of S302 do not limit.
Step S301: judge respectively each described file each correspondence catalogue level in each file whether consistent, bag
Include: the automated testing method step S101 S103 of comparison file as above, be not developed in details at this.
Step S302: judge that the directory attribute of the catalogue level of each correspondence of each described file is the most consistent respectively, bag
Include:
Step S3021: obtain the property value of each catalogue in each described file respectively, and with sequence write and each described file
Press from both sides in the most each 3rd text document;
Step S3022: calculate the 4th cryptographic Hash of each described 3rd text document respectively;
Step S3023: each described 4th cryptographic Hash compared, comparison result is inconsistent each 4th cryptographic Hash institute
Corresponding each directory attribute is inconsistent;The each directory attribute corresponding to each 4th cryptographic Hash that comparison result is consistent is one
Cause.
Step S303: judge each described file each correspondence catalogue level in each file and each directory attribute be
No is all consistent, and the most each described file is consistent;If it is not, the most each described file is inconsistent.Implement as
Under:
(1) for file A, use Python, call os.walk (A) and obtain the initial path of ternary a: A
All Files folder (representing with A [1]) under (representing with A [0]), initial path, the file (representing with A [2]) under initial path.
(2) use for circulation, all of file (representing with A_file [i]) in traversal A [2], use function
Os.path.join (A [0], A_file [i])), obtain the path of A_file [i], then obtain the content of A_file [i]
MD5 value, and in MD5 value write text document, until having traveled through all of file in A [2], the MD5 value every time obtained is equal
In write text document.
(3) all of file in traversal A [1], uses for circulation, based on the file in A [1] [i], repeats
Operation (1), (2), until the All Files folder traveled through in A [1].
(4) three steps more than (1) (2) (3) i.e. can get the MD5 value of the content of All Files in file A, and these MD5
Value is recorded in text document, then obtains the MD5 value of this text document, returns MD5 value, is used for comparing.For file
Folder A, B, the most according to the method, obtain the MD5 value of its content correspondence text document, if MD5 value is identical, then and A, B content one
Cause;Otherwise A, B content is inconsistent.
(5) by the method combining traversing directories and the method obtaining file attribute, All Files in file A is obtained
The MD5 value of attribute, and these MD5 values are recorded in text document, then obtain the MD5 value of this text document, return MD5
Value, is used for comparing.For file A, B, the most according to the method, obtain the MD5 value of its attribute correspondence text document, if
MD5 value is identical, then A, B attribute is consistent;Otherwise A, B attribute is inconsistent.
(6) all catalogues in traverse folder, obtain the MD5 value of the attribute of all catalogues in file A, and these
MD5 value is recorded in text document, then obtains the MD5 value of this text document, returns MD5 value, is used for comparing.For literary composition
Part folder A, B, the most according to the method, obtain the MD5 value of its each catalogue level correspondence text document, if MD5 value is identical, then
In each catalogue level of A, B, the attribute of catalogue is consistent, and otherwise in each catalogue level of A, B, the attribute of catalogue is inconsistent.
(7) if the result of each object comparison above-mentioned is all consistent, the most finally judge that the file of comparison is consistent.
Referring to Fig. 4, with said method embodiment principle similarly, the present invention provides the automatization of comparison file to survey
Test system 4, the technical characteristic in implementing due to preceding method can apply to native system embodiment, thus it is no longer repeated.
System 4 includes: first judge module the 401, second judge module the 402, the 3rd judge module 403.
First judge module 401, for the automated testing method according to described comparison file, judges each described respectively
Whether each file in the catalogue level of each correspondence of file consistent, such as, os.walk based on Python and
Os.path.join method travels through each described file thus obtains the path of each file in each described file, for calculating
First cryptographic Hash of each described file.Second judge module 402 is for judging the catalogue of each correspondence of each described file respectively
Whether the directory attribute of level consistent, including: obtain the property value of each catalogue in each described file respectively, and with sequence write with
In the most each 3rd text document of each described file;Calculate the 4th Hash of each described 3rd text document respectively
Value;Each described 4th cryptographic Hash being compared, comparison result is that the inconsistent each catalogue corresponding to each 4th cryptographic Hash belongs to
Property is inconsistent;The each directory attribute corresponding to each 4th cryptographic Hash that comparison result is consistent is consistent.3rd judge module
403 each files in the catalogue level judging each correspondence of each described file and each directory attribute be the most all unanimously,
The most each described file is consistent;If it is not, the most each described file is inconsistent.
For the file on same machine, the cryptographic Hash of return can directly compare.For on different machines
File, has no idea directly to compare, and needs the cryptographic Hash on different machines to be put into same place, just can compare.In
It is that the present invention also provides for the automated testing method of comparison file or folder, is stored in different computers for checking
Each described file or each described file are the most consistent, wherein, include respectively in each described computer: XML-RPC server frame
Frame, described method includes:
1) in each described computer, according to automated testing method or the described comparison literary composition of described comparison file
The automated testing method of part folder obtains corresponding cryptographic Hash;
2) each corresponding cryptographic Hash is passed to by respective XMLRPC server framework by each described computer
Tripartite's computer, judges each described file or each described file whether for described third party's computer after comparing
Causing, wherein, described third party's computer includes: for calling the function being registered in each described XML-RPC server framework
Xmlrpcli module.It is implemented as follows:
The XMLRPC using Python realizes the communication between different machines.Such as, two different machines are compared
File (folder) A, B on Client1, Client2, concrete methods of realizing: use class libraries on Client1, Client2 respectively:
SimpleXMLRPCServer constructs a most basic XML-RPC server framework;An other machine Client3 makes
The function being registered in XML-RPC server end is called with class libraries: xmlrpcli.Client1, Client2 are respectively adopted above-mentioned
Method gets the cryptographic Hash of correspondence, then by XMLRPC, cryptographic Hash is passed to Client3, right on Client3
Content (cryptographic Hash) or the attribute (cryptographic Hash) of file (folder) A, B on Client1, Client2 compare, and reach different machine literary composition
Part (folder) omparison purpose.
With said method embodiment principle similarly, the present invention provides the automatic test system of comparison file or folder
System, the technical characteristic in implementing due to preceding method can apply to native system embodiment, thus it is no longer repeated, including:
Each service framework module, xmlrpcli module.
Each service framework module for each described computer according to the automated testing method of described comparison file or institute
The automated testing method of the comparison file stated obtains corresponding cryptographic Hash;Each corresponding cryptographic Hash is passed to the 3rd
Side's computer.Xmlrpcli module is used for the described each corresponding cryptographic Hash of third party's computer comparison, thus judges each institute
State file or each described file is the most consistent.
In addition, the present invention also provides for a kind of automatic test device, including: according to arbitrary described comparison file
Automated testing method, the automated testing method of described comparison file, described comparison file or folder automatic
Changing the test case that method of testing is write, described test case judges for the path of each file according to input or each file
Each described file or each described file are the most consistent, it is achieved above method and the combination of automatization framework RF, thus reach complete
The effect that automatization compares.It is implemented as follows:
(1) RF is a general automation test frame increased income, realize based on Python.RF can import third party
Storehouse, it is also possible to import the class in self-defining Python program, is placed on the function realized in said method in same class, so
Afterwards this class is loaded in Robot Framework automated test tool as Library, is then obtained by call method
To return value, the keyword should mach then using RF to carry compares two return values, if coupling, then use-case performs
Success, shows that result is consistent;If not mating, then use-case performs failure, shows that result is inconsistent.So can carry out very easily
Documents Comparison, it is only necessary to file (folder) path to be compared is filled in the automatization's use-case finished writing, performs automatization and uses
Example i.e. can reach the purpose of comparison document.
It should be noted that the automated testing method of the comparison file or folder of the present invention, it is adaptable to Windows,
The comparison of the various types of file or folders in Linux, AIX operating system, the computer at comparison other place needs
There is the running environment of Python.It is implemented as follows:
(1) for Windows environment:
In order to avoid installing Python and the troublesome operation of various third party library, can use Py2exe[py2exe is one
The instrument of the individual executable program (* .exe) independently executed that python script is converted on windows] instrument,
Python environment and storehouse are packaged into an exe file, run this exe program in the environment of needs.
1. RF automated test tool is disposed at a window client.
2. (cross py2exe to beat in the upper Python program of running of comparison other A, B place machine (same machine or different machine)
The exe file wrapped).
3. run RF automation tools, load the library file that Python realizes, write automatization's use-case, at automatization's use-case
In fill in A, B path, the file comparision method of the realization calling Python obtains the cryptographic Hash of A, B content (attribute) respectively, makes
Compare with should match.If use-case runs through, then documentary evidence is consistent;If use-case runs unsuccessfully, then prove not
Unanimously.
(2) for Linux environment:
General System installs and has just carried Python, therefore need not do operation bidirectional, can be suitable in the present invention
Implementation method.
1. RF automated test tool is disposed at a window client.
2. under some catalogue of machine of comparison other A, B place, place the comparison program that Python realizes.
3. use Python to write a program to implement function such as: under Linux environment, run an order, get this
The return value (being logged in by ssh, port numbers, run order or return value realizes) of order.
4. run RF automation tools, load the library file that Python realizes, write automatization's use-case, at automatization's use-case
In fill in A, B path, the file comparision method of the realization calling Python obtains the cryptographic Hash of A, B content (attribute) respectively, makes
Compare with should match.If use-case runs through, then documentary evidence is consistent;If use-case runs unsuccessfully, then prove not
Unanimously.
(3) for AIX environment:
General System installs and has not carried Python, it is therefore desirable to manual installation Python running environment.
1. RF automated test tool is disposed at a window client.
2. under some catalogue of machine of comparison other A, B place, place the comparison program that Python realizes.
3. use Python to write a program to implement function such as: under AIX environment, run an order, get this life
The return value (being logged in by ssh, port numbers, run order or return value realizes) of order.
4. run RF automation tools, load the library file that Python realizes, write automatization's use-case, at automatization's use-case
In fill in A, B path, the file comparision method of the realization calling Python obtains the cryptographic Hash of A, B content (attribute) respectively, makes
Compare with should match.If use-case runs through, then documentary evidence is consistent;If use-case runs unsuccessfully, then prove not
Unanimously.
In sum, the documents of the present invention or the automated testing method of file and system, it is possible to replace manual
Test, improves testing efficiency, and is avoided that the mistake that manual test is brought, thus save manpower and time, effectively overcome
Various shortcoming of the prior art and have high industrial utilization.
The principle of above-described embodiment only illustrative present invention and effect thereof, not for limiting the present invention.Any ripe
Above-described embodiment all can be modified under the spirit and the scope of the present invention or change by the personage knowing this technology.Cause
This, have usually intellectual such as complete with institute under technological thought without departing from disclosed spirit in art
All equivalences become are modified or change, and must be contained by the claim of the present invention.
Claims (10)
1. the automated testing method of a comparison file, it is characterised in that be used for verifying that each described file is the most consistent, described
Method includes:
Judge that the content of each described file is the most consistent, including: calculate the first cryptographic Hash of each file;Respectively by each described first
In cryptographic Hash write and the most each first text document of each described file;Calculate each described first text document respectively
Second cryptographic Hash;Each described second cryptographic Hash being compared, comparison result is corresponding to inconsistent each second cryptographic Hash
The content of each file is inconsistent, comparison result be the content of the consistent each file corresponding to each second cryptographic Hash be consistent;
Judge that the attribute of each described file is the most consistent, including: obtain each property value of each file;Respectively by each described file
Each described property value is with in sequence write and the most each second text document of each described file;Calculate each described second respectively
3rd cryptographic Hash of text document;Each described 3rd cryptographic Hash being compared, comparison result is inconsistent each 3rd Hash
The attribute of each file corresponding to value is inconsistent;Comparison result is the genus of the consistent each file corresponding to each 3rd cryptographic Hash
Property is consistent;
Judging that the content of each described file and attribute are the most all consistent, the most each described file is consistent;If it is not, it is the most each
Described file is inconsistent.
The automated testing method of comparison file the most according to claim 1, it is characterised in that described first cryptographic Hash,
Second cryptographic Hash and the 3rd cryptographic Hash include: MD5 value or SHA1 value.
The automated testing method of comparison file the most according to claim 1, it is characterised in that each described literary composition of described acquisition
Each property value of part includes: os.stat method based on Python obtains.
4. the automatization test system of a comparison file, it is characterised in that be used for verifying that each described file is the most consistent, described
System includes:
First processing module, for calculating the first cryptographic Hash of each file;Respectively by each described first cryptographic Hash write and each institute
State in the most each first text document of file;Calculate the second cryptographic Hash of each described first text document respectively;
First test module, for each described second cryptographic Hash being compared, comparison result is inconsistent each second Hash
The content of each file corresponding to value is inconsistent, and comparison result is the interior of the consistent each file corresponding to each second cryptographic Hash
It is consistent for holding;
Second processing module, for obtaining each property value of each file;Respectively by the same sequence of each described property value of each described file
In write and the most each second text document of each described file;Calculate the 3rd Kazakhstan of each described second text document respectively
Uncommon value;
Second test module, for each described 3rd cryptographic Hash being compared, comparison result is inconsistent each 3rd Hash
The attribute of each file corresponding to value is inconsistent;Comparison result is the genus of the consistent each file corresponding to each 3rd cryptographic Hash
Property is consistent;
3rd test module, for when the comparison result of described first test module with the second test module is all consistent, sentencing
Fixed each described file is consistent;Otherwise, it is determined that each described file is inconsistent.
5. the automated testing method of a comparison file, it is characterised in that be used for verifying that each described file is the most consistent,
Described method includes:
Judge respectively each described file each correspondence catalogue level in each file whether consistent, including: such as claim 1
The automated testing method of arbitrary described comparison file in 3;
Judge that the directory attribute of the catalogue level of each correspondence of each described file is the most consistent respectively, including: obtain each respectively
The property value of each catalogue in described file, and with sequence write and the most each 3rd text document of each described file
In;Calculate the 4th cryptographic Hash of each described 3rd text document respectively;Each described 4th cryptographic Hash is compared, comparison result
Each directory attribute corresponding to inconsistent each 4th cryptographic Hash is inconsistent;Comparison result is consistent each 4th cryptographic Hash
Corresponding each directory attribute is consistent;
Judge each described file each correspondence catalogue level in each file and each directory attribute be the most all consistent, if
It is that the most each described file is consistent;If it is not, the most each described file is inconsistent.
The automated testing method of comparison file the most according to claim 5, it is characterised in that described judgement respectively is each
Each file in the catalogue level of each correspondence of described file is the most consistent, also includes: os.walk based on Python
Travel through each described file with os.path.join method thus obtain the path of each file in each described file, for meter
Calculate the first cryptographic Hash of each described file.
7. the automatization test system of a comparison file, it is characterised in that be used for verifying that each described file is the most consistent,
Described system includes:
First judge module, for the automated testing method according to described comparison file arbitrary in claims 1 to 3, point
Do not judge each described file each correspondence catalogue level in each file the most consistent;
Second judge module, for judging the directory attribute of the catalogue level of each correspondence of each described file whether respectively
Cause, including: obtain the property value of each catalogue in each described file respectively, and with sequence write and each described file one_to_one corresponding
Each 3rd text document in;Calculate the 4th cryptographic Hash of each described 3rd text document respectively;By each described 4th cryptographic Hash
Comparing, each directory attribute corresponding to each 4th cryptographic Hash that comparison result is inconsistent is inconsistent;Comparison result is
The consistent each directory attribute corresponding to each 4th cryptographic Hash is consistent;
3rd judge module, each file and each catalogue in the catalogue level judging each correspondence of each described file belong to
Property be the most all consistent, the most each described file is consistent;If it is not, the most each described file is inconsistent.
8. the automated testing method of a comparison file or folder, it is characterised in that be used for verifying each described file or each
Described file is the most consistent, and wherein, each described file or each described file are stored in different computers, each described calculating
Including respectively in machine: XML-RPC server framework, described method includes:
In each described computer, according to the automated testing method of described comparison file arbitrary in claims 1 to 3 or
The automated testing method of the comparison file described in claim 5 or 6 obtains corresponding cryptographic Hash;
Each corresponding cryptographic Hash is passed to third party by respective XMLRPC server framework and counts by each described computer
Calculation machine, judges after comparing for described third party's computer that each described file or each described file are the most consistent, wherein,
Described third party's computer includes: for calling the function that is registered in each described XML-RPC server framework
Xmlrpcli module.
9. the automatization test system of a comparison file or folder, it is characterised in that be used for verifying each described file or each
Described file is the most consistent, and wherein, each described file or each described file are stored in different computers, described system bag
Include:
Each service framework module, for automatic according to described comparison file arbitrary in claims 1 to 3 of each described computer
The automated testing method changing the comparison file described in method of testing or claim 5 or 6 obtains corresponding cryptographic Hash;Will
Each corresponding cryptographic Hash passes to third party's computer;
Xmlrpcli module, for the described each corresponding cryptographic Hash of third party's computer comparison, thus judges each described literary composition
Part or each described file are the most consistent.
10. an automatic test device, it is characterised in that including: according to described comparison literary composition arbitrary in claims 1 to 3
The automated testing method of the comparison file described in the automated testing method of part, claim 5 or 6 and/or claim
The test case that the automated testing method of the comparison file or folder described in 8 is write, described test case is for according to defeated
The each file entered or the path of each file judge that each described file or each described file are the most consistent.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610407746.3A CN106055692A (en) | 2016-06-12 | 2016-06-12 | Automatic testing method and system for comparison files or folders |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610407746.3A CN106055692A (en) | 2016-06-12 | 2016-06-12 | Automatic testing method and system for comparison files or folders |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106055692A true CN106055692A (en) | 2016-10-26 |
Family
ID=57171202
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610407746.3A Pending CN106055692A (en) | 2016-06-12 | 2016-06-12 | Automatic testing method and system for comparison files or folders |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106055692A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107194255A (en) * | 2017-06-08 | 2017-09-22 | 郑州云海信息技术有限公司 | A kind of file safety management method and device |
CN107391663A (en) * | 2017-07-19 | 2017-11-24 | 郑州云海信息技术有限公司 | A kind of file MD5 value automatic batch calibration equipments and method |
CN110083615A (en) * | 2019-04-12 | 2019-08-02 | 平安普惠企业管理有限公司 | A kind of data verification method, device, electronic equipment and storage medium |
CN110489701A (en) * | 2019-08-19 | 2019-11-22 | 安徽三实信息技术服务有限公司 | Extract the method, apparatus and CMS recognition methods of CMS identification feature |
WO2020124289A1 (en) * | 2018-12-16 | 2020-06-25 | 吉安市井冈山开发区金庐陵经济发展有限公司 | Information comparison method and device |
WO2024000497A1 (en) * | 2022-06-30 | 2024-01-04 | 西门子(中国)有限公司 | Security detection method and apparatus for memory, and computer device |
CN117422281A (en) * | 2023-12-18 | 2024-01-19 | 深圳赛桥生物创新技术有限公司 | Process file testing method and device, computer equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101673307A (en) * | 2009-10-21 | 2010-03-17 | 中国农业大学 | Space data index method and system |
US8176018B1 (en) * | 2008-04-30 | 2012-05-08 | Netapp, Inc. | Incremental file system differencing |
CN103136354A (en) * | 2013-03-04 | 2013-06-05 | 浪潮电子信息产业股份有限公司 | Linux system folder comparison method |
CN103729342A (en) * | 2012-10-12 | 2014-04-16 | ***股份有限公司 | File comparison method and device |
CN104111937A (en) * | 2013-04-18 | 2014-10-22 | 中兴通讯股份有限公司 | Master database standby database and data consistency testing and repairing method and device of master database and standby database |
CN104866394A (en) * | 2015-06-08 | 2015-08-26 | 肖选文 | Distributed file backup method and system |
CN103440197B (en) * | 2013-08-25 | 2016-04-13 | 浙江大学 | A kind of method automatically generating difference test report based on contrast test |
-
2016
- 2016-06-12 CN CN201610407746.3A patent/CN106055692A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8176018B1 (en) * | 2008-04-30 | 2012-05-08 | Netapp, Inc. | Incremental file system differencing |
CN101673307A (en) * | 2009-10-21 | 2010-03-17 | 中国农业大学 | Space data index method and system |
CN103729342A (en) * | 2012-10-12 | 2014-04-16 | ***股份有限公司 | File comparison method and device |
CN103136354A (en) * | 2013-03-04 | 2013-06-05 | 浪潮电子信息产业股份有限公司 | Linux system folder comparison method |
CN104111937A (en) * | 2013-04-18 | 2014-10-22 | 中兴通讯股份有限公司 | Master database standby database and data consistency testing and repairing method and device of master database and standby database |
CN103440197B (en) * | 2013-08-25 | 2016-04-13 | 浙江大学 | A kind of method automatically generating difference test report based on contrast test |
CN104866394A (en) * | 2015-06-08 | 2015-08-26 | 肖选文 | Distributed file backup method and system |
Non-Patent Citations (1)
Title |
---|
鲍爱华等: "基于哈希树的分布式目录同步方法", 《解放军理工大学学报(自然科学版)》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107194255A (en) * | 2017-06-08 | 2017-09-22 | 郑州云海信息技术有限公司 | A kind of file safety management method and device |
CN107391663A (en) * | 2017-07-19 | 2017-11-24 | 郑州云海信息技术有限公司 | A kind of file MD5 value automatic batch calibration equipments and method |
WO2020124289A1 (en) * | 2018-12-16 | 2020-06-25 | 吉安市井冈山开发区金庐陵经济发展有限公司 | Information comparison method and device |
CN110083615A (en) * | 2019-04-12 | 2019-08-02 | 平安普惠企业管理有限公司 | A kind of data verification method, device, electronic equipment and storage medium |
WO2020207008A1 (en) * | 2019-04-12 | 2020-10-15 | 平安普惠企业管理有限公司 | Data verification method, apparatus, electronic device and storage medium |
CN110489701A (en) * | 2019-08-19 | 2019-11-22 | 安徽三实信息技术服务有限公司 | Extract the method, apparatus and CMS recognition methods of CMS identification feature |
WO2024000497A1 (en) * | 2022-06-30 | 2024-01-04 | 西门子(中国)有限公司 | Security detection method and apparatus for memory, and computer device |
CN117422281A (en) * | 2023-12-18 | 2024-01-19 | 深圳赛桥生物创新技术有限公司 | Process file testing method and device, computer equipment and storage medium |
CN117422281B (en) * | 2023-12-18 | 2024-03-22 | 深圳赛桥生物创新技术有限公司 | Process file testing method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106055692A (en) | Automatic testing method and system for comparison files or folders | |
US10210076B2 (en) | White box testing | |
US20160266896A1 (en) | Smart source code review system | |
CN104899016B (en) | Allocating stack Relation acquisition method and device | |
US20170262358A1 (en) | Determining test case efficiency | |
CN105718354A (en) | Fault information reproducing method and device | |
CN107526676B (en) | Cross-system test method and device | |
US20180210949A1 (en) | Compiling extract, transform, and load job test data cases | |
US10528688B1 (en) | System and method for schematic-driven generation of input/output models | |
CN106550038B (en) | Data configuration diagnosis system and method of digital control system | |
CN104899136A (en) | Method and device used for generating test case | |
CN106445951A (en) | File transmission method and apparatus | |
US20180081791A1 (en) | Plugin for multi-module code coverage in web applications | |
CN104572072A (en) | MVC (model view controller) mode-based language transformation method and equipment for program | |
CN113127361B (en) | Application development method and device, electronic equipment and storage medium | |
CN109799985A (en) | Front-end code generation method and device, storage medium and electronic equipment | |
CN111666201A (en) | Regression testing method, device, medium and electronic equipment | |
CN109101431A (en) | A kind of testing case management, computer readable storage medium and terminal device | |
US10025697B2 (en) | Generation of automated unit tests for a controller layer system and method | |
CN107368330A (en) | Client patch restorative procedure, device and system | |
CN104408178A (en) | Device and method for WEB control loading | |
CN106844219A (en) | Using detection method and apply detection means | |
US20160217172A1 (en) | Tracking model element changes using change logs | |
CN112463596B (en) | Test case data processing method, device and equipment and processing equipment | |
CN107678965A (en) | It is automatically integrating method of testing and system, service terminal, memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
AD01 | Patent right deemed abandoned |
Effective date of abandoning: 20200124 |
|
AD01 | Patent right deemed abandoned |