Automatic unit test realizing method and device

A technology of unit testing and implementation methods, applied in the field of testing, can solve problems such as high coding time consumption, high personnel requirements, and heavy workload, and achieve the effects of improving testing efficiency and accuracy, reducing coding time, and realizing automation

Active Publication Date: 2015-03-11
GREE ELECTRIC APPLIANCES INC
View PDF3 Cites 41 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] Apparently, the technical defect of the above-mentioned prior art lies in that: in the process of writing test cases, test errors may be caused by the writer’s coding errors and other reasons, so that more or less loopholes left in the source program cannot be found in time ; Moreover, the amount of test case code is often larger than the amount of source program code, and the...

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
  • Automatic unit test realizing method and device
  • Automatic unit test realizing method and device
  • Automatic unit test realizing method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0028] figure 1 It is a schematic flowchart of a method for implementing an automated unit test provided in Embodiment 1 of the present invention. The method can be executed by an automatic unit test implementing device, which is implemented by software. see figure 1 The implementation method of the automated unit test provided in this embodiment specifically includes the following operations:

[0029] Operation S110, acquiring the configuration information of the object under test, the load object and the test case input by the user in this unit test.

[0030] Among them, the object under test is represented as an algorithm in the software, which is used to realize the processing of the internal or external logical relations of various load objects. The load object is represented as a structure in the software. The test case is composed of at least one assertion, and each assertion It includes an input parameter and an expected output parameter. The input parameter and the...

Embodiment 2

[0039] figure 2 It is a schematic flowchart of a method for implementing an automated unit test provided in Embodiment 2 of the present invention. In this embodiment, on the basis of the first embodiment above, operation S120 and operation S130 are optimized. see figure 2 The implementation method of the automated unit test provided in this embodiment specifically includes the following operations:

[0040] Operation S210, obtaining the configuration information of the object under test, the load object and the test case input by the user in this unit test;

[0041] Operation S220, according to the pre-generated StringTemplate code file template and the configuration information, according to the standard code format under CUnit, generate the corresponding measured object and test case code file, and the load object code file;

[0042] Operation S230, by referring to the automatic mode of the CUnit framework, based on the generated code file and the test framework code fi...

Embodiment 3

[0051] image 3 It is a schematic flowchart of a method for implementing an automated unit test provided in Embodiment 3 of the present invention. In this embodiment, the operation S230 is optimized on the basis of the second embodiment above. see image 3 The implementation method of the automated unit test provided in this embodiment specifically includes the following operations:

[0052] Operation S310, obtaining the configuration information of the object under test, the load object and the test case input by the user in this unit test;

[0053] Operation S320, according to the pre-generated StringTemplate code file template and the configuration information, according to the standard code format under CUnit, generate the corresponding measured object and test case code file, and the load object code file, and store the generated code file to the preset target folder directory;

[0054] Operation S330, determine the code file and the CUnit compilation library file of ...

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 an automatic unit test realizing method and device. The automatic unit test realizing method includes that acquiring the configuration information of a tested object, a load object and a test case input by a user under the unit test; generating the corresponding tested object code file, load object code file and test case code file according to a pre-generated code file template and the configuration information; executing associated compilation operation based on the generated code files, and a test framework code file and a test stub code file corresponding to the unit test so as to generate an executable test program, running the test program, and generating a test report according to the running result. By means of the technical scheme, the automatic unit test realizing method and device solve the problems of high workload and long time of the test case programming of the prior art, realize the unit test automation, shortens the test case coding time and improves the test efficiency and precision.

Description

technical field [0001] The embodiments of the present invention relate to the technical field of testing, and in particular, to a method and device for realizing automatic unit testing. Background technique [0002] In the development of large-scale unit programs, in order to be able to reuse the resources (architecture, documents, libraries, and source codes) of developed products, a set of software systems that can easily reuse program resources and can directly output programs through dynamic configuration attributes is usually required , so that the repetitive workload in the program development process can be reduced to a large extent, the progress of program development can be accelerated, and the product can take the lead in the market. For program development in such a software system, the quality of the program is undoubtedly the top priority, so it is very necessary to perform unit testing on it. [0003] Unit testing is a kind of white-box testing, which aims to ...

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 GREE ELECTRIC APPLIANCES INC
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