Presentation is loading. Please wait.

Presentation is loading. Please wait.

Random Unit-Test Generation with MUT-aware

Similar presentations


Presentation on theme: "Random Unit-Test Generation with MUT-aware"— Presentation transcript:

1 Random Unit-Test Generation with MUT-aware
Sequence Recommendation Wujie Zheng, Qirun Zhang, Michael Lyu Tao Xie The Chinese University of Hong Kong North Carolina State University Problem To find method-call sequences that generate desired inputs of a method under test (MUT). The inputs include the receiver and arguments. A desired object may need to be prepared by not only the constructors but also some other methods. // An example sequence for Stack.search(Object); var0 is the receiver, var1 is the argument Stack var0 = new Stack(); String var1 = "hi!"; var0.push((Object)var1); int var2 = var0.search(var1); Challenge The search space of possible method-call sequences is very large. Approach MUT-aware sequence recommendation To analyze object fields accessed by a MUT and recommend a short sequence that mutates these fields. Correlation weight The percentage of methods mutating fields accessed by the MUT in a sequence. Size weight The inverse of the number of methods in a sequence. Weighted Random Selection Select sequences randomly based on the equal combination of the two weights. RecGen: Recommendation based Test Generation 1 Idea A method can affect the execution of the MUT only if it creates an input or mutate an input’s fields accessed by the MUT. Experiments Three subjects Compared with JCrasher [1], Randoop [4], and ARTGen [2] References [1] C. Csallner and Y. Smaragdakis. JCrasher: an automatic robustness tester for Java. Softw., Pract. Exper., 34(11):1025–1050, 2004. [2] Y. Lin, X. Tang, Y. Chen, and J. Zhao. A divergence-oriented approach to adaptive random testing of Java programs. In ASE, pages 221–232, 2009. [3] F. Long, X. Wang, and Y. Cai. API hyperlinking via structural overlap. In ESEC/SIGSOFT FSE, pages 203–212, 2009. [4] C. Pacheco, S. K. Lahiri, M. D. Ernst, and T. Ball. Feedback-directed random test generation. In ICSE, pages 75–84, 2007. [5] S. Thummalapenta, T. Xie, N. Tillmann, J. de Halleux, and W. Schulte. MSeqGen: object-oriented unit-test generation via mining source code. In ESEC/SIGSOFT FSE, pages 193–202, 2009. openDatabase() calls setupDatabase() calls getAllowCreate() accesses allowCreate setAllowCreate() accesses allowCreate To test openDatabse(), for sequences that generate DatabaseConfig objects, we prefer the sequences that call setAllowCreate()


Download ppt "Random Unit-Test Generation with MUT-aware"

Similar presentations


Ads by Google