B-Refactoring: Automatic Test Code Refactoring to Improve Dynamic Analysis

by Jifeng Xuan, Benoit Cornu, Matias Martinez, Benoit Baudry, Lionel Seinturier and Martin Monperrus
Abstract: Context: Developers design test suites to verify that software meets its expected behaviors. Many dynamic analysis techniques are performed on the exploitation of execution traces from test cases. In practice, one test case may imply various behaviors. However, the execution of a test case only yields one trace, which can hide the others. Objective: In this article, we propose a new technique of test code refactoring, called B-Refactoring. The idea behind B-Refactoring is to split a test case into small test fragments, which cover a simpler part of the control flow to provide better support for dynamic analysis. Method: For a given dynamic analysis technique, B-Refactoring monitors the execution of test cases and constructs small test cases without loss of the testability. We apply B-Refactoring to assist two existing analysis tasks: automatic repair of if-condition bugs and automatic analysis of exception contracts. Results: Experimental results show that B-Refactoring can effectively improve the execution traces of the test suite. Real-world bugs that could not be previously fixed with the original test suites are fixed after applying B-Refactoring; meanwhile, exception contracts are better verified via applying B-Refactoring to original test suites. Conclusions: We conclude that applying B-Refactoring improves the execution traces of test cases for dynamic analysis. This improvement can enhance existing dynamic analysis tasks.
 View PDF
Open-access (on archives-ouvertes.fr)
Publisher version (via DOI)
Citations: [citations]
Other publications of Martin Monperrus

Cite it:

B-Refactoring: Automatic Test Code Refactoring to Improve Dynamic Analysis (, , , , and ), In Information and Software Technology, Elsevier, volume 76, .
Jifeng Xuan, Benoit Cornu, Matias Martinez, Benoit Baudry, Lionel Seinturier and Martin Monperrus, "B-Refactoring: Automatic Test Code Refactoring to Improve Dynamic Analysis", In Information and Software Technology, Elsevier, vol. 76, pp. 65-80, 2016.

Bibtex Entry:

@article{xuan:hal-01309004,
 title = {{B-Refactoring: Automatic Test Code Refactoring to Improve Dynamic Analysis}},
 author = {Xuan, Jifeng and Cornu, Benoit and Martinez, Matias and Baudry, Benoit and Seinturier, Lionel and Monperrus, Martin},
 url = {https://hal.archives-ouvertes.fr/hal-01309004/file/banana-refactoring.pdf},
 journal = {{Information and Software Technology}},
 publisher = {{Elsevier}},
 volume = {76},
 pages = {65-80},
 year = {2016},
 doi = {10.1016/j.infsof.2016.04.016},
}
Powered by bibtexbrowser
Tagged as: