/rust-advanced-testing-workshop

A workshop for developers who have a good understanding of Rust's basic concepts and want to move beyond the built-in testing toolkit.

Primary LanguageRust

Advanced testing for Rust applications

No application is an island: you need to interact with third-party APIs, databases and who knows what else. Testing those interactions is tricky, to say the least! This workshop will focus on expanding your Rust testing toolkit, going beyond the basic techniques you're already familiar with. At the end of this workshop, you'll have a strategy to test most of the scenarios that are relevant for a complex Rust application.

The workshop is designed for software developers who have a good understanding of Rust's basic concepts and want to move beyond the built-in testing toolkit.
If you run into any issue with the assumed level of Rust knowledge, please ping us and we'll sort it together!

Note

This workshop has been written by Mainmatter.
It's one of the trainings in our portfolio of Rust workshops.
Check out our landing page if you're looking for Rust consulting or training!

Requirements

  • Rust (follow instructions here).
    If Rust is already installed on your system, make sure you are running on the latest compiler version (cargo --version).
    If not, update using rustup update (or another appropriate command depending on how you installed Rust on your system). You must have rustup installed (check with rustup --version).
  • (Optional) An IDE with Rust autocompletion support. We recommend one of the following:

Getting started

  1. Clone this repository.
  2. Install the nightly toolchain: rustup toolchain install nightly
  3. From the top-level folder, run the following commands:
    # Our `workshop-runner` CLI, you will need it to work through the exercises. 
    # You can run `wr --help` to check that everything is running properly
    cargo install --locked workshop-runner
    # `ctr` stands for Check Test Results and it'll be invoked by `wr` to verify 
    # the outcomes of your test.
    cargo install --path ctr
    
    # Work on your solution in a branch. 
    git checkout -b my-solution
    
    # Get started!
    wr
    Follow the instructions shown in the terminal to get started with the first exercise.

Run this command from the top-level folder

wr

to verify your current solutions and move forward in the workshop.

Enjoy!

Solutions

You can find the solutions to the exercises in the solutions branch of this repository.

References

Throughout the workshop, the following resources might turn out to be useful:

License

Copyright © 2023- Mainmatter GmbH (https://mainmatter.com), released under the Creative Commons Attribution-NonCommercial 4.0 International license.