Unit test code generation method and device

A unit test and code generation technology, applied in the field of unit test code generation methods and devices, can solve the problems of heavy workload, time-consuming, repetitive work, low coding efficiency, etc., and achieve the effect of reducing workload

Inactive Publication Date: 2012-07-18
SHENZHEN COSHIP ELECTRONICS CO LTD
View PDF3 Cites 18 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

This method needs to modify a large number of program codes, resulting in a large workload, time-consuming and repetitive work, which makes the coding efficiency low

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 code generation method and device
  • Unit test code generation method and device
  • Unit test code generation method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

[0039] see figure 1 , is a flowchart of an embodiment of the unit test code generation method of the present invention. During specific implementation, the unit test code generation method of the embodiment of the present invention includes:

[0040] S101. Import a source code set, where the source code set includes at least one source code file.

[0041] During specific implementation, firstly, a project project is created in the JUnit software, and secondly, a ...

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 code generation method and a device. The unit test code generation method of the embodiment can directly executing a generated unit test code in JUnit software when a test is required to be performed by obtaining an operation unit of a source code document and corresponding parameter properties, obtaining a writing rule of the unit test code and combining the operation unit of the source code document, the corresponding parameter properties and the writing rule of the unit test code to automatically generate the unit test code corresponding to the source code document, so that a programmer does not need to write the unit test code and only needs to modify a parameter according to the practical requirements of the method, and further the working load of the programmer is reduced. The coverage correct rate of the code generated by the unit test code generation method of the embodiment and the device can reach 20% or so through the statistic of the JUnit software, and the remaining codes can be correctly executed by slightly modifying the parameter by themselves.

Description

technical field [0001] The invention relates to unit test technology, in particular to a method and device for generating unit test codes. Background technique [0002] Unit testing is to focus on testing each program unit implemented by the source code, to detect whether each program unit correctly implements the specified function, and to check whether the return value of each program module is correct. Unit tests examine every branch of the control structure to ensure complete coverage and maximum possible error checking. The JUnit unit test code refers to the unit test code written according to certain specifications. The corresponding JUnit test tool needs to calculate the coverage, correctness, data verification and other information based on the JUnit unit test code. [0003] Unit testing is to find as many program errors as possible. The discovery of errors is to correct the errors, and the program code needs to be modified. Whenever the program code is modified, ...

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
IPC IPC(8): G06F11/36
Inventor 何振飞邓勇
Owner SHENZHEN COSHIP ELECTRONICS CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products