From b67cb99f415072f9fa8dd9df24c6f926fd6bd66b Mon Sep 17 00:00:00 2001 From: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:51:10 +0300 Subject: [PATCH] feat: add links about testing in Rust (#5791) --- .../rust/content/119-testing/100-unit-integration.md | 7 ++++++- src/data/roadmaps/rust/content/119-testing/101-mocking.md | 8 +++++++- src/data/roadmaps/rust/content/119-testing/index.md | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/data/roadmaps/rust/content/119-testing/100-unit-integration.md b/src/data/roadmaps/rust/content/119-testing/100-unit-integration.md index 92c76594f..a5569abfc 100644 --- a/src/data/roadmaps/rust/content/119-testing/100-unit-integration.md +++ b/src/data/roadmaps/rust/content/119-testing/100-unit-integration.md @@ -1,3 +1,8 @@ # Unit and Integration Testing -In Rust language, the concept of unit integration encompasses writing tests for individual units of your code, typically a function or method, as well as for multiple units that interact with each other. Unit tests are written in the same files as the code and are used to verify the functionality of a single unit of software in isolation. On the other hand, integration tests are stored in an entirely different directory and are meant to test how multiple components or modules of your application work together. They rely on combining units of code and testing the group, identifying issues that may not be visible when units are tested in isolation. \ No newline at end of file +In Rust language, the concept of unit integration encompasses writing tests for individual units of your code, typically a function or method, as well as for multiple units that interact with each other. Unit tests are written in the same files as the code and are used to verify the functionality of a single unit of software in isolation. On the other hand, integration tests are stored in an entirely different directory and are meant to test how multiple components or modules of your application work together. They rely on combining units of code and testing the group, identifying issues that may not be visible when units are tested in isolation. + +Visit the following resources to learn more: + +- [Rust Book: How to Write Tests](https://doc.rust-lang.org/book/ch11-01-writing-tests.html) +- [Rust by Example: Unit testing](https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html) diff --git a/src/data/roadmaps/rust/content/119-testing/101-mocking.md b/src/data/roadmaps/rust/content/119-testing/101-mocking.md index a736ba824..4c40a3b38 100644 --- a/src/data/roadmaps/rust/content/119-testing/101-mocking.md +++ b/src/data/roadmaps/rust/content/119-testing/101-mocking.md @@ -1,3 +1,9 @@ # Mocking and Property-based Testing -In Rust, **mocking** is a process that lets you create fake functions, objects, or behaviors to test different conditions and scenarios in your code. Rust does not natively support mocking, however, there are external libraries present to help you perform mocking. Some of the popular libraries for mocking in rust are `mockall`, `mockiato`, and `double`. These libraries give you the ability to create mock structures with the same API as your original code and allow you to set predefined responses from functions or validate function calls, thus helping you test your rust code thoroughly. \ No newline at end of file +In Rust, **mocking** is a process that lets you create fake functions, objects, or behaviors to test different conditions and scenarios in your code. Rust does not natively support mocking, however, there are external libraries present to help you perform mocking. Some of the popular libraries for mocking in rust are `mockito`, `mockall`, and `mockall_double`. These libraries give you the ability to create mock structures with the same API as your original code and allow you to set predefined responses from functions or validate function calls, thus helping you test your rust code thoroughly. + +Visit the following resources to learn more: + +- [Docs.rs: mockito](https://docs.rs/mockito/latest/mockito/) +- [Docs.rs: mockall](https://docs.rs/mockall/latest/mockall/) +- [Docs.rs: mockall_double](https://docs.rs/mockall_double/latest/mockall_double/) diff --git a/src/data/roadmaps/rust/content/119-testing/index.md b/src/data/roadmaps/rust/content/119-testing/index.md index ae0c5e198..4e9822acb 100644 --- a/src/data/roadmaps/rust/content/119-testing/index.md +++ b/src/data/roadmaps/rust/content/119-testing/index.md @@ -1,3 +1,8 @@ # Testing -"Testing" in Rust is a crucial part of any programming project. This procedure involves creating specific scenarios to determine whether your code functions as expected. Rust has built-in support for this via the `cargo test` command which will run your test functions. These test functions are typically marked with the `#[test]` attribute to signify that they are not regular functions but testing adjuncts. Rust also provides a few macros such as `assert!`, `assert_eq!`, and `assert_ne!` for comparison checks and confirming expected behavior. \ No newline at end of file +"Testing" in Rust is a crucial part of any programming project. This procedure involves creating specific scenarios to determine whether your code functions as expected. Rust has built-in support for this via the `cargo test` command which will run your test functions. These test functions are typically marked with the `#[test]` attribute to signify that they are not regular functions but testing adjuncts. Rust also provides a few macros such as `assert!`, `assert_eq!`, and `assert_ne!` for comparison checks and confirming expected behavior. + +Visit the following resources to learn more: + +- [Rust Book: Writing Automated Tests](https://doc.rust-lang.org/book/ch11-00-testing.html) +- [YouTube](https://www.youtube.com/watch?v=8XaVlL3lObQ)