انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-016-L05

@SpringBootTest والتخزين المؤقت للسياق

  • الدرس 5 من 7
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

explain the cost of full-context tests.

الموضوعات المخطط لها

  • @SpringBootTest starts the entire application context.
  • Spring caches contexts between tests with the same configuration; different configs mean a new context.
  • Mock beans and different properties create new contexts, so use them sparingly.
  • Use it for a few end-to-end checks; use slices for most.
تفاصيل المخطط المبدئي

عرض عملي

a timeline: first test starts the context (seconds); next tests with the same configuration reuse it; a test with a new mock bean starts another.

اختبر فهمك

Why can adding a @MockitoBean slow the suite?

أظهر الإجابة

It changes the configuration, so Spring builds another context.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.