عرض عملي: اختبارات الشرائح مقابل السياق الكامل مع قياس الزمن
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
measure the difference; prepares JNR-016-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Run the controller slice tests and note the time.
- Write the same check as a
@SpringBootTestwith@AutoConfigureMockMvc; run and note the time. - Run both classes together; show the cached context being reused.
- Planned mistake: convert every controller test to
@SpringBootTest"to be safe"; the suite becomes several times slower. Fix: keep slices; keep one full-context smoke test. - Summarize the rule: slice for one layer, full context for wiring and end-to-end.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.