用于C/ c++项目单元测试的自动存根方法

Tran Nguyen Huong, Le Huu Chung, Lam Nguyen Tung, Hoang-Viet Tran, Pham Ngoc Hung
{"title":"用于C/ c++项目单元测试的自动存根方法","authors":"Tran Nguyen Huong, Le Huu Chung, Lam Nguyen Tung, Hoang-Viet Tran, Pham Ngoc Hung","doi":"10.1109/KSE56063.2022.9953784","DOIUrl":null,"url":null,"abstract":"Automated stubs generation is an important problem when testing units which contains calls to other uncompleted functions as testing and development phases are normally performed in parallel. This paper presents a fully automated method, named AS4UT, for generating stubs used in unit testing of C/C++ projects. The key idea of AS4UT is to consider each function call a mock variable. The idea is done by adding a Pre-process CFG (control flow graph) phase to concolic testing method. In this phase, all function calls in the CFG of a unit under test are replaced by their corresponding mock variables. Then, the updated CFG is used as an input for concolic testing method to generate the required test data set. We have implemented AS4UT in a tool, named AutoStubTesing, and performed experiments with some common functions which calls other units. Experimental results show that AS4UT can increase the code coverage of the generated test data set whilst reducing the number of test data and keeping the required time acceptable.","PeriodicalId":330865,"journal":{"name":"2022 14th International Conference on Knowledge and Systems Engineering (KSE)","volume":"146 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-10-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"An Automated Stub Method for Unit Testing C/C++ Projects\",\"authors\":\"Tran Nguyen Huong, Le Huu Chung, Lam Nguyen Tung, Hoang-Viet Tran, Pham Ngoc Hung\",\"doi\":\"10.1109/KSE56063.2022.9953784\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Automated stubs generation is an important problem when testing units which contains calls to other uncompleted functions as testing and development phases are normally performed in parallel. This paper presents a fully automated method, named AS4UT, for generating stubs used in unit testing of C/C++ projects. The key idea of AS4UT is to consider each function call a mock variable. The idea is done by adding a Pre-process CFG (control flow graph) phase to concolic testing method. In this phase, all function calls in the CFG of a unit under test are replaced by their corresponding mock variables. Then, the updated CFG is used as an input for concolic testing method to generate the required test data set. We have implemented AS4UT in a tool, named AutoStubTesing, and performed experiments with some common functions which calls other units. Experimental results show that AS4UT can increase the code coverage of the generated test data set whilst reducing the number of test data and keeping the required time acceptable.\",\"PeriodicalId\":330865,\"journal\":{\"name\":\"2022 14th International Conference on Knowledge and Systems Engineering (KSE)\",\"volume\":\"146 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2022-10-19\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2022 14th International Conference on Knowledge and Systems Engineering (KSE)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/KSE56063.2022.9953784\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2022 14th International Conference on Knowledge and Systems Engineering (KSE)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/KSE56063.2022.9953784","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

当测试单元包含对其他未完成功能的调用时,自动生成存根是一个重要的问题,因为测试和开发阶段通常是并行执行的。本文提出了一种名为AS4UT的全自动方法,用于生成用于C/ c++项目单元测试的存根。AS4UT的关键思想是将每个函数调用视为模拟变量。该思想是通过在圆锥测试方法中增加一个预处理CFG(控制流图)阶段来实现的。在这个阶段,被测单元的CFG中的所有函数调用都被相应的模拟变量替换。然后,将更新后的CFG作为concolic测试方法的输入,生成所需的测试数据集。我们在一个名为AutoStubTesing的工具中实现了AS4UT,并使用一些调用其他单元的常见函数进行了实验。实验结果表明,AS4UT可以提高生成测试数据集的代码覆盖率,同时减少测试数据的数量并保持所需的时间可接受。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
An Automated Stub Method for Unit Testing C/C++ Projects
Automated stubs generation is an important problem when testing units which contains calls to other uncompleted functions as testing and development phases are normally performed in parallel. This paper presents a fully automated method, named AS4UT, for generating stubs used in unit testing of C/C++ projects. The key idea of AS4UT is to consider each function call a mock variable. The idea is done by adding a Pre-process CFG (control flow graph) phase to concolic testing method. In this phase, all function calls in the CFG of a unit under test are replaced by their corresponding mock variables. Then, the updated CFG is used as an input for concolic testing method to generate the required test data set. We have implemented AS4UT in a tool, named AutoStubTesing, and performed experiments with some common functions which calls other units. Experimental results show that AS4UT can increase the code coverage of the generated test data set whilst reducing the number of test data and keeping the required time acceptable.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信