A drawing of a giant crab standing in a village.

All Rust Workshops

Testing in Rust: an introduction

4 hours Bookable for teams – on-site or remote

About This Workshop

Rust's type system is great, but it's not enough on its own to ensure correctness: a solid testing strategy is a requirement for any serious Rust application.

The workshop will build up your Rust's testing toolkit. We will start from scratch, with your first unit test. By the end, you will have a comprehensive understanding of the available test types, the best practices in terms of test organization as well as their runtime implications. You will be well equipped for the testing challenges ahead of you!

The workshop is designed for software developers who are just starting their Rust journey.

If you've been working with Rust for a while, you might be interested instead in our advanced testing workshop.

Bookable for teams

4 hours

On-site or remote

Book for your team

Syllabus

  1. Writing your first unit test

    Straight into the action: the #[test] annotation and basic assertions! We will wire everything up and get our feedback loop going.
  2. Testing failures

    Unhappy scenarios are often more important than the happy ones! We will discuss the #[should_panic] annotation as well as the tradeoffs of returning a Result from your tests.
  3. The Rust testing zoo

    Unit tests are just of the test approaches offered by Rust's built-in testing framework—we have integration and doc tests too. We will look at each category and build a mental framework for choosing the correct testing technique in each context.
  4. Running your tests

    What is a test? We will take a look under the hood to understand how the Rust built-in testing framework is actually implemented. Armed with this knowledge, we will explore the runtime implications of different approaches for test organisation. We will also cover alternative test runners, such as cargo-nextest.
  5. Test helpers: where do they go?

    Test code is just as important as production code: you want it to be terse and clearly communicate what is being tested. If you follow this philosophy, you'll soon be trying to extract common logic into test helpers: where should they be located? We will cover the different strategies available (test modules, feature gate, helper crate) and their trade-offs.
  6. Beyond assertions

    In closing, we will have a look at a few advanced techniques beyond the standard toolkit: snapshot testing (insta) and property-based testing (quickcheck).

FAQ

Placeholder! What software do I need to have?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl. Ut eu sollicitudin magna. Nullam varius neque ante, a pulvinar ipsum luctus id.

Placeholder! What hardware do I need to have?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl. Ut eu sollicitudin magna. Nullam varius neque ante, a pulvinar ipsum luctus id.

Placeholder! How will the workshop be held?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl. Ut eu sollicitudin magna. Nullam varius neque ante, a pulvinar ipsum luctus id.

Placeholder! How will the workshop be held?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl. Ut eu sollicitudin magna. Nullam varius neque ante, a pulvinar ipsum luctus id.

Your mentor

Luca Palmieri

Principal Engineering Consultant

Luca Palmieri builds technology products for a living. His current focus is on backend development, software architecture and the Rust programming language. He is the author of "Zero to Production in Rust".

Who we are

We are Mainmatter and we Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in nisi sed eros eleifend scelerisque a eu nisl.

Rust Workshops

We offer a range of workshops bookable for teams that want to grow – on-site or remote. We're also happy to prepare custom workshops – get in touch with us to talk about what curriculum fits your team best!

We are Trusted by

Bookable for teams

4 hours

On-site or remote

Book for your team

Can't Find the Right Workshops for Your Team?

We are happy to tailor the curriculum to your needs. We can combine multiple workshops, pick and choose modules, as well as develop new content if desired.
Get in Touch

Book This Workshop

Our mentors look forward to working with your team and unlocking new capabilities.

Send us a message

Your message is being sent…

Unable to send message.

Please try again later or contact us at info@mainmatter.com

Thank you!

We will be in touch soon.

Testing in Rust: an introduction