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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

STUBLIB4UT: A Stub Generation Method for Library Functions in Unit Testing Java Projects

  • Hoang-Viet Tran,
  • Minh Quan Nguyen,
  • Thi Trang Do,
  • Pham Ngoc Hung

摘要

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.