# Testing (Rust) > 단위 테스트, 통합 테스트, 문서 테스트, 어서션, should_panic, 벤치마크, 테스트 구성 - 18 면접 질문 - Mid-Level - [면접 질문: Rust](https://sharpskill.dev/ko/technologies/rust/interview-questions.md) ## 1. Rust에서 함수를 단위 테스트로 표시하는 속성은 무엇입니까? **답변** #[test] 속성은 주석이 달린 함수가 단위 테스트임을 Rust 컴파일러에 알립니다. cargo test를 실행하면 이 속성으로 표시된 모든 함수가 자동으로 검색되어 실행됩니다. 테스트는 test 프로파일에서만 컴파일되며 프로덕션 바이너리에는 포함되지 않습니다. ## 2. Rust 프로젝트의 모든 테스트를 실행하는 Cargo 명령은 무엇입니까? **답변** cargo test 명령은 테스트가 활성화된 상태로 프로젝트를 컴파일하고 모든 단위 테스트, 통합 테스트, 문서 테스트를 실행합니다. #[test]로 표시된 함수, tests/ 디렉터리의 테스트, 문서의 코드 예제를 자동으로 검색합니다. 옵션을 통해 이름이나 모듈로 테스트를 필터링할 수 있습니다. ## 3. 테스트에서 두 값이 같은지 확인하려면 어떤 매크로를 사용해야 합니까? **답변** assert_eq! 매크로는 두 값을 비교하고 같지 않으면 테스트를 실패시킵니다. Debug 트레이트 덕분에 실패 시 비교된 값을 자동으로 표시하여 디버깅이 쉬워집니다. assert!와 달리 기대값과 실제값을 보여주는 더 유익한 오류 메시지를 제공합니다. ## 15개 추가 질문 이용 가능 - Rust 프로젝트에서 통합 테스트는 어디에 배치해야 합니까? - 함수가 panic을 일으키는지 테스트하려면 어떤 속성을 사용해야 합니까? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Rust 면접 주제 - [Rust 기초](https://sharpskill.dev/ko/technologies/rust/interview-questions/rust-basics.md): 25개 질문, Junior - [Ownership & Borrowing](https://sharpskill.dev/ko/technologies/rust/interview-questions/ownership-borrowing.md): 22개 질문, Junior - [Structs & Enums](https://sharpskill.dev/ko/technologies/rust/interview-questions/structs-enums.md): 20개 질문, Junior - [에러 처리](https://sharpskill.dev/ko/technologies/rust/interview-questions/error-handling.md): 18개 질문, Junior - [컬렉션](https://sharpskill.dev/ko/technologies/rust/interview-questions/collections.md): 20개 질문, Junior - [모듈과 패키지](https://sharpskill.dev/ko/technologies/rust/interview-questions/modules-packages.md): 18개 질문, Junior - [Traits](https://sharpskill.dev/ko/technologies/rust/interview-questions/traits.md): 22개 질문, Mid-Level - [Generics](https://sharpskill.dev/ko/technologies/rust/interview-questions/generics.md): 20개 질문, Mid-Level - [Lifetimes](https://sharpskill.dev/ko/technologies/rust/interview-questions/lifetimes.md): 20개 질문, Mid-Level - [Iterators & Closures](https://sharpskill.dev/ko/technologies/rust/interview-questions/iterators-closures.md): 22개 질문, Mid-Level - [Smart Pointers](https://sharpskill.dev/ko/technologies/rust/interview-questions/smart-pointers.md): 22개 질문, Mid-Level - [Concurrency Basics](https://sharpskill.dev/ko/technologies/rust/interview-questions/concurrency-basics.md): 20개 질문, Mid-Level - [async/await](https://sharpskill.dev/ko/technologies/rust/interview-questions/async-await.md): 22개 질문, Mid-Level - [Cargo & Ecosystem](https://sharpskill.dev/ko/technologies/rust/interview-questions/cargo-ecosystem.md): 18개 질문, Mid-Level - [Pattern Matching](https://sharpskill.dev/ko/technologies/rust/interview-questions/pattern-matching.md): 18개 질문, Mid-Level - [매크로](https://sharpskill.dev/ko/technologies/rust/interview-questions/macros.md): 20개 질문, Mid-Level - [Serde와 직렬화](https://sharpskill.dev/ko/technologies/rust/interview-questions/serde-serialization.md): 20개 질문, Mid-Level - [Unsafe Rust](https://sharpskill.dev/ko/technologies/rust/interview-questions/unsafe-rust.md): 20개 질문, Senior - [고급 트레잇](https://sharpskill.dev/ko/technologies/rust/interview-questions/advanced-traits.md): 22개 질문, Senior - [고급 lifetime](https://sharpskill.dev/ko/technologies/rust/interview-questions/advanced-lifetimes.md): 20개 질문, Senior - [Type System](https://sharpskill.dev/ko/technologies/rust/interview-questions/type-system.md): 20개 질문, Senior - [Tokio & Async I/O](https://sharpskill.dev/ko/technologies/rust/interview-questions/tokio-async.md): 22개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/rust/interview-questions/performance-optimization.md): 20개 질문, Senior - [Memory Management](https://sharpskill.dev/ko/technologies/rust/interview-questions/memory-management.md): 20개 질문, Senior - [Web Frameworks](https://sharpskill.dev/ko/technologies/rust/interview-questions/web-frameworks.md): 22개 질문, Senior - [Database Integration](https://sharpskill.dev/ko/technologies/rust/interview-questions/database-integration.md): 20개 질문, Senior - [Rust 디자인 패턴](https://sharpskill.dev/ko/technologies/rust/interview-questions/design-patterns.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/rust/interview-questions/testing