An Approach to Automatic Test Case Generation for Unit Testing

Pan Liu, Zhenning “Jimmy” Xu, Jun Ai · 2018

In the paper, we propose a method to automatically generate test cases for the program with nested loops. Our approach first constructs the layer model of the program by scanning procedure source code. Then, through the method of model refinement, the layer model is converted to the extended regular expression model. Next, we can get a set of test paths from the extended regular expression model according to algebraic operations and constraint conditions in the program. Finally, test cases of the program are constructed by using logical operations for these test paths. Compared with those traditional graph-based test case generation methods, our method can produce a set of executable test cases to satisfy a given test coverage criterion without having to build the control flow diagram of the program in unit testing. In addition, our method can also effectively avoid the state space explosion problem.

Read the paper · More papers on PaperTik