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

被引:3
|
作者
Zhang, Ming-Zhe [1 ]
Gong, Yun-Zhan [1 ]
Wang, Ya-Wen [1 ]
Jin, Da-Hai [1 ]
机构
[1] Beijing Univ Posts & Telecommun, State Key Lab Networking & Switching Technol, Beijing 100876, Peoples R China
基金
中国国家自然科学基金;
关键词
automated unit testing; program constraint; symbolic execution; static analysis; PROGRAMS;
D O I
10.1007/s11390-019-1935-7
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
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
页数:20
相关论文
共 50 条
  • [1] Unit Test Data Generation for C Using Rule-Directed Symbolic Execution
    Ming-Zhe Zhang
    Yun-Zhan Gong
    Ya-Wen Wang
    Da-Hai Jin
    [J]. Journal of Computer Science and Technology, 2019, 34 : 670 - 689
  • [2] Verifying Systems Rules Using Rule-Directed Symbolic Execution
    Cui, Heming
    Hu, Gang
    Wu, Jingyue
    Yang, Junfeng
    [J]. ACM SIGPLAN NOTICES, 2013, 48 (04) : 329 - 341
  • [3] Lazy symbolic execution for test data generation
    Lin, M. X.
    Chen, Y. L.
    Yu, K.
    Wu, G. S.
    [J]. IET SOFTWARE, 2011, 5 (02) : 132 - 141
  • [4] Feedback-Directed Unit Test Generation for C/C plus plus using Concolic Execution
    Garg, Pranav
    Ivancic, Franjo
    Balakrishnan, Gogul
    Maeda, Naoto
    Gupta, Aarti
    [J]. PROCEEDINGS OF THE 35TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2013), 2013, : 132 - 141
  • [5] Test Case Generation Using Symbolic Execution
    Pattanaik, Saumendra
    Sahoo, Bidush Kumar
    Panigrahi, Chhabi Rani
    Patnaik, Binod Kumar
    Pati, Bibudhendu
    [J]. COMPUTACION Y SISTEMAS, 2022, 26 (02): : 1035 - 1044
  • [6] Using symbolic execution to guide test generation
    Lee, G
    Morris, J
    Parker, K
    Bundell, GA
    Lam, P
    [J]. SOFTWARE TESTING VERIFICATION & RELIABILITY, 2005, 15 (01): : 41 - 61
  • [7] Automatic Test Generation for C and C plus plus Programs, Using Symbolic Execution
    Yoshida, Hiroaki
    Li, Guodong
    Kamiya, Takuki
    Ghosh, Indradeep
    Rajan, Sreeranga
    Tokumoto, Susumu
    Munakata, Kazuki
    Uehara, Tadahiro
    [J]. IEEE SOFTWARE, 2017, 34 (05) : 30 - 37
  • [8] Automated Coverage-Driven Test Data Generation Using Dynamic Symbolic Execution
    Su, Ting
    Pu, Geguang
    Fang, Bin
    He, Jifeng
    Yan, Jun
    Jiang, Siyuan
    Zhao, Jianjun
    [J]. 2014 EIGHTH INTERNATIONAL CONFERENCE ON SOFTWARE SECURITY AND RELIABILITY, 2014, : 98 - 107
  • [9] ATGen: automatic test data generation using constraint logic programming and symbolic execution
    Meudec, C
    [J]. SOFTWARE TESTING VERIFICATION & RELIABILITY, 2001, 11 (02): : 81 - 96
  • [10] Exhaustive Test-case Generation using Symbolic Execution
    Uehara, Tadahiro
    [J]. FUJITSU SCIENTIFIC & TECHNICAL JOURNAL, 2016, 52 (01): : 34 - 40