CN107885648B - Method and device for generating test report - Google Patents
Method and device for generating test report Download PDFInfo
- Publication number
- CN107885648B CN107885648B CN201610861294.6A CN201610861294A CN107885648B CN 107885648 B CN107885648 B CN 107885648B CN 201610861294 A CN201610861294 A CN 201610861294A CN 107885648 B CN107885648 B CN 107885648B
- Authority
- CN
- China
- Prior art keywords
- test
- log information
- content
- format
- report
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides a method and a device for generating a test report, which can generate test reports of different levels meeting different test scenes; meanwhile, the test report can contain various test process screenshots, display videos, characters, hyperlinks and other visual elements, and testers can browse all key test processes through the test report, so that the testers can quickly locate problems. The method comprises the steps of storing the log information types required to be recorded in different test levels of each test scene; receiving test parameters of a current test case in a set test scene; during testing, analyzing the test parameters to determine the test level of the current test case, and then determining the log information type of the current test case to be recorded in the current test scene according to the test level of the test case; and generating a test report of the current test case according to the determined log information type.
Description
Technical Field
The invention relates to the technical field of computers and software thereof, in particular to a method and a device for generating a test report.
Background
With the continuous maturity of the software industry, the requirements of people on the software quality are continuously improved. For the software testing part, it becomes increasingly important how both the software testing requirements can be covered and the human resources and capital costs saved. Many companies have attempted to use automated testing instead of manual testing, which allows the tester to focus on new functions, saving time and improving testing efficiency. While the trend of automated testing is, how to better display the automated testing results is concerned by more testers. The automatic test report is used for testing results, and in order to save time, most tests are carried out in non-working time, so that a tester basically checks the test process and the test results through the test report, and therefore the detail degree of the test report is very important.
The conventional automated testing tools in the market also have simple test report plug-ins, such as selenium, QTP, Jmeter, etc. Still other test tools may customize test reports on their own, such as junit, TestNG, which is the most common automated test report tool used. TestNG is a testing framework in Java, similar to juit and NUnit, but more powerful. The TestNG can rerun the failed test case, so that the definition of the test script can be greatly improved, and the test result can be free from much interference; in addition, parameterization can be realized through the annotations, different Test cases do not need to be written to cover different parameters, three levels of grouping tests are supported simultaneously, namely TestSuite, Test and Test Method, and the annotations are combined, so that the Test cases are more flexibly realized. The TestNG can generate different types of test execution reports, the reports mainly comprise HTML and XML report output, reports sent by e-mails of the TestNG, and the TestNG also allows users to write own reports, so that the testers can freely customize the reports more conveniently, but the users need to write custom classes to realize the test execution reports.
From the test report plug-ins carried by a plurality of existing automatic test tools, a user-defined test report cannot be generated, and the test report is too simple and is inconvenient for testers to quickly position; although TestNG allows a user to customize a report, the user is required to write related classes, test reports only contain the number of successful and failed tests, the records of test processes and failure reasons are less, the content and type of the test reports are too single, and when an automatic test case is designed, the executed test case and the corresponding output content are fixed and are not available, the test case is not flexible to use for different project requirements, and the test effect is finally influenced.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for generating a test report, which can output test reports of different levels meeting different test scenarios through configuration during a test case; meanwhile, the test report of the technical scheme of the invention can contain various visual elements such as test process screenshots, display videos, characters, hyperlinks and the like, and testers can browse all key test processes through the test report, so that the testers can quickly locate problems and the test effect is improved.
To achieve the above object, according to one aspect of the present invention, there is provided a method of generating a test report.
The method for generating the test report comprises the following steps: saving the log information types required to be recorded in different test levels of each test scene; receiving test parameters of a current test case in a set test scene; during testing, analyzing the test parameters to determine the test level of the current test case, and then determining the log information type of the current test case to be recorded in the current test scene according to the test level of the test case; and generating a test report of the current test case according to the determined log information type.
Optionally, the step of generating a test report of the current test case according to the determined log information type includes: acquiring log information corresponding to the log information type according to the log information type required to be recorded by the test case; determining a format of content in the log information; and determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case.
Optionally, the format of the content in the log information includes one or more of the following: text, bytecode, input stream, and screenshots (i.e., screen shots of the test process); and determining a writing mode of the content corresponding to the format according to the format, and then writing the content in the log information into the test report according to the corresponding writing mode, wherein the step comprises the following steps: when the format of the content in the log information is a text, directly writing the text into the test report; when the format of the content in the log information is byte code, firstly storing the byte code into a local file, and then writing the link address of the local file into a test report; when the format of the content in the log information is an input stream, firstly storing the input stream into a local file, and then writing the link address of the local file into a test report; when the content in the log information is in the form of a screenshot, the screenshot is stored locally, and then the HTML img label of the locally stored screenshot is written into the test report.
According to another aspect of the present invention, an apparatus for generating a test report is provided.
The device for generating the test report comprises: the storage module is used for storing the log information types required to be recorded in different test levels of each test scene; the receiving module is used for receiving the test parameters of the current test case in a set test scene; the analysis module is used for analyzing the test parameters to determine the test level of the current test case during testing, and then determining the log information type required to be recorded by the current test case in the current test scene according to the test level of the test case; and the generating module is used for generating a test report of the current test case according to the determined log information type.
Optionally, the generating module is further configured to: acquiring log information corresponding to the log information type according to the log information type required to be recorded by the test case; determining a format of content in the log information; and determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case.
Optionally, the format of the content in the log information includes one or more of the following: text, bytecode, input stream, and screenshot; and the generating module is further configured to: when the format of the content in the log information is a text, the text is directly written into a test report, when the format of the content in the log information is a byte code, the byte code is firstly stored into a local file, then a link address of the local file is written into the test report, when the format of the content in the log information is an input stream, the input stream is firstly stored into the local file, then the link address of the local file is written into the test report, when the format of the content in the log information is a screenshot, the screenshot is firstly stored into the local, and then an MLHTimg label of the locally stored screenshot is written into the test report.
According to still another aspect of embodiments of the present invention, there is provided an electronic apparatus including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of generating a test report provided by the present invention.
According to a further aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method of generating a test report provided by the present invention.
According to the technical scheme of the invention, test reports of different levels meeting different test scenes can be output through configuration during test cases; meanwhile, the test report of the technical scheme of the invention can contain various visual elements such as test process screenshots, display videos, characters, hyperlinks and the like, and testers can browse all key test processes through the test report, so that the testers can quickly locate problems and the test effect is improved.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a method of generating a test report according to an embodiment of the invention;
fig. 2 is a schematic diagram of an apparatus for generating a test report according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of a method of generating a test report according to an embodiment of the invention. As shown in fig. 1, the method for generating a test report of the present invention mainly includes the following steps S10 to S13.
Step S10: and saving the log information types required to be recorded in different test levels of each test scene. In this step, the mentioned test scenario refers to different test procedures set by the tester to meet the test requirements; because the test points concerned by each test scenario are different, the test scenarios are divided into a plurality of test levels, and the test levels include but are not limited to: fatal, error, warning, informational, debugging, and trace levels; meanwhile, setting the types of log information to be recorded under different test levels for each test scene; the log information types include, but are not limited to: vital information, error information, warning information, debugging information, trace information, and the like.
Step S11: and receiving test parameters of the current test case in a set test scene. In this step, before testing the test case, the tester sets the test parameters of the test case in the configuration file of the test scenario according to the attention degree of the test scenario, wherein the test parameters include the test level of the test case.
Step S12: during testing, the test parameters are analyzed to determine the test level of the current test case, and then the log information type required to be recorded by the current test case in the current test scene is determined according to the test level of the test case. In the step, after the test case is tested, firstly analyzing the received test parameters set by the tester so as to determine the test level of the test case; and then determining the log information type required to be recorded by the test case in a set scene according to the test level.
Step S13: and generating a test report of the current test case according to the determined log information type. In the step, firstly, according to the log information type required to be recorded by the test case, obtaining the log information corresponding to the log information type in the test process; secondly, determining the format of the content in the log information; the format of the content in the log information includes one or more of the following: text, byte code, input stream, screenshot, etc., and may even include visual elements such as video, text, hyperlinks, etc.; finally, determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case; when the format of the content in the log information is a text, directly writing the text into the test report; when the format of the content in the log information is byte code, firstly storing the byte code into a local file, and then writing the link address of the local file into a test report; when the format of the content in the log information is an input stream, firstly storing the input stream into a local file, and then writing the link address of the local file into a test report; when the content in the log information is in the form of a screenshot, the screenshot is stored locally, and then the HTML img label of the locally stored screenshot is written into the test report.
Fig. 2 is a schematic diagram of an apparatus for generating a test report according to an embodiment of the present invention. As shown in fig. 2, the apparatus 20 for generating a test report according to the embodiment of the present invention mainly includes a storage module 21, a receiving module 22, an analysis module 23, and a generation module 24; the storage module 21 is configured to store log information types that need to be recorded in different test levels for each test scenario; the receiving module 22 is configured to receive test parameters of a current test case in a set test scenario; the analysis module 23 is configured to analyze the test parameters to determine a test level of the current test case during testing, and then determine a log information type that needs to be recorded in the current test scenario of the current test case according to the test level of the test case; the generating module 24 is configured to generate a test report of the current test case according to the determined log information type.
The generation module 24 may also be configured to: acquiring log information corresponding to the log information type according to the log information type required to be recorded by the test case; determining a format of content in the log information; and determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case.
The format of the content in the log information includes one or more of the following: text, bytecode, input stream, and screenshot; and the generation module 24 is further operable to: when the format of the content in the log information is a text, directly writing the text into the test report; when the format of the content in the log information is byte code, firstly storing the byte code into a local file, and then writing the link address of the local file into a test report; when the format of the content in the log information is an input stream, firstly storing the input stream into a local file, and then writing the link address of the local file into a test report; when the content in the log information is in the form of a screenshot, the screenshot is stored locally, and then the HTML img label of the locally stored screenshot is written into the test report.
According to the technical scheme of the embodiment of the invention, test reports of different levels meeting different test scenes can be output through configuration during test cases; meanwhile, the test report of the technical scheme of the invention can contain various visual elements such as test process screenshots, display videos, characters, hyperlinks and the like, and testers can browse all key test processes through the test report, so that the testers can quickly locate problems and the test effect is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (8)
1. A method of generating a test report, comprising:
saving the log information types required to be recorded in different test levels of each test scene; wherein the log information type includes at least one of: vital information, error information, warning information, debugging information, and trace information;
receiving test parameters of a current test case in a set test scene;
during testing, analyzing the test parameters to determine the test level of the current test case, and then determining the log information type of the current test case to be recorded in the current test scene according to the test level of the test case;
and generating a test report of the current test case according to the determined log information type.
2. The method of claim 1, wherein generating a test report for a current test case according to the determined log information type comprises:
acquiring log information corresponding to the log information type according to the log information type required to be recorded by the test case;
determining a format of content in the log information;
and determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case.
3. The method of claim 2,
the format of the content in the log information comprises one or more of the following: text, bytecode, input stream, and screenshot;
and determining a writing mode of the content corresponding to the format according to the format, and then writing the content in the log information into the test report according to the corresponding writing mode, wherein the step comprises the following steps:
when the format of the content in the log information is a text, directly writing the text into the test report;
when the format of the content in the log information is byte code, firstly storing the byte code into a local file, and then writing the link address of the local file into a test report;
when the format of the content in the log information is an input stream, firstly storing the input stream into a local file, and then writing the link address of the local file into a test report;
when the content in the log information is in the form of a screenshot, the screenshot is saved locally, and then the HTMLimg tag of the locally saved screenshot is written into the test report.
4. An apparatus for generating a test report, comprising:
the storage module is used for storing the log information types required to be recorded in different test levels of each test scene;
the receiving module is used for receiving the test parameters of the current test case in a set test scene;
the analysis module is used for analyzing the test parameters to determine the test level of the current test case during testing, and then determining the log information type required to be recorded by the current test case in the current test scene according to the test level of the test case;
and the generating module is used for generating a test report of the current test case according to the determined log information type.
5. The apparatus of claim 4, wherein the generating module is further configured to:
acquiring log information corresponding to the log information type according to the log information type required to be recorded by the test case;
determining a format of content in the log information;
and determining a writing mode of the content corresponding to the format according to the format, and writing the content in the log information into a test report according to the corresponding writing mode, thereby obtaining the test report of the test case.
6. The apparatus of claim 5, wherein the format of the content in the log information comprises one or more of the following: text, bytecode, input stream, and screenshot;
and the generating module is further configured to:
when the content in the log information is in text format, the text is directly written into the test report,
when the content in the log information is in the form of byte code, the byte code is saved in a local file, then the link address of the local file is written in the test report,
when the content in the log information is in the format of input stream, the input stream is saved to the local file, then the link address of the local file is written into the test report,
when the content in the log information is in the form of a screenshot, the screenshot is saved locally, and then the HTMLimg tag of the locally saved screenshot is written into the test report.
7. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-3.
8. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610861294.6A CN107885648B (en) | 2016-09-29 | 2016-09-29 | Method and device for generating test report |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610861294.6A CN107885648B (en) | 2016-09-29 | 2016-09-29 | Method and device for generating test report |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107885648A CN107885648A (en) | 2018-04-06 |
CN107885648B true CN107885648B (en) | 2020-09-29 |
Family
ID=61768725
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610861294.6A Active CN107885648B (en) | 2016-09-29 | 2016-09-29 | Method and device for generating test report |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107885648B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109359053A (en) * | 2018-12-18 | 2019-02-19 | 上海科梁信息工程股份有限公司 | Generation method and relevant apparatus, the test macro and storage medium of test report |
CN111667605B (en) * | 2020-06-10 | 2022-07-19 | 阿波罗智能技术(北京)有限公司 | Automatic driving test data storage method and device and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102831047A (en) * | 2011-06-16 | 2012-12-19 | 上海聚力传媒技术有限公司 | Method, device and equipment for dynamically regulating log information output of monitoring object |
CN103150249A (en) * | 2011-12-07 | 2013-06-12 | 北京新媒传信科技有限公司 | Automatic testing method and system |
CN104035872A (en) * | 2014-06-27 | 2014-09-10 | 浪潮(北京)电子信息产业有限公司 | Method and device for testing clustering software |
CN104050075A (en) * | 2013-03-11 | 2014-09-17 | 百度国际科技(深圳)有限公司 | Test method and device for Andriod application program |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6539341B1 (en) * | 2000-11-06 | 2003-03-25 | 3Com Corporation | Method and apparatus for log information management and reporting |
US8732530B2 (en) * | 2011-09-30 | 2014-05-20 | Yokogawa Electric Corporation | System and method for self-diagnosis and error reporting |
-
2016
- 2016-09-29 CN CN201610861294.6A patent/CN107885648B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102831047A (en) * | 2011-06-16 | 2012-12-19 | 上海聚力传媒技术有限公司 | Method, device and equipment for dynamically regulating log information output of monitoring object |
CN103150249A (en) * | 2011-12-07 | 2013-06-12 | 北京新媒传信科技有限公司 | Automatic testing method and system |
CN104050075A (en) * | 2013-03-11 | 2014-09-17 | 百度国际科技(深圳)有限公司 | Test method and device for Andriod application program |
CN104035872A (en) * | 2014-06-27 | 2014-09-10 | 浪潮(北京)电子信息产业有限公司 | Method and device for testing clustering software |
Non-Patent Citations (2)
Title |
---|
Jmeter日志输出和日志级别设置;莫若韵;《https//blog.csdn.net/android_wangjuan/article/details/50547949》;20160120;第1页 * |
生成HTMLTestRunner 测试报告;YYZM520;《https://www.cnblogs.com/hero-blog/p/412857》;20141128;第1-4页 * |
Also Published As
Publication number | Publication date |
---|---|
CN107885648A (en) | 2018-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10684938B2 (en) | Code component debugging in an application program | |
Fu et al. | Where do developers log? an empirical study on logging practices in industry | |
US8312322B2 (en) | System for automated generation of computer test procedures | |
US9734263B2 (en) | Method and apparatus for efficient pre-silicon debug | |
US8555234B2 (en) | Verification of soft error resilience | |
US10049031B2 (en) | Correlation of violating change sets in regression testing of computer software | |
CN103049371A (en) | Testing method and testing device of Android application programs | |
Roehm et al. | Monitoring user interactions for supporting failure reproduction | |
Dong et al. | Practical and accurate pinpointing of configuration errors using static analysis | |
CN107957939B (en) | Webpage interaction interface testing method and system | |
US10613969B2 (en) | Code coverage module with testing function identifier | |
CA2811617C (en) | Commit sensitive tests | |
CN107885648B (en) | Method and device for generating test report | |
US10579761B1 (en) | Method and system for reconstructing a graph presentation of a previously executed verification test | |
CN116383025A (en) | Performance test method, device, equipment and medium based on Jmeter | |
WO2023275887A1 (en) | System and method for automated software testing | |
CN113238953A (en) | UI automation test method and device, electronic equipment and storage medium | |
CN113722229A (en) | Software testing method and device, electronic equipment and storage medium | |
CN110795338A (en) | Automatic testing method and device based on front-end and back-end interaction and electronic equipment | |
CN113094265B (en) | Analysis method and analysis device for test script and electronic equipment | |
CN112988593B (en) | Code analysis method, device, computer equipment and storage medium | |
JP2010182218A (en) | Software behavior analysis system | |
US20120167051A1 (en) | Electronic device and method for program structure analysis | |
CN114328189A (en) | Fault recurrence method, device, terminal and computer readable storage medium | |
CN117687904A (en) | Interface testing method, device, equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |