Skip to main content

Search-Based Test Suite Generation for Rust

  • Conference paper
  • First Online:
Search-Based Software Engineering (SSBSE 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13711))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://web.archive.org/web/20220522213803/https://crates.io/crates/ntest.

References

  1. 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)

    Google Scholar 

  2. 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)

    Article  Google Scholar 

  3. Bruneton, E., Lenglet, R., Coupaye, T.: ASM: a code manipulation tool to implement adaptable systems. Adapt. Extensible Component Syst. 30(19) (2002)

    Google Scholar 

  4. 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

    Chapter  Google Scholar 

  5. Fraser, G., Arcuri, A.: Evolutionary generation of whole test suites. In: International Conference on Quality Software, pp. 31–40. IEEE Computer Society (2011)

    Google Scholar 

  6. 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

    Article  Google Scholar 

  7. 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

    Chapter  Google Scholar 

  8. 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)

    Google Scholar 

  9. 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

    Chapter  Google Scholar 

  10. Panichella, A., Kifetew, F.M., Tonella, P.: Reformulating branch coverage as a many-objective optimization problem (2015)

    Google Scholar 

  11. 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)

    Article  Google Scholar 

  12. 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

    Chapter  Google Scholar 

  13. 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)

    Google Scholar 

  14. 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)

    Google Scholar 

  15. Tymofyeyev, V., Fraser, G.: Rustyunit search-based test generator for rust (2022). https://doi.org/10.5281/zenodo.7090044

  16. Zalewski, M.: American fuzzy lop (2014)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gordon Fraser .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics