Random test case generation method facing Java program

A random testing and program technology, applied in the field of automated test case generation, which can solve the problems of many invalid and redundant test cases and low code coverage.

Inactive Publication Date: 2012-10-17
NANJING UNIV
View PDF1 Cites 29 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The main purpose of the present invention is to propose a method for generating random test cases for Java programs, using combined testing techniques, for the problems such as too many invalid and redundant test cases and too low code coverage in traditional object-oriented random testing methods. Analyze dependencies between object methods, systematically generate and maintain call chains, and automatically generate test cases

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
  • Random test case generation method facing Java program
  • Random test case generation method facing Java program
  • Random test case generation method facing Java program

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0060] Such as figure 1 As shown, the method of the present invention includes six basic steps: (1) parse the class definition of the Java program to obtain the list of object methods; (2) establish a dependency graph between object methods, including a method call graph and an attribute dependency graph; (3) ) Determine the list of target methods to be covered; (4) Generate a call chain for the purpose of instantiating public classes; (5) Generate a call chain for the purpose of covering target methods; (6) Generate a Java program test based on the call chain library Set of use cases. In the meantime, it is necessary to maintain and expand the class object library and call chain library to help generate effective test cases. The input of the method is a Java program, which can be represented by a directory containing the Java program, or a jar package (.jar file) that integrates the Java program; the output is a test case set, which is described by the JUnit test case frame...

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 random test case generation method facing a Java program. The random test case generation method comprises the following steps of: (1) resolving a class definition of the Java program, and acquiring an object method list; (2) establishing a dependency relation graph comprising a method calling graph and a property dependency graph among object methods; (3) determining a target method list to be covered; (4) generating a calling chain by aiming at instantiation for public classes, and maintaining a class object base; (5) generating a calling chain by aiming at covering target methods, and maintaining a calling chain base; and (6) generating a test case set for the Java program based on the calling chain base. The method can be widely applied to automatic test work of medium-and large-size Java software systems and can automatically generate test cases completely; the highest code coverage rate is achieved by the least number of test cases; complicated data structures can be processed; test assertion can be automatically generated; and the test case generation method is simple and effective, and has high applicability and expandability.

Description

[0001] technical field [0002] The invention relates to automatic test case generation of Java software programs, in particular to using the reflection mechanism and virtual machine facilities provided by the Java language itself to analyze the dependency relationship between object methods and to apply combined test technology to generate test cases fully automatically. Background technique [0003] Random testing is an effective method of generating test cases that can be fully automated. Random testing is based on the input space of software programs, using random algorithms to independently sample test inputs, and then generate test cases. The advantages of random testing include: the test case generation steps are simple, and a large number of test cases can be generated in a relatively short period of time; the existing pseudo-random number generation algorithm can be used, and manual intervention is basically not required; the random algorithm can ensure the accuracy...

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
Inventor 顾庆张孟乐汤九斌陈道蓄
Owner NANJING UNIV
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