Abstract
Rust is a robust programming language which promises safety and performance at the same time. Despite its young age, it has already convinced many and has been one of the most popular programming languages among developers since its first release. However, like any other software, Rust programs need to be tested extensively. In this work, we propose the first search-based tool, called RustyUnit, for automatic generation of unit tests for Rust programs. RustyUnit incorporates a compiler wrapper, which statically analyzes and instruments a given program to generate and evaluate tests targeting high code coverage using a many-objective genetic algorithm. An initial empirical study using 6 real-world open-source Rust libraries demonstrates the feasibility of our approach but also highlights important differences and open challenges for test generation for Rust programs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Anderson, B., et al.: Engineering the servo web browser engine using rust. In: Proceedings of the 38th International Conference on Software Engineering Companion, pp. 81–89. ACM (2016)
Arcuri, A.: It really does matter how you normalize the branch distance in search-based software testing. Softw. Tes. Verif. Reliab. 23(2), 119–147 (2013)
Bruneton, E., Lenglet, R., Coupaye, T.: ASM: a code manipulation tool to implement adaptable systems. Adapt. Extensible Component Syst. 30(19) (2002)
Chiba, S.: Load-time structural reflection in Java. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 313–336. Springer, Heidelberg (2000). https://doi.org/10.1007/3-540-45102-1_16
Fraser, G., Arcuri, A.: Evolutionary generation of whole test suites. In: International Conference on Quality Software, pp. 31–40. IEEE Computer Society (2011)
Fraser, G., Arcuri, A.: 1600 faults in 100 projects: automatically finding faults while achieving high coverage with EvoSuite. Empir. Softw. Eng. 20(3), 611–639 (2013). https://doi.org/10.1007/s10664-013-9288-2
Fraser, G., Arcuri, A.: Automated test generation for Java generics. In: Winkler, D., Biffl, S., Bergsmann, J. (eds.) SWQD 2014. LNBIP, vol. 166, pp. 185–198. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-03602-1_12
Jiang, J., Xu, H., Zhou, Y.: RULF: rust library fuzzing via API dependency graph traversal. In: 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 581–592. IEEE Computer Society (2021)
Le, H.M.: KLUZZER: whitebox fuzzing on top of LLVM. In: Chen, Y.-F., Cheng, C.-H., Esparza, J. (eds.) ATVA 2019. LNCS, vol. 11781, pp. 246–252. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-31784-3_14
Panichella, A., Kifetew, F.M., Tonella, P.: Reformulating branch coverage as a many-objective optimization problem (2015)
Panichella, A., Kifetew, F.M., Tonella, P.: Automated test case generation as a many-objective optimisation problem with dynamic selection of the targets. IEEE Trans. Softw. Eng. 44(2), 122–158 (2018)
Rocha, H., Menezes, R., Cordeiro, L.C., Barreto, R.: Map2Check: using symbolic execution and fuzzing. In: TACAS 2020. LNCS, vol. 12079, pp. 403–407. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45237-7_29
Shamshiri, S., Rojas, J.M., Fraser, G., McMinn, P.: Random or genetic algorithm search for object-oriented test suite generation? In: Proceedings of the 2015 Annual Conference on Genetic and Evolutionary Computation, pp. 1367–1374. ACM (2015)
Takashima, Y., Martins, R., Jia, L., Păsăreanu, C.S.: Syrust: automatic testing of rust libraries with semantic-aware program synthesis. In: Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, pp. 899–913. ACM (2021)
Tymofyeyev, V., Fraser, G.: Rustyunit search-based test generator for rust (2022). https://doi.org/10.5281/zenodo.7090044
Zalewski, M.: American fuzzy lop (2014)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Tymofyeyev, V., Fraser, G. (2022). Search-Based Test Suite Generation for Rust. In: Papadakis, M., Vergilio, S.R. (eds) Search-Based Software Engineering. SSBSE 2022. Lecture Notes in Computer Science, vol 13711. Springer, Cham. https://doi.org/10.1007/978-3-031-21251-2_1
Download citation
DOI: https://doi.org/10.1007/978-3-031-21251-2_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-21250-5
Online ISBN: 978-3-031-21251-2
eBook Packages: Computer ScienceComputer Science (R0)