Unit Test Data Generation for C Using Rule-Directed Symbolic Execution

被引:0
作者
Ming-Zhe Zhang
Yun-Zhan Gong
Ya-Wen Wang
Da-Hai Jin
机构
[1] Beijing University of Posts and Telecommunications,State Key Laboratory of Networking and Switching Technology
来源
Journal of Computer Science and Technology | 2019年 / 34卷
关键词
automated unit testing; program constraint; symbolic execution; static analysis;
D O I
暂无
中图分类号
学科分类号
摘要
Unit testing is widely used in software development. One important activity in unit testing is automatic test data generation. Constraint-based test data generation is a technique for automatic generation of test data, which uses symbolic execution to generate constraints. Unit testing only tests functions instead of the whole program, where individual functions typically have preconditions imposed on their inputs. Conventional symbolic execution cannot detect these preconditions, let alone converting these preconditions into constraints. To overcome these limitations, we propose a novel unit test data generation approach using rule-directed symbolic execution for dealing with functions with missing input preconditions. Rule-directed symbolic execution uses predefined rules to detect preconditions in the individual function, and generates constraints for inputs based on preconditions. We introduce implicit constraints to represent preconditions, and unify implicit constraints and program constraints into integrated constraints. Test data generated based on integrated constraints can explore previously unreachable code and help developers find more functional faults and logical faults. We have implemented our approach in a tool called CTS-IC, and applied it to real-world projects. The experimental results show that rule-directed symbolic execution can find preconditions (implicit constraints) automatically from an individual function. Moreover, the unit test data generated by our approach achieves higher coverage than similar tools and efficiently mitigates missing input preconditions problems in unit testing for individual functions.
引用
收藏
页码:670 / 689
页数:19
相关论文
共 42 条
[41]   An automated test data generation method for void pointers and function pointers in C/C plus plus libraries and embedded projects [J].
Lam Nguyen Tung ;
Hoang-Viet Tran ;
Khoi Nguyen Le ;
Pham Ngoc Hung .
INFORMATION AND SOFTWARE TECHNOLOGY, 2022, 145
[42]   Fuzuli: Automatic Test Data Generation for Software Structural Testing using Grey Wolf Optimization Algorithm and Genetic Algorithm [J].
Arasteh, Bahman ;
Sattari, Mohammad Reza ;
Kalan, Reza Shokri .
2022 IEEE INTL CONF ON DEPENDABLE, AUTONOMIC AND SECURE COMPUTING, INTL CONF ON PERVASIVE INTELLIGENCE AND COMPUTING, INTL CONF ON CLOUD AND BIG DATA COMPUTING, INTL CONF ON CYBER SCIENCE AND TECHNOLOGY CONGRESS (DASC/PICOM/CBDCOM/CYBERSCITECH), 2022, :194-199