rust-lang-ua / rustcamp

Getting ready for prod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mention crates that help to test CLI applications.

mhnap opened this issue · comments

Problem to solve

There is already a lot of information in the 3_ecosystem chapter about building robust CLI applications. However, I think there is a gap in providing information about crates that are essential for testing CLI applications. Currently, participants need to spend (waste) their time on research trying to find best practices and crates for CLI testing. It would be more productive if this incubator already mentioned some common and popular crates for CLI testing.

Proposal

Add to 3_1_testing (or 3_9_cmd_env_conf) chapter a small section about CLI testing. It should mention common best practices and preferred crates for CLI testing.
For example:

  • assert_cmd - Easy command initialization and assertions.
  • assert_fs - Filesystem fixtures and assertions for testing.
  • predicates - Composable first-order predicate functions.
  • rexpect - For interactive CLI testing.

Links & references

https://rust-cli.github.io/book/tutorial/testing.html (definitely need to add, maybe even whole book)
https://www.rustadventure.dev/building-a-digital-garden-cli/clap-v4/testing-interactive-clis-with-rexpect (very good examples)
https://out-of-cheese-error.netlify.app/the-way (again good examples)

Thank you! Taken into account and added it to the program)