STUBLIB4UT: A Stub Generation Method for Library Functions in Unit Testing Java Projects
摘要
Automated stubbing for unit testing is crucial for achieving high code coverage in Java projects. This paper introduces a Concolic-based method called STUBLIB4UT, an enhancement of the AS4UT, designed to stub method invocations during unit testing. The core idea is to replace method invocations with mock variables during symbolic execution, using Java reflection to retrieve stub information. This approach enhances code coverage, particularly when stubbing library method invocations. Experimental results demonstrate that STUBLIB4UT surpasses existing AS4UT methods in both code coverage and memory usage when the unit under test includes library method invocation statements. The paper also discusses the proposed method in detail.