Unit test automatic execution method based on test case automatic generation algorithm

A test case, automatically generated technology, applied in software testing/debugging, computing, error detection/correction, etc.

CN110543421AActive Publication Date: 2019-12-06SOUTH CHINA UNIV OF TECH
5 Cites 8 Cited by

Patent Information

Authority / Receiving Office
CN · China
Current Assignee / Owner
Publication Date
2019-12-06

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention provides a unit test automatic execution method based on a test case automatic generation algorithm. The method comprises the following steps of: preprocessing codes of a tested program,performing lexical analysis, establishing a path diagram for generating test codes, outputting a control flow diagram to a file, inserting fixed-point codes into the preprocessed codes, and compilingthe file into which the codes are inserted; and then generating a test case according to a test case automatic generation algorithm, calling a user code, traversing each code block of the user code,calculating an algorithm adaptation value of the fit, obtaining the fit adaptation value, generating a path corresponding to the test case, and exiting when judging whether the path is fully covered or the operation is overtime. The method is suitable for unit testing in the software development process, a test case can be automatically generated through a computer program for code testing, a testreport can be automatically generated, and the human resource cost and the time cost are greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the field of software testing of computer software engineering, in particular to an integrated method based on path coverage test case automatic generation algorithm and unit test automatic execution. Background technique

[0002] With the explosive growth of the number of software applications and the continuous development of the software industry, high-quality software has become a common demand of the industry and users, and high-quality software is always inseparable from a large number of tests. The IEEE Computer Society gave a clear definition of software testing in IEEE Std829-1983: the quality of software is measured by means of manual testing or automatic testing, and it is used to check whether the actual running results of the tested software are consistent with those when the software was designed. unanimous. Because the traditional method of testing software under test by manually generating test cases requires a...

Examples

Embodiment 1

[0105] In this embodiment, the unit test automatic execution method based on the test case automatic generation algorithm comprises the following steps:

[0106] The first step is to input the source program to be tested, such as figure 2 As shown, perform file preprocessing

[0107] In the second step, the unit test automatic execution method based on the test case automatic generation algorithm conducts a global lexical analysis on the source program and establishes a path diagram for generating test codes, such as image 3 shown.

[0108] The third step is to insert the analysis code, convert the code in the judgment statement and insert the relevant global code. After inserting the code, the code file structure is as follows (the following code is for reference only):

[0109]

[0110]

[0111]

[0112]

[0113]

[0114]

[0115] The fourth step is to call the existing g++ and gcc environment to compile and execute the file after the code is inserted....