Unlock instant, AI-driven research and patent intelligence for your innovation.

A method and device for implementing unit testing

A technology of unit testing and test suite, applied in the field of unit testing, can solve problems such as affecting the work efficiency of unit testing, time-consuming modification process, manual search, etc., to save the time of human participation and improve work efficiency.

Active Publication Date: 2017-08-01
上海浪潮云计算服务有限公司
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] In the unit test framework of CUnit, with the increase of test cases for unit tests, after writing the test cases, the operator needs to write the test suite according to the test cases, and the format of the test suite is a fixed format, just the name and content Different, when there are many test cases, the process is a very tedious process
Especially when the test case is changed, it is necessary to manually find the location of the test case, and the modification process is time-consuming
[0006] In summary, adding test suites and test cases to the unit test framework has become a repetitive and cumbersome task when performing unit tests
Affected the efficiency of unit testing

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
  • A method and device for implementing unit testing
  • A method and device for implementing unit testing

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0037] figure 1 The flow chart of the method for realizing the unit test of the present invention; figure 1 shown, including:

[0038] Step 100, traversing the test case files in the directory and subdirectories where the unit test is performed, and generating a test suite of the test case file according to the file name of the test case file.

[0039] In this step, traversing the test case files in the directory and subdirectories for unit testing is: traversing the test case files in the directory and subdirectories for unit testing through the Python script. Among them, Python is an object-oriented, interpreted computer programming language. Python syntax is concise and clear, and it has a rich and powerful class library. Python is often nicknamed the glue language, which can easily connect various modules made in other languages ​​together. A Python script refers to a script written in the Python language.

[0040] Before this step, it is also included to pre-set the c...

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 method and a device for implementing unit testing. The method includes: traversing test case files in a catalog and a subcatalog for unit testing, and generating test suites of the test case files according to file names of the test case files; establishing one-to-one correspondence mapping information of the test suites of the test case files and the test cases; according to the established mapping information of the test suites and the test cases, generating test files; according to the generated test suites and test files, performing unit testing on unit test applications, and outputting test results. By generating the test suites of the test case files according to the file names of the test case files and mapping of the test case files and the test suites, the process of adding the test suites and the test cases to a unit test framework is simplified, time of artificial participation in unit testing is saved, and working efficiency of unit testing is improved.

Description

technical field [0001] The invention relates to software testing technology, in particular to a method and device for realizing unit testing. Background technique [0002] Unit testing refers to checking and verifying the smallest testable unit in software. A unit test is used to judge the behavior of a function (or a process) under a certain condition (or scenario). For example, put a large value into an ordered list (list), and then confirm that the value appears at the end of the list to achieve unit testing; or, delete characters matching a certain pattern from the string, and then confirm Strings indeed no longer contain these characters implementing unit tests. Sufficient unit testing can detect and repair software bugs at an early stage, greatly improving software quality and reducing later maintenance costs. [0003] Unit testing is done by the programmer who writes the program. After the programmer writes the functional code, he writes a unit test to test each f...

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 Patents(China)
IPC IPC(8): G06F11/36
Inventor 王志华
Owner 上海浪潮云计算服务有限公司