Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Unit test method and device

A technology of unit testing and test cases, applied in software testing/debugging, error detection/correction, instruments, etc., can solve the problems of lower test efficiency, test errors, high time cost, etc., to improve test efficiency and accuracy, and avoid testing Errors, Automated Effects

Active Publication Date: 2018-09-28
杭州有赞科技有限公司
View PDF4 Cites 6 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The technical defect of the above-mentioned existing technology is that in the process of writing test cases, more energy needs to be invested, even more time and energy than business code development is invested to write unit test codes covering various scenarios, and the time cost is high; Moreover, there are too many manual interventions and test errors caused by human factors, so more or less loopholes left in the source program cannot be found in time, reducing the test efficiency

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Unit test method and device
  • Unit test method and device
  • Unit test method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0047] The above and other technical features and advantages of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Apparently, the described embodiments are only some of the embodiments of the present invention, not all of them.

[0048] see figure 1 , the unit testing method provided by Embodiment 1 of the present invention includes the following steps;

[0049] S100. Obtain the test object input under the current unit test, obtain each class information and method information corresponding to the test object through a reflection mechanism, and generate a unit test according to each class information and method information according to preset rules and preset code templates in turn. code; unit test code includes composite index key information;

[0050] S200. Load the associated configuration list from the database according to the combined index key information, and parse the configuration list to obtain test ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a unit test method and device. The method comprises the steps of: acquiring a test object input under a current unit test, acquiring each class information and method information corresponding to the test object by a reflection mechanism, and sequentially according to each class information and method information and in terms of a preset rule and a preset code template, generating a unit test code, wherein the unit test code comprises combined inhaul key information; loading an associated configuration list from a database according to the combined inhaul key information, carrying out parsing on the configuration list, sequentially reading all test case data obtained by parsing, executing the unit test code and according to an execution result, generating a test report. Not only is automatic generation of the unit test code implemented and development efficiency of the unit test code is greatly improved, but also by loading the associated configuration list fromthe database according to the combined inhaul key information, automation of the unit test can be implemented, a test error caused by human factors is avoided, and test efficiency and accuracy are improved.

Description

technical field [0001] The invention relates to the technical field of software testing, in particular to a unit testing method and device. Background technique [0002] Unit testing is a kind of white-box testing, which aims to detect errors and loopholes in software codes, and ensure the quality of software from the source. It is to conduct coverage tests on each line of code or code block of the software to judge whether it is correct or not. It plays an important role in the software development process and is a very effective means of code quality assurance. In the prior art, the unit test method is mainly combined with some open-source test frameworks (such as Junit, Testng, etc.) to be manually coded by developers, and then a large number of test case codes are manually written to cover the logic of each branch of the code, so as to check the source code. The program code is tested and verified, and the test report is generated by compiling, and then the errors and l...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3684G06F11/3688
Inventor 潘福江
Owner 杭州有赞科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products