Disclosure of Invention
The invention mainly aims to provide a document testing method which aims to solve the technical problems of low reliability and low testing efficiency through manual verification so as to improve the reliability and the testing efficiency of document testing.
In order to achieve the above purpose, the present invention provides a document testing method, comprising the steps of:
acquiring a document test case;
analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information;
comparing the first display information with the second display information according to a first preset rule;
and writing the comparison result of the first display information and the second display information into a test report.
Preferably, the first display information comprises a first parameter name list, a first URL and a document template stored in a sub-target position, and the second display information comprises a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page;
The step of comparing the first display information with the second display information according to a first preset rule comprises the following steps:
comparing the first parameter name list with the second parameter name list;
when the first parameter name list and the second parameter name list are not matched, judging that the first display information and the second display information are not matched;
when the first parameter name list and the second parameter name list are consistent, comparing the first URL with the second URL;
when the first URL and the second URL are not matched, judging that the first display information and the second display information are not matched;
when the first URL and the second URL are consistent, filling the document template according to the second parameter name list and a second parameter value corresponding to a second parameter name to obtain a document file;
comparing the document file with the document page;
when the document file and the document page are inconsistent, judging that the first display information and the second display information are inconsistent;
and when the document file and the document page are consistent, judging that the first display information and the second display information are consistent.
Preferably, the step of analyzing the document test case to obtain test case data of the document test case from a first target location and obtaining document scene data of the document test case from a second target location includes:
Acquiring a document version number and a document template number from a test case library according to the document test case;
according to the document version number, a first parameter name list and a first URL of the document test case are obtained;
acquiring the document template from a sub-target position according to the document template number;
and acquiring a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page from a product database according to the document test case.
Preferably, the document scene data further comprises first interaction information and document identification information;
after the step of comparing the first display information and the second display information according to the first preset rule, the document testing method further includes the steps of:
when the first display information and the second display information are consistent, acquiring the document image data of the document test case from a third target position according to the document identification information, wherein the document image data comprises second interaction information;
comparing the first interaction information with the second interaction information according to a second preset rule;
and writing the comparison result of the first interaction information and the second interaction information into the test report.
Preferably, the document image data further comprises document text;
after the step of obtaining the document image data of the document test case from the third target position according to the document identification information, the method further comprises the following steps:
comparing the document text with the first display information according to a third preset rule or comparing the document text with the second display information according to a fourth preset rule;
and writing the comparison result of the document text and the first display information or the comparison result of the document text and the second display information into the test report.
Preferably, the first interaction information includes first signature information, and the second interaction information includes second signature information; or alternatively, the first and second heat exchangers may be,
the first interaction information includes first biometric information and the second interaction information includes second biometric information.
Preferably, after the step of writing the comparison result of the first presentation information and the second presentation information into a test report, the document test method further includes the steps of:
acquiring a first test coverage rate of all the document test cases in the first target position and a second test coverage rate of all the document test cases in the second target position;
Comparing the first test coverage rate with a first preset coverage rate, and the second test coverage rate with a second preset coverage rate;
when the first test coverage rate is greater than or equal to the first preset coverage rate and the second test coverage rate is greater than or equal to the second preset coverage rate, writing the first test coverage rate and the second test coverage rate into the test report;
and generating a prompt signal when the first test coverage rate is smaller than the first preset coverage rate or the second test coverage rate is smaller than the second preset coverage rate.
In order to achieve the above object, the present invention also proposes a document testing apparatus including: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, performing the steps of a document testing method comprising the steps of: acquiring a document test case; analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information; comparing the first display information with the second display information according to a first preset rule; and writing the comparison result of the first display information and the second display information into a test report.
In order to achieve the above purpose, the invention also provides a document testing device, which comprises an acquisition module, an analysis module, a comparison module and a reporting module, wherein the acquisition module is used for acquiring a document test case; the analysis module is used for analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information; the comparison module is used for comparing the first display information with the second display information according to a first preset rule; the report module is used for writing the comparison result of the first display information and the second display information into a test report.
In order to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a document test program which, when executed by a processor, implements the steps of a document test method, the document test method comprising the steps of: acquiring a document test case; analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information; comparing the first display information with the second display information according to a first preset rule; and writing the comparison result of the first display information and the second display information into a test report.
In the technical scheme of the invention, the document testing method comprises the following steps: acquiring a document test case; analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information; comparing the first display information with the second display information according to a first preset rule; and writing the comparison result of the first display information and the second display information into a test report. The test case data obtained from the first target position and the document scene data obtained from the second target position correspond to the document content arranged in the system and the document content displayed by the system respectively, whether the document content arranged in the system and the document content displayed by the system are consistent or not is verified by comparing the first display information included in the test case data and the second display information included in the document scene data, and a test report is generated so that a tester can maintain the document according to the result of the test report. In the scheme, the automatic test of the documents is realized without verifying the content of the documents in a manual comparison mode, the great improvement of the test coverage rate can be easily realized, and the test accuracy is high, so that the reliability of the test is improved; and the automatic test has a quick test rate, so that the test efficiency of documents is improved.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The main solutions of the embodiments of the present invention are: and analyzing the document test case to obtain first display information corresponding to the document content arranged in the system and second display information corresponding to the document content displayed by the system, and comparing the first display information with the second display information to realize automatic test of the document.
Because the prior art mainly relies on manual verification of document content, the test reliability is poor, and the test efficiency is low.
The invention provides a solution, which obtains the first display information corresponding to the document content arranged in the system and the second display information corresponding to the document content displayed by the system by analyzing the document test case, and realizes the automatic test of the document by comparing the first display information and the second display information, thereby being beneficial to improving the coverage rate and the accuracy rate of the document test and improving the test reliability and the test efficiency.
The first embodiment of the present invention provides a document testing method, as shown in fig. 1, including the following steps:
step S100, acquiring a document test case;
documents refer to content that needs to be displayed to the user during system operation to inform the user of related matters or to wait for confirmation by the user, and specifically include privacy terms, product descriptions, responsibility notices, service agreements, and the like. In order to ensure that the document content displayed to the user is consistent with the document content built in the system, the document needs to be tested. The document test cases are used in document testing, and may be from a test case library or other corresponding locations. Documents may include presentation information and interaction information, among other things. The display information is only for the user to view, and does not relate to the modification operation of the user, the modified storage operation and the like. The presentation information may further include fixed information and parameter information, where the fixed information is information consistent in all the same kind of documents, such as specific privacy terms, etc., and the parameter information is information that varies according to factors such as users, such as user names, etc. The interactive information refers to information generated in the process of interaction between the user and the system, so as to receive feedback results of the user, and generally comprises user confirmation information and the like. The interaction information generally relates to a modification operation of the user, a modified save operation, and the like. According to the content included in the document, the document can be divided into a display document including only display information and no interactive information, and an image document including both display information and interactive information.
Step 200, analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information;
the document test case comprises the related information of the document, only the identification information or the pointing information of the document can be given in order to reduce the occupation of resources, then the identification information or the pointing information of the document is obtained by analyzing the document test case, and other information of the document is obtained at the corresponding target position according to the identification information or the pointing information. Specifically, test case data of the document test case is obtained from a first target position, and document scene data of the document test case is obtained from a second target position. The first target position can be a test case library, and the test case data comprises first display information corresponding to document content arranged in the system; the second target location may be a product database, and the document scene data includes second presentation information corresponding to document content displayed by the system. The test case data in the first target location may be manually entered by a tester or automatically entered by an entry program at a stage prior to automatic testing of the documents; while the document scene data in the second target location may be saved prior to automatic testing of the document.
Step S300, comparing the first display information with the second display information according to a first preset rule;
and checking the display information of the document by comparing the first display information with the second display information. In order to facilitate comparison, corresponding items in the first display information and the second display information can be split and compared one by one. Meanwhile, in the case of limited test resources, the items may be compared in a certain order, for example, in order of first-time and last-time. Thus, when the previous item does not match, the first display information and the second display information are determined to be not matching, and comparison of all items is not required, which will be described in detail later.
Step S400, writing the comparison result of the first display information and the second display information into a test report.
And writing the comparison result of the first display information and the second display information into a test report so that a tester can maintain the document according to the test report. Specifically, the comparison results of the entries can be written into the test report completely so as to reflect the test results comprehensively and facilitate the testers to find the root cause of the problem. Or when the first display information and the second display information completely coincide, writing the total result in the test report; when the first display information and the second display information are inconsistent, specific items and total results of the inconsistencies are written into the test report so as to balance the size of the test report and the convenience of the tester for finding problems. Of course, in order to further reduce the size of the test report, only the total result of the test may be written, and the problematic documents may be further tested and maintained by the tester. The system can output the test report according to the output instruction given by the tester, wherein the output instruction can comprise the specific content, the output format and the like of the test report required to be output, so that the display effect of the test report is optimized, and the checking efficiency of the tester is improved.
In this embodiment, the document testing method includes the steps of: acquiring a document test case; analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information; comparing the first display information with the second display information according to a first preset rule; and writing the comparison result of the first display information and the second display information into a test report. The test case data obtained from the first target position and the document scene data obtained from the second target position correspond to the document content arranged in the system and the document content displayed by the system respectively, whether the document content arranged in the system and the document content displayed by the system are consistent or not is verified by comparing the first display information included in the test case data and the second display information included in the document scene data, and a test report is generated so that a tester can maintain the document. In the scheme, the automatic test of the documents is realized without verifying the content of the documents in a manual comparison mode, the great improvement of the test coverage rate can be easily realized, and the test accuracy is high, so that the reliability of the test is improved; and the automatic test has a quick test rate, so that the test efficiency of documents is improved.
Based on the first embodiment, in a second embodiment of the present invention, the first presentation information includes a first parameter name list, a first URL (Uniform Resource Locator, URL), a document template stored in the sub-target location, and the second presentation information includes a second parameter name list, a second parameter value corresponding to the second parameter name, the second URL, and a document page;
as shown in fig. 2, step S300 includes:
step S310, comparing the first parameter name list with the second parameter name list;
step S321, when the first parameter name list and the second parameter name list are not matched, judging that the first display information and the second display information are not matched;
step S322, when the first parameter name list and the second parameter name list are consistent, comparing the first URL and the second URL;
step S331, when the first URL and the second URL are not matched, judging that the first display information and the second display information are not matched;
step S332, when the first URL and the second URL are consistent, filling the document template according to the second parameter name list and the second parameter value corresponding to the second parameter name to obtain a document file;
step S340, comparing the document file with the document page;
step S351, when the document file and the document page are inconsistent, judging that the first display information and the second display information are inconsistent;
And step S352, when the document file and the document page are consistent, judging that the first display information and the second display information are consistent.
The parameter list lists names of all the related parameters in the documents, such as a user number uniquely corresponding to the user identity, a document number corresponding to the document one by one, a document version number used for identifying document version information, a document parameter name and a document parameter value (including a document parameter name such as a name and a bank card number displayed on the document, and specific document parameter values such as Li San and 123456789), a number of a user signature image stored in the image platform, that is, a signature picture number of the image platform, a user signature picture displayed at the front end of the system, that is, a signature picture, seal positioning information used in a document synthesizing process, a bar code used for identifying the document, a document template number used for identifying document template information, a document number after synthesis used for identifying a document URL of document position information, a time stamp when the document is called, a creation time when creating document scene data, and the like. The first URL belongs to one of the pointing information of the document in order to call the document. Meanwhile, considering that a plurality of platforms can be further included in the system, the same document templates can be stored in each platform, therefore, in the process of testing documents, all the document templates in each platform need to be verified, when the document templates are filled to obtain document files, the document templates in each platform are filled to obtain a plurality of document files in fact, and when the content of the document files is verified, the document files and the document pages need to be compared to determine whether the content is consistent. In this embodiment, the first parameter name list and the second parameter name list are compared first, then the first URL and the second URL are compared, and finally the content of the document file and the content of the document page are compared, and the comparison of the first display information and the second display information is realized in an order from easy to difficult, so as to improve the test efficiency as much as possible. When the previous comparison result is not consistent, the first display information and the second display information can be determined to be inconsistent, and the subsequent comparison can be omitted; only when the previous comparison results are consistent, i.e. the previous comparison passes, the next comparison is performed.
Based on the above-mentioned second embodiment, as shown in fig. 3, in a third embodiment of the present invention, the step of parsing the document test case to obtain test case data of the document test case from a first target location and obtaining document scene data of the document test case from a second target location includes:
step S210, acquiring a document version number and a document template number from a test case library according to the document test case;
step S220, a first parameter name list and a first URL of the document test case are obtained according to the document version number;
step S230, acquiring a document template from the sub-target position according to the document template number;
step S240, according to the document test case, a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page are obtained from the product database.
In order to reduce the storage resources required in the test process, other information of the document test case can be obtained through the pointing information provided by the document version number, the document template number and the like. Specifically, a first parameter name list and a first URL of a document test case are obtained according to a document version number; and acquiring the document template from the sub-target position according to the document template number so as to acquire first display information built in the system. The second display information displayed by the system can be obtained from the product database according to the document test case, and specifically comprises a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page.
Based on the above embodiments, as shown in fig. 4, in a fourth embodiment of the present invention, the document scene data further includes first interaction information and document identification information;
after step S300, the document testing method further includes the steps of:
step S500, when the first display information and the second display information are consistent, acquiring document image data of the document test case from a third target position according to the document identification information, wherein the document image data comprises second interaction information;
step S600, comparing the first interaction information with the second interaction information according to a second preset rule;
and step S700, writing the comparison result of the first interaction information and the second interaction information into a test report.
In this embodiment, the document including the interaction information is an image document. When testing the image document, not only the display information but also the interactive information need to be compared. The interaction information specifically comprises first interaction information given by a user in real time, and the first interaction information is usually included in document scene data, and also comprises second interaction information pre-stored in the system, and the second interaction information is usually stored in document image data and is usually collected when the user registers a system account for the first time. When the first interaction information is consistent with the second interaction information, the system is indicated to have normal functions of collecting, verifying and the like of the interaction information; otherwise, when the first interaction information and the second interaction information are inconsistent, the system may have problems in collecting, verifying and the like the interaction information, and maintenance is required for the tester. The verification of the interactive information in the image document is generally performed after the verification of the display information is passed, and when the first display information and the second display information are consistent, document image data of the document test case is obtained from a third target position according to the document identification information. The document identification information may be a document number corresponding to the document one by one, a barcode of the document, or the like, and the third target location is typically an image database. And verifying the interaction information in the image document by comparing the first interaction information with the second interaction information, and writing the comparison result into a test report so as to facilitate maintenance of a tester.
Based on the fourth embodiment, as shown in fig. 5, in a fifth embodiment of the present invention, the document image data further includes document text;
after the step of obtaining the document image data of the document test case from the third target position according to the document identification information, the method further comprises the following steps:
step S810, comparing the document text with the first display information according to a third preset rule or comparing the document text with the second display information according to a fourth preset rule;
and step S820, writing the comparison result of the document text and the first display information or the comparison result of the document text and the second display information into a test report.
The document image data of the third target position may further include document text, where the content of the document text should be consistent with the content of the document file synthesized by the document template or the content of the document page under normal conditions. In this embodiment, the first display information or the second display information is verified according to the document text in the document image data, and the corresponding comparison result is written into the test report, so that the reliability of the document test is further improved. The third preset rule or the fourth preset rule may be consistent with the first preset rule, and of course, the third preset rule or the fourth preset rule adapted to design may also be designed according to characteristics of the document text, for example, the document text in the document image data is usually in a picture format instead of a text format.
Based on the first to fifth embodiments described above, in a sixth embodiment of the present invention, the first interaction information includes first signature information, and the second interaction information includes second signature information.
In this embodiment, the interaction information is specifically signature information, which may be an electronic signature of the user or an electronic seal. And when the first interaction information and the second interaction information are checked, performing picture identification comparison on the first signature information provided by the user and the second signature information pre-stored in the document image data, so as to obtain a checking result.
Based on the first to fifth embodiments described above, in a seventh embodiment of the present invention, the first interaction information includes first biometric information, and the second interaction information includes second biometric information.
In this embodiment, the interaction information is specifically biometric information, and the biometric information tends to have better specificity and security than the signature information in the previous embodiment. With the development of biometric identification technology, more and more systems use biometric information to complete user interaction with the system. The biometric information may specifically include fingerprint information, face information, iris information, voiceprint information, and the like.
Based on the above embodiments, as shown in fig. 6, in an eighth embodiment of the present invention, after step S400, the document testing method further includes the steps of:
step S910, obtaining a first test coverage rate of all the document test cases in a first target position and a second test coverage rate of all the document test cases in a second target position;
step S920, comparing the first test coverage with a first preset coverage, and comparing the second test coverage with a second preset coverage;
step S931, when the first test coverage is greater than or equal to the first preset coverage and the second test coverage is greater than or equal to the second preset coverage, writing the first test coverage and the second test coverage into a test report;
step S932, generating a prompt signal when the first test coverage is smaller than a first preset coverage or the second test coverage is smaller than a second preset coverage.
In the prior art, only very low test coverage rate is often supported by manual test documents, resulting in reduced test reliability. In this embodiment, the test coverage rate can be greatly improved by the automatic test. In order to facilitate the test coverage monitoring of a tester, the first test coverage is obtained by calculating the ratio of the number of the document test cases in the first target position and the total number of the document test cases in the first target position, which are involved in the test process, and the second test coverage is obtained by calculating the ratio of the number of the second document test cases which are involved in the second target position and the total number of the document test cases in the second target position. Further, comparing the first test coverage rate with a first preset coverage rate, and writing the first test coverage rate and the second test coverage rate into a test report, wherein the first preset coverage rate and the second preset coverage rate can be set by a tester, and the tester can conveniently check when the test report is output later only when the first test coverage rate reaches above the first preset coverage rate and the second test coverage rate reaches above the second preset coverage rate; otherwise, the coverage area of the test is insufficient, and a prompt signal is generated to remind the test personnel to carry out maintenance.
As shown in fig. 7, fig. 7 is a schematic structural diagram of a terminal, that is, a document testing device, of a hardware running environment according to an embodiment of the present invention.
The terminal of the embodiment of the invention can be a server, a PC, a mobile terminal device with a display function such as a smart phone, a tablet personal computer, an electronic book reader, an MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert compression standard audio layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert compression standard audio layer 3) player, a portable computer and the like.
As shown in fig. 7, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and so on. Among other sensors, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that may turn off the display screen and/or the backlight when the mobile terminal moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and the direction when the mobile terminal is stationary, and the mobile terminal can be used for recognizing the gesture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; of course, the mobile terminal may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, which are not described herein.
It will be appreciated by those skilled in the art that the terminal structure shown in fig. 7 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 7, an operating system, a network communication module, a user interface module, and a document test program may be included in a memory 1005, which is a type of computer storage medium.
In the terminal shown in fig. 7, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call a document test program stored in the memory 1005 and perform the following operations:
acquiring a document test case;
analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information;
comparing the first display information with the second display information according to a first preset rule;
and writing the comparison result of the first display information and the second display information into a test report.
Further, the processor 1001 may be configured to invoke the document test program stored in the memory 1005, where the first presentation information includes a first parameter name list, a first URL, and a document template stored in the sub-target location, and the second presentation information includes a second parameter name list, a second parameter value corresponding to the second parameter name, the second URL, and a document page;
The operation of comparing the first display information and the second display information according to the first preset rule comprises the following steps:
comparing the first parameter name list with the second parameter name list;
when the first parameter name list and the second parameter name list are not consistent, judging that the first display information and the second display information are not consistent;
when the first parameter name list and the second parameter name list are consistent, comparing the first URL with the second URL;
when the first URL and the second URL are not matched, judging that the first display information and the second display information are not matched;
when the first URL and the second URL are consistent, filling the document template according to the second parameter name list and the second parameter value corresponding to the second parameter name to obtain a document file;
comparing the document file with the document page;
when the document file and the document page are inconsistent, judging that the first display information and the second display information are inconsistent;
and when the document file and the document page are consistent, judging that the first display information and the second display information are consistent.
Further, the processor 1001 may be configured to call a document test program stored in the memory 1005, parse the document test case to obtain test case data of the document test case from a first target location, and obtain document scene data of the document test case from a second target location, where the operations include:
Acquiring a document version number and a document template number from a test case library according to the document test case;
according to the document version number, a first parameter name list and a first URL of the document test case are obtained;
acquiring a document template from the sub-target position according to the document template number;
and according to the document test case, acquiring a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page from the product database.
Further, the processor 1001 may be configured to invoke the document test program stored in the memory 1005, where the document scene data further includes first interaction information and document identification information;
after the operation of comparing the first display information and the second display information according to the first preset rule, the following operations are further performed:
when the first display information and the second display information are consistent, acquiring document image data of the document test case from a third target position according to the document identification information, wherein the document image data comprises second interaction information;
comparing the first interaction information with the second interaction information according to a second preset rule;
and writing the comparison result of the first interaction information and the second interaction information into a test report.
Further, the processor 1001 may be configured to call a document test program stored in the memory 1005, where the document image data further includes document text;
after the operation of obtaining the document image data of the document test case from the third target position according to the document identification information, the following operations are also performed:
comparing the document text with the first display information according to a third preset rule or comparing the document text with the second display information according to a fourth preset rule;
and writing the comparison result of the document text and the first display information or the comparison result of the document text and the second display information into a test report.
Further, the processor 1001 may be configured to invoke the document test program stored in the memory 1005, where the first interaction information includes first signature information, and the second interaction information includes second signature information; or alternatively, the first and second heat exchangers may be,
the first interaction information includes first biometric information and the second interaction information includes second biometric information.
Further, the processor 1001 may be configured to invoke the document test program stored in the memory 1005, and after writing the comparison result of the first presentation information and the second presentation information into the test report, further perform the following operations:
Acquiring a first test coverage rate of all the document test cases in a first target position and a second test coverage rate of all the document test cases in a second target position;
comparing the first test coverage with a first preset coverage, and comparing the second test coverage with a second preset coverage;
when the first test coverage rate is greater than or equal to the first preset coverage rate and the second test coverage rate is greater than or equal to the second preset coverage rate, writing the first test coverage rate and the second test coverage rate into a test report;
and generating a prompt signal when the first test coverage rate is smaller than the first preset coverage rate or the second test coverage rate is smaller than the second preset coverage rate.
In addition, the embodiment of the invention also provides a document testing device, which comprises:
the acquisition module is used for acquiring the document test cases;
the analysis module is used for analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information;
The comparison module is used for comparing the first display information with the second display information according to a first preset rule;
and the reporting module is used for writing the comparison result of the first display information and the second display information into the test report.
Further, the first display information comprises a first parameter name list, a first URL and a document template stored in a sub-target position, and the second display information comprises a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page;
the comparison module comprises:
the parameter name comparison unit is used for comparing the first parameter name list with the second parameter name list;
a determination unit configured to determine that the first presentation information and the second presentation information do not coincide when the first parameter name list and the second parameter name list do not coincide;
the locator comparison unit is used for comparing the first URL with the second URL when the first parameter name list and the second parameter name list are consistent;
the judging unit is further used for judging that the first display information and the second display information are not consistent when the first URL and the second URL are not consistent;
the filling unit is used for filling the document template according to the second parameter name list and the second parameter value corresponding to the second parameter name when the first URL and the second URL are consistent to obtain a document file;
The content comparison unit is used for comparing the document file and the document page;
the judging unit is also used for judging that the first display information and the second display information are inconsistent when the document file and the document page are inconsistent;
the judging unit is also used for judging that the first display information is consistent with the second display information when the document file is consistent with the document page.
Further, the parsing module includes:
the test case library unit is used for acquiring a document version number and a document template number from the test case library according to the document test case;
the parameter name and locator acquisition unit is used for acquiring a first parameter name list and a first URL of the document test case according to the document version number;
the template acquisition unit is used for acquiring the document template from the sub-target position according to the document template number;
and the product database unit is used for acquiring a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page from the product database according to the document test case.
Further, the document scene data further comprises first interaction information and document identification information;
the document testing device further includes:
the image module is used for obtaining the document image data of the document test case from the third target position according to the document identification information when the first display information is consistent with the second display information, wherein the document image data comprises second interaction information;
The comparison module is also used for comparing the first interaction information with the second interaction information according to a second preset rule;
the report module is also used for writing the comparison result of the first interaction information and the second interaction information into the test report.
Further, the document image data also comprises document text;
the comparison module is also used for comparing the document text with the first display information according to a third preset rule or comparing the document text with the second display information according to a fourth preset rule;
the report module is also used for writing the comparison result of the document text and the first display information or the comparison result of the document text and the second display information into the test report.
Further, the first interaction information comprises first signature information, and the second interaction information comprises second signature information; or alternatively, the first and second heat exchangers may be,
the first interaction information includes first biometric information and the second interaction information includes second biometric information.
Further, the document testing device further includes:
the coverage rate module is used for acquiring a first test coverage rate of all the document test cases in the first target position and a second test coverage rate of all the document test cases in the second target position;
the comparison module is also used for comparing the first test coverage rate with a first preset coverage rate, and comparing the second test coverage rate with a second preset coverage rate;
The report module is further configured to write the first test coverage rate and the second test coverage rate into a test report when the first test coverage rate is greater than or equal to a first preset coverage rate and the second test coverage rate is greater than or equal to a second preset coverage rate;
the prompting module is used for generating a prompting signal when the first test coverage rate is smaller than the first preset coverage rate or the second test coverage rate is smaller than the second preset coverage rate.
In addition, the embodiment of the invention also provides a computer readable storage medium, and the computer readable storage medium stores a document test program which realizes the following operations when being executed by a processor:
acquiring a document test case;
analyzing the document test case to obtain test case data of the document test case from a first target position and document scene data of the document test case from a second target position, wherein the test case data comprises first display information and the document scene data comprises second display information;
comparing the first display information with the second display information according to a first preset rule;
and writing the comparison result of the first display information and the second display information into a test report.
Further, when the document test program is executed by the processor, the first display information comprises a first parameter name list, a first URL and a document template stored in a sub-target position, and the second display information comprises a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page;
The operation of comparing the first display information and the second display information according to the first preset rule comprises the following steps:
comparing the first parameter name list with the second parameter name list;
when the first parameter name list and the second parameter name list are not consistent, judging that the first display information and the second display information are not consistent;
when the first parameter name list and the second parameter name list are consistent, comparing the first URL with the second URL;
when the first URL and the second URL are not matched, judging that the first display information and the second display information are not matched;
when the first URL and the second URL are consistent, filling the document template according to the second parameter name list and the second parameter value corresponding to the second parameter name to obtain a document file;
comparing the document file with the document page;
when the document file and the document page are inconsistent, judging that the first display information and the second display information are inconsistent;
and when the document file and the document page are consistent, judging that the first display information and the second display information are consistent.
Further, when the document test program is executed by the processor, analyzing the document test case to obtain test case data of the document test case from the first target position, and obtaining document scene data of the document test case from the second target position includes:
Acquiring a document version number and a document template number from a test case library according to the document test case;
according to the document version number, a first parameter name list and a first URL of the document test case are obtained;
acquiring a document template from the sub-target position according to the document template number;
and according to the document test case, acquiring a second parameter name list, a second parameter value corresponding to the second parameter name, a second URL and a document page from the product database.
Further, when the document testing program is executed by the processor, the document scene data further comprises first interaction information and document identification information;
after the operation of comparing the first display information and the second display information according to the first preset rule, the following operations are further performed:
when the first display information and the second display information are consistent, acquiring document image data of the document test case from a third target position according to the document identification information, wherein the document image data comprises second interaction information;
comparing the first interaction information with the second interaction information according to a second preset rule;
and writing the comparison result of the first interaction information and the second interaction information into a test report.
Further, the document image data also comprises document text;
After the operation of obtaining the document image data of the document test case from the third target position according to the document identification information, the following operations are also performed:
comparing the document text with the first display information according to a third preset rule or comparing the document text with the second display information according to a fourth preset rule;
and writing the comparison result of the document text and the first display information or the comparison result of the document text and the second display information into a test report.
Further, the first interaction information comprises first signature information, and the second interaction information comprises second signature information; or alternatively, the first and second heat exchangers may be,
the first interaction information includes first biometric information and the second interaction information includes second biometric information.
Further, when the document test program is executed by the processor, after the operation of writing the comparison result of the first presentation information and the second presentation information into the test report, the following operations are also executed:
acquiring a first test coverage rate of all the document test cases in a first target position and a second test coverage rate of all the document test cases in a second target position;
comparing the first test coverage with a first preset coverage, and comparing the second test coverage with a second preset coverage;
When the first test coverage rate is greater than or equal to the first preset coverage rate and the second test coverage rate is greater than or equal to the second preset coverage rate, writing the first test coverage rate and the second test coverage rate into a test report;
and generating a prompt signal when the first test coverage rate is smaller than the first preset coverage rate or the second test coverage rate is smaller than the second preset coverage rate.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.