لطفا جهت اطلاع از آخرین دوره ها و اخبار سایت در
کانال تلگرام
عضو شوید.
آموزش تست واحد (Unit Testing) با JUnit و Mockito برای توسعهدهندگان جاوا
- آخرین آپدیت
دانلود JUnit and Mockito Unit Testing for Java Developers
نکته:
ممکن هست محتوای این صفحه بروز نباشد ولی دانلود دوره آخرین آپدیت می باشد.
نمونه ویدیوها:
توضیحات دوره:
بهروزرسانی شده در می ۲۰۲۵.
این دوره اکنون دارای قابلیت Coursera Coach است!
روشی هوشمندتر برای یادگیری با گفتگوهای تعاملی و آنی که به شما کمک میکند تا دانش خود را بسنجید، فرضیات را به چالش بکشید و در حین پیشروی در دوره، درک خود را عمیقتر کنید.
آیا به دنبال یک راهنمای ساده برای یادگیری تست واحد هستید؟ این دوره ویدئویی برای شما ایدهآل است. این دوره شامل تمرینات عملی و بهترین روشها (Best Practices) است تا به شما کمک کند JUnit و Mockito را به راحتی فرا بگیرید.
- دوره با معرفی تست واحد و اهمیت JUnit آغاز میشود.
- شما یک پروژه جاوا را با استفاده از JUnit ایجاد کرده و بهترین روشهای نوشتن و اجرای تستهای واحد را در JUnit و IntelliJ IDEA دنبال خواهید کرد.
- همچنین تستهای واحد مبتنی بر اشیاء مجازی (Mock Objects) را با Mockito مینویسید و با استفاده از کتابخانه Hamcrest که همراه JUnit است، ادعاهای (Assertions) قدرتمندی ایجاد میکنید.
- در پایان، مهارتهای لازم برای نوشتن تستهای واحد بهتر با استفاده از JUnit، Mockito و Hamcrest را کسب خواهید کرد.
این دوره برای توسعهدهندگان و تسترهای جاوا با دانش پایه که قصد دارند تستهای واحد را با JUnit، Mockito و Hamcrest بنویسند، مناسب است. مفاهیم مدرن تست واحد را بیاموزید، تستها را در IDE اجرا کنید، کدها را برای کیفیت تستها تحلیل نمایید و Assertions خوانایی بنویسید.
سرفصل ها و درس ها
مقدمه
Introduction
خوشآمدگویی به دوره
Welcome to the Course
مرور ساختار دوره
Overview of the Course Structure
مبانی تست واحد
Unit Testing Foundations
معرفی بخش
Section Introduction
تست واحد چیست؟
What is Unit Testing?
JUnit چیست؟
What is JUnit?
معرفی یک تست واحد ساده در JUnit
Introducing a Simple Unit Test in JUnit
ساختار یک تست واحد (Arrange Act Assert و Given/When/Then)
Structure of a Unit Test (Arrange-Act-Assert and Given/When/Then)
کنوانسیونهای نوشتن تستهای واحد
Conventions for Writing Unit Tests
ویژگیهای تستهای واحد صحیح
Characteristics of Proper Unit Tests
Assertions چیستند؟
What are Assertions?
ایجاد پروژه جاوا با استفاده از JUnit
Creating a Java Project Using JUnit
معرفی بخش
Section Introduction
ایجاد پروژه جاوا با استفاده از Maven Quickstart Archetype در JUnit
Creating a Java Project Using the Maven Quickstart Archetype in JUnit
معرفی ساختار متداول پروژه جاوا (درخت منابع Production در مقابل Test)
Introducing a Typical Java Project Structure (Production vs Test Source Trees)
درک کنوانسیونهای پایه برای ایجاد تستهای واحد (پکیج و نامگذاری)
Understanding the Basic Conventions for Creating Unit Tests (Package and Naming)
نوشتن و اجرای تستهای واحد با JUnit و IntelliJ IDEA
Writing and Running Unit Tests with JUnit and IntelliJ IDEA
معرفی بخش
Section Introduction
ایجاد متد تست با انوتیشن @Test
Creating a Test Method with @Test Annotation
اجرای تست واحد در محیط IDE و درک موفقیت تست
Running a Unit Test Within the Integrated Development Environment (IDE) and Understanding Test Success
درک شکست تستها با استفاده از Exceptions
Understanding Test Failures with Exceptions
شکست دادن صریح تست واحد با Assert.Fail()
Failing a Unit Test Explicitly with Assert.Fail()
استفاده از Assert.Fail() برای بررسی منطق اعتبارسنجی در Try/Catch
Using Assert.Fail() to Check Validation Logic in a Try/Catch
معرفی JUnit Assertions API
Introduction to the JUnit Assertions API
ساختاربندی تستهای واحد با متد Arrange Act Assert
Structuring Unit Tests with Arrange-Act Assert
درک نحوه اجرای Assertions و مکانیزم Fail fast در JUnit
Understanding the Execution of Assertions and JUnit's Fail-fast Test Failure Mechanism
افزودن کامنتهای توصیفی به Assertions و شکستهای تست برای عیبیابی
Adding Descriptive Comments to Assertions and Test Failures to Aid Diagnostics
کدنویسی تست واحد بر اساس الگوی Arrange Act Assert
Coding a Unit Test Following Arrange-Act-Assert
جلوگیری از تکرار کد در تنظیمات تست (DRY) با @Before
Keeping Test Setup (Don't Repeat Yourself) DRY with @Before
درک نمونهسازی Test Fixture
Understanding Test Fixture Instantiation
تست با استفاده از اشیاء مجازی و Mockito
Using Testing with Mock Objects and Mockito
معرفی بخش
Section Introduction
Mockito چیست و اشیاء Mock چیستند؟
What Is Mockito and What Are Mock Objects?
مقدمهای بر تست با اشیاء مجازی (Mock Objects)
Introduction to Testing with Mock Objects
پیکربندی پروژهها با استفاده از Mockito
Configuring Projects Using Mockito
ایجاد پروژهای که از JUnit و Mockito استفاده میکند
Creating a Project Which Uses JUnit and Mockito
کدنویسی معماری لایهای: لایه نمایش (Presentation Layer)
Coding a Layered Architecture - Presentation Layer
کدنویسی معماری لایهای: لایه کسبوکار (Business Layer)
Coding a Layered Architecture - Business Layer
کدنویسی معماری لایهای: لایه دسترسی به دادهها (Persistence Layer)
Coding a Layered Architecture - Persistence Layer
سازماندهی پکیجهای صحیح برای رعایت معماری لایهای
Putting the Correct Packages in Place to Respect the layering
نوشتن تست برای Login Controller در لایه نمایش
Writing a Test for the Login Controller in the Presentation Layer
درک تنظیمات Test Fixture هنگام نوشتن تستهای مبتنی بر Mock
Understanding the Test Fixture Setup While Writing Mock Object-based Unit Tests
نوشتن تست برای Authentication Service در لایه کسبوکار
Writing a Test for the Authentication Service in the Business Layer
تأمل در تصمیمات طراحی هنگام تست واحد
Thinking about Design Decisions When Unit Testing
بررسی کتابخانه Hamcrest Assertions
Looking at Hamcrest Assertions Library
معرفی بخش
Section Introduction
تکامل کلاسهای Domain و Repository
Evolving the Domain and Repository Classes
نادیده گرفتن تستها با @ignore
Ignoring Tests with @ignore
پیادهسازی متد Finder در Repository
Implementing a Finder in the Repository
پیادهسازی منطق کسبوکار در Service
Implementing Business Logic in the Service
پیکربندی Maven برای استفاده از Java 8
Configuring Maven to Use Java 8
تکامل کلاس Repository
Evolving the Repository Class
افزودن یک Finder پارامتریک به Service
Adding a Parameter-driven Finder to the Service
ریفکتور کردن برای ایجاد یک سرویس جدید
Refactoring to Evolve a New Service
تولید متدهای تست در IDE و جابجایی بین کد Production و Test
Generating Test Methods in the IDE and Toggling Between Production and Test Code
معرفی JUnit Mockito Runner و @Mock
Introducing the JUnit Mockito Runner and @Mock
تحلیل کد Production برای تعیین نحوه نوشتن بخش Arrange
Analyzing the Production Code to Determine How to Write the Arrange Section
استفاده از @InjectMocks در Mockito برای ایجاد سیستم تحت تست و وابستگیهای آن
Using Mockito's @InjectMocks to Create the System Under Test with its Dependencies
بررسی خروجی تستهای مسیر موفق (Happy Path) برای حفظ انگیزه
Keep Yourself Motivated by Checking the Happy Path Test Output
استفاده از JUnit Assertions API برای نوشتن بخش Assert
Using the JUnit Assertions API to Write the Assert Section
بررسی نقاط ضعف JUnit Assertions API
Thinking about the Weaknesses of the JUnit Assertions API
اهمیت بررسی مرحله به مرحله کارها
Importance of Checking Your Work as You Go!
ارتقای پروژه JUnit برای استفاده از نسخه کامل Hamcrest
Upgrading a JUnit Project to Use the Full Hamcrest Version
جایگزینی Assertionsهای JUnit با Hamcrest و استفاده از آنها برای مجموعهها (Collections)
Replacing JUnit Assertions with Hamcrest Assertions and Using Assertions with Collections
درک و خواندن خطاهای تست در Hamcrest
Understanding and Reading Hamcrest Test Failures
نکاتی سریع درباره Assertionsهای تکی در مقابل مجموعهای در Hamcrest
Quick Thoughts on Hamcrest Individual vs Collection Assertions
عدم فراخوانی کدهای غیرضروری Production در کلاسهای تست
Do Not Invoke Unneeded Production Code in Your Test Classes
درک نحوه ارزیابی Hamcrest Matchers
Understanding Evaluation of Hamcrest Matchers
به حداقل رساندن کدهای Production در تستها
Thinking about Keeping Production Code to a Minimum in Tests
ایجاد Assertionsهای پیچیده با متد allOf و Property Matchers
Creating Complex Hamcrest Assertions with allOf Method and Property Matchers
نمایش نظرات