CLOVERšŸ€

That was when it all began.

Spring Bootļ¼Spring Frameworkć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć‚’ć–ć£ćć‚Šēœŗ悁恦ćæ悋

恓悌ćÆ态ćŖć«ć‚’ć—ćŸćć¦ę›øć„ćŸć‚‚ć®ļ¼Ÿ

Springć«é–¢ć™ć‚‹ćƒ†ć‚¹ćƒˆć®č©±ć«ć¤ć„ć¦ć€ć‚ć¾ć‚ŠēŸ„悉ćŖć„ć®ć§ć”ć‚‡ć£ćØ見恦恊恓恆恋ćŖ态ćØę€ć„ć¾ć—ć¦ć€‚

ć•ć‚‰ć£ćØ态Springć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć‚’ēœŗ悁恦ćæć¾ć™ć€‚

Springć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±

ä»Šå›žę‰±ć†ć®ćÆ态Spring Bootć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±ćØSpring Frameworkć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±ļ¼ˆSpring Testļ¼‰ć«ć¤ć„恦見恦恄恓恆恋ćŖćØę€ć„ć¾ć™ć€‚

åÆ¾č±”ć®ćƒćƒ¼ć‚øćƒ§ćƒ³ćÆ态仄äø‹ćØć—ć¾ć™ć€‚

Spring Bootć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆćÆ恓恔悉怂

Core Features / Testing

Spring Frameworkć®ćƒ†ć‚¹ćƒˆļ¼ˆSpring Testļ¼‰ć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆćÆ态恓恔悉怂

Testing

ćć‚Œćžć‚Œč¦‹ć¦ć„ćć¾ć™ćŒć€ä»Šå›žćÆå˜ä½“ćƒ†ć‚¹ćƒˆć«ć¤ć„ć¦

Spring BootćØćƒ†ć‚¹ćƒˆ

ć¾ćšćÆ态Spring Bootć«é–¢ć™ć‚‹ćƒ†ć‚¹ćƒˆć«ć¤ć„ć¦ć€č¦‹ć¦ć„ćć¾ć™ć€‚

Core Features / Testing

ć“ć”ć‚‰ć®ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆćÆ态4恤恮悻ć‚Æć‚·ćƒ§ćƒ³ć«åˆ†ć‹ć‚Œć¦ć„ć¾ć™ć€‚

ę³Øē›®ć—恦čŖ­ć‚€ć¹ććÆ态Springć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±ćØ态Spring Bootć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć«é–¢ć™ć‚‹ćƒ†ć‚¹ćƒˆć®č©±ć§ć™ć­ć€‚

ćØ恓悍恧态Test Scope Dependencies恮Spring Test恮ē®‡ę‰€ć«ćÆ态仄äø‹ć®ć‚ˆć†ć«ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

Spring Test & Spring Boot Test: Utilities and integration test support for Spring Boot applications.

ćƒ†ć‚¹ćƒˆć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćØ态Spring Bootć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć®ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć‚’ć‚µćƒćƒ¼ćƒˆć™ć‚‹ć‚‚ć®ć ć€ćØę›øć‹ć‚Œć¦ć„ć¾ć™ć­ć€‚

ć¾ćŸć€ Core Features / Testing / Testing Spring Applications 悒見悋ćØ态仄äø‹ć®ć‚ˆć†ć«ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

One of the major advantages of dependency injection is that it should make your code easier to unit test. You can instantiate objects by using the new operator without even involving Spring. You can also use mock objects instead of real dependencies.

Spring悒ä½æ悏恚态newę¼”ē®—å­ć‚’ä½æć£ćŸć‚¤ćƒ³ć‚¹ć‚æćƒ³ć‚¹åŒ–ć€ćć—ć¦ćƒ¢ćƒƒć‚Æć‚’åˆ©ē”Øć—ć¦å˜ä½“ćƒ†ć‚¹ćƒˆćŒć§ćć‚‹ćØ恄恆恓ćØ恌ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

Spring恮ApplicationContext悄Spring Test态Spring Boot Test悒ä½æ恆恮ćÆć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć§ć‚ć‚‹ćØ悂ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

Often, you need to move beyond unit testing and start integration testing (with a Spring ApplicationContext).

The Spring Framework includes a dedicated test module for such integration testing. You can declare a dependency directly to org.springframework:spring-test or use the spring-boot-starter-test ā€œStarterā€ to pull it in transitively.

ć¤ć¾ć‚Šć€Springć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ę©Ÿčƒ½ćÆć€ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć‚’åÆ¾č±”ć«ć—ć¦ć„ć‚‹ć“ćØ恫ćŖć‚Šć¾ć™ć€‚

Spring FrameworkćØćƒ†ć‚¹ćƒˆ

恓恓恧态Spring Frameworkć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć‚’č¦‹ć¦ćæć¾ć™ć€‚

Testing

ć“ć®ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆćÆ态äø»ć«ę¬”恮2ć¤ć®å†…å®¹ć§ę§‹ęˆć•ć‚Œć¦ć„ć¾ć™ć€‚

ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć®å†’é ­ć‚’č¦‹ć‚‹ćØć€ć“ć®ćƒšćƒ¼ć‚øćÆå˜ä½“ćƒ†ć‚¹ćƒˆć®ćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ćØSpringć®ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ć‚µćƒćƒ¼ćƒˆć«
恤恄恦ę›ø恄恦恂悋态ćØ恮čØ˜č¼‰ćŒć‚ć‚Šć¾ć™ć€‚

This chapter covers Springā€™s support for integration testing and best practices for unit testing.

恓恓恧悂态Spring Frameworkć®ęä¾›ć™ć‚‹ę©Ÿčƒ½ć®å¤šććÆć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆå‘ć‘ć®ć‚‚ć®ć ćØ恄恆恓ćØ恫ćŖć‚Šć¾ć™ć­ć€‚

Spring FrameworkćØå˜ä½“ćƒ†ć‚¹ćƒˆ

Spring Frameworkć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±é”ŒćÆć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ć‚‚ć®ć ćØ恄恆恓ćØćÆć‚ć‹ć‚Šć¾ć—ćŸćŒć€å˜ä½“ćƒ†ć‚¹ćƒˆć®ć‚»ć‚Æć‚·ćƒ§ćƒ³ć‚‚
ć‚ć‚Šć¾ć—ćŸć­ć€‚ć“ć”ć‚‰ć‚‚čæ½ć£ć¦ćæć¾ć—ć‚‡ć†ć€‚

Testing / Unit Testing

恓恮悻ć‚Æć‚·ćƒ§ćƒ³ć®å†’é ­ć‚’č¦‹ć‚‹ćØ态仄äø‹ć®ć‚ˆć†ćŖ恓ćØ恌ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

  • POJOćÆ态Springć‚„ćć®ä»–ć®ć‚³ćƒ³ćƒ†ćƒŠć‚’ä½æē”Ø恛恚恫newę¼”ē®—å­ć§ć‚¤ćƒ³ć‚¹ć‚æćƒ³ć‚¹åŒ–ć—ć€JUnitćŖć©ć§ćƒ†ć‚¹ćƒˆć§ćć‚‹ć‚ˆć†ć«ć™ć¹ćć 
  • ć‚³ćƒ¼ćƒ‰ć®åˆ†é›¢ćÆć€ćƒ¢ćƒƒć‚Æ悒ä½æć£ć¦å®Ÿē¾åÆčƒ½
  • SpringćÆć€å˜ä½“ćƒ†ć‚¹ćƒˆå‘ć‘ć®ćƒ¢ćƒƒć‚Æć‚Ŗ惖ć‚ø悧ć‚Æ惈ćØćƒ†ć‚¹ćƒˆć‚µćƒćƒ¼ćƒˆć‚’ęä¾›ć™ć‚‹

åŸŗęœ¬ēš„恫ćÆå˜ä½“ćƒ†ć‚¹ćƒˆćÆSpring悒ä½æć‚ćšć«å®Ÿč”Œć§ćć‚‹ć¹ćć§ć‚ć‚Šć€ćƒ©ćƒ³ć‚æć‚¤ćƒ ć®ć‚»ćƒƒćƒˆć‚¢ćƒƒćƒ—ćŒäøč¦ć«ćŖć‚‹ć®ć§å˜ä½“ćƒ†ć‚¹ćƒˆćÆé«˜é€Ÿć«
å®Ÿč”Œć•ć‚Œć‚‹ć“ćØć‚’ęœŸå¾…ć—ć¦ć„ć¾ć™ć€‚

True unit tests typically run extremely quickly, as there is no runtime infrastructure to set up. Emphasizing true unit tests as part of your development methodology can boost your productivity.

ćØćÆć„ćˆć€å˜ä½“ćƒ†ć‚¹ćƒˆå‘ć‘ć®Springć®ć‚µćƒćƒ¼ćƒˆć‚‚ć‚ć‚‹ć€ćØć„ć†č©±ć®ć‚ˆć†ć§ć™ć€‚

ęä¾›ć•ć‚Œć‚‹ć®ćÆ态仄äø‹ć§ć™ć­ć€‚

  • ćƒ¢ćƒƒć‚Æć‚Ŗ惖ć‚ø悧ć‚Æ惈
    • Environment
      • org.springframework.mock.envćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¢ćƒƒć‚Æå®Ÿč£…
      • MockEnvironment态MockPropertySource
    • JNDI
      • org.springframework.mock.jndićƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¢ćƒƒć‚Æå®Ÿč£…
      • 恟恠恗非ęŽØå„ØåŒ–ć•ć‚Œć¦ćŠć‚Šć€Simple-JNDIē­‰ć§ä»£ę›æ恕悌悋
    • Servlet API
      • org.springframework.mock.webćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¢ćƒƒć‚Æå®Ÿč£…
    • Spring Web Reactive
      • org.springframework.mock.http.server.reactivećƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¢ćƒƒć‚Æå®Ÿč£…
  • å˜ä½“ćƒ†ć‚¹ćƒˆć‚µćƒćƒ¼ćƒˆ
    • General Testing Utilities
      • org.springframework.test.utilćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£
      • ćƒŖćƒ•ćƒ¬ć‚Æć‚·ćƒ§ćƒ³ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ReflectionTestUtils态AOPé–¢é€£ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£AopTestUtilsćŖ恩
    • Spring MVC Testing Utilities
      • org.springframework.test.webćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć‚‹ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£
      • Controllerć®ćƒ†ć‚¹ćƒˆć‚’č”Œć†ć«ćÆ态ModelAndViewAssertćŖ恩悒ä½æ恄态Servlet APIć®ćƒ¢ćƒƒć‚Æļ¼ˆMockHttpServletRequest悄MockHttpSessionćØēµ„ćæåˆć‚ć›ć‚‹

Spring FrameworkćØć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆ

Spring Frameworkć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć«ćÆå˜ä½“ćƒ†ć‚¹ćƒˆćØć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć®å†…å®¹ćŒę›øć‹ć‚Œć¦ć„ć‚‹ć‚ć‘ć§ć™ćŒć€
ćƒšćƒ¼ć‚øå†…ć®ćƒœćƒŖćƒ„ćƒ¼ćƒ ć‚’č¦‹ć‚‹ćØ大半ćÆć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆå‘ć‘ć®ć‚‚ć®ć§ć‚ć‚‹ć“ćØćŒć‚ć‹ć‚Šć¾ć™ć€‚

恓恮悻ć‚Æć‚·ćƒ§ćƒ³ć®ę¦‚č¦ć‚’č¦‹ć¦ćæć¾ć™ć€‚

Testing / Integration Testing / Overview

It is important to be able to perform some integration testing without requiring deployment to your application server or connecting to other enterprise infrastructure.

ć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚µćƒ¼ćƒćƒ¼ćøć®ćƒ‡ćƒ—ćƒ­ć‚¤ć‚„ć€ä»–ć®ć‚Øćƒ³ć‚æćƒ¼ćƒ—ćƒ©ć‚¤ć‚ŗć‚¤ćƒ³ćƒ•ćƒ©ć‚¹ćƒˆćƒ©ć‚Æćƒćƒ£ćƒ¼ćø恮ꎄē¶šćŖć—ć«ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć‚’
å®Ÿč”Œć§ćć‚‹ć“ćØć‚’é‡č¦č¦–ć—ć¦ć„ć¾ć™ć€‚

恓悌恧态äø»ć«Springć®ć‚³ćƒ³ćƒ†ć‚­ć‚¹ćƒˆć‚’ę­£ć—ćę§‹ēÆ‰ć§ćć¦ć„ć‚‹ć‹ć€ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć‚¢ć‚Æć‚»ć‚¹ćŖć©ć‚’ćƒ†ć‚¹ćƒˆć§ćć‚‹ć€ćØć—ć¦ć„ć¾ć™ć€‚

恓恮悻ć‚Æć‚·ćƒ§ćƒ³ć§ę›øć‹ć‚Œć¦ć„ć‚‹Spring Testļ¼ˆspring-testļ¼‰ć®org.springframework.testćƒ‘ćƒƒć‚±ćƒ¼ć‚ø恫ćÆ态Springć®ć‚³ćƒ³ćƒ†ćƒŠć‚’ä½æć£ćŸ
ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ć‚Æćƒ©ć‚¹ćŒå«ć¾ć‚Œć¦ć„ć¾ć™ć€‚

恓悌悉悒ä½æē”Øć—ćŸćƒ†ć‚¹ćƒˆćÆć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚µćƒ¼ćƒćƒ¼ć‚„ćć®ä»–ć®ē’°å¢ƒć«ä¾å­˜ć—ć¦ćŠć‚‰ćšć€å˜ä½“ćƒ†ć‚¹ćƒˆć‚ˆć‚ŠćÆé…ć„ć‚‚ć®ć®ć€ć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚µćƒ¼ćƒćƒ¼ć«
ćƒ‡ćƒ—ćƒ­ć‚¤ć—ć¦ć®Seleniumć§ć®ćƒ†ć‚¹ćƒˆć‚„ćƒŖćƒ¢ćƒ¼ćƒˆćƒ†ć‚¹ćƒˆć‚ˆć‚Šć‚‚ćšć£ćØé«˜é€Ÿć§ć™ć€‚

Springć«ćŠć‘ć‚‹ć€ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆć®ē›®ęؙćÆ仄äø‹ć«ę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

Testing / Integration Testing / Goals of Integration Testing

ć“ć†ć„ć£ćŸę„Ÿć˜ć§ć™ć­ć€‚

ć¾ćŸć€ä»„äø‹ć®ę©Ÿčƒ½ćŒå«ć¾ć‚Œć¦ć„ć¾ć™ć€‚

Spring Bootć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć®ćƒ†ć‚¹ćƒˆ

ćØ恓悍恧态Spring Bootć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ć‚»ć‚Æć‚·ćƒ§ćƒ³ć«ćÆ态ꬔ恮2ć¤ćŒå«ć¾ć‚Œć¦ć„ć¾ć—ćŸć€‚

Springć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć®ćƒ†ć‚¹ćƒˆćÆć€å…ˆć»ć©ć¾ć§ę›øć„ć¦ć„ćŸSpring Test恮話恧恙怂

恧ćÆSpring Bootć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹č©±ćÆļ¼ŸćØ恄恆ćØ态Spring Bootć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚‚Springć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć§ć‚ć‚‹ćŸć‚ć€
ē‰¹åˆ„ćŖ恓ćØćÆćŖ恄ćØę›øć‹ć‚Œć¦ć„ć¾ć™ć€‚

A Spring Boot application is a Spring ApplicationContext, so nothing very special has to be done to test it beyond what you would normally do with a vanilla Spring context.

ć§ć™ćŒć€ć„ćć¤ć‹ć®ę©Ÿčƒ½ćÆęä¾›ć™ć‚‹ć‚ˆć†ć§ć™ć€‚ä»„äø‹ć«äø€éƒØ悒čØ˜č¼‰ć—ć¾ć™ćŒć€åŸŗęœ¬ēš„恫ćÆAuto Configurationć«é–¢ć™ć‚‹ę©Ÿčƒ½ć®ć‚ˆć†ć§ć™ć­ć€‚

  • Detecting Web Application Type
    • Spring Web MVCćŒåˆ©ē”ØåÆčƒ½ćŖ堓合ćÆMVCćƒ™ćƒ¼ć‚¹ć®ApplicationContext悒꧋ēÆ‰ć—ć€Spring WebFlux恮ćæćŒåˆ©ē”ØåÆčƒ½ćŖ堓合ćÆWebFluxćƒ™ćƒ¼ć‚¹ć®ApplicationContext悒꧋ēÆ‰ć™ć‚‹
  • Detecting Test Configuration
    • Spring Boot恮@*Testć‚¢ćƒŽćƒ†ćƒ¼ć‚·ćƒ§ćƒ³ć‚’ä½æē”Ø恙悋恓ćØć§ć€ćƒ—ćƒ©ć‚¤ćƒžćƒŖćƒ¼ć®ę§‹ęˆć‚’ę˜Žē¤ŗ恗ćŖć„å “åˆćÆč‡Ŗå‹•ę§‹ęˆć‚’č”Œć†
  • Testing with a mock environment
    • ćƒ¢ćƒƒć‚Æć‚µćƒ¼ćƒćƒ¼ć§ć®ćƒ†ć‚¹ćƒˆ
  • Testing with a running server
    • å®Ÿéš›ć®ć‚µćƒ¼ćƒćƒ¼ć‚’čµ·å‹•ć—ć¦ć®ćƒ†ć‚¹ćƒˆ
  • Customizing WebTestClient
    • WebTestClientć®ć‚«ć‚¹ć‚æ惞悤ć‚ŗ
  • Mocking and Spying Beans
    • Beanć®ćƒ¢ćƒƒć‚ÆćŠć‚ˆć³ć‚¹ćƒ‘ć‚¤
  • Auto-configured Tests
    • Spring Boot恮Auto Configurationć‚’ć‚«ć‚¹ć‚æ惞悤ć‚ŗ恗态éƒØ分ēš„恫Auto Configuration悒ä½æć†ćŸć‚ć®å¤šę•°ć®ć‚¹ćƒ©ć‚¤ć‚¹ćŠć‚ˆć³ćƒ†ć‚¹ćƒˆ
    • ä½æć„ę–¹ćÆåŒć‚»ć‚Æć‚·ćƒ§ćƒ³ć«ę›øć‹ć‚Œć¦ć„ć‚‹ćŒć€åˆ„ćƒšćƒ¼ć‚ø恮Test Auto-configuration Annotationsć«ć€å„ć‚¹ćƒ©ć‚¤ć‚¹ć«å«ć¾ć‚Œć‚‹Auto Configuration恌čØ˜č¼‰ć•ć‚Œć¦ć„ć‚‹
  • Test Utilities
    • ć„ćć¤ć‹ć®ćƒ†ć‚¹ćƒˆćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ļ¼ˆConfigDataApplicationContextInitializer态TestPropertyValues态OutputCapture态TestRestTemplate
  • Creating Your Own Auto-configuration
    • ē‹¬č‡Ŗ恮Auto Configurationć®ć‚µćƒćƒ¼ćƒˆ

ć¾ćØ悁

Springć®ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć‚’č¦‹ć¦ć€Springć®ćƒ†ć‚¹ćƒˆć®ć‚µćƒćƒ¼ćƒˆć«åÆ¾ć™ć‚‹č€ƒćˆę–¹ć‚„ć€ć‚«ćƒćƒ¼ć™ć‚‹ćƒ•ć‚§ćƒ¼ć‚ŗļ¼ˆå˜ä½“ćƒ†ć‚¹ćƒˆć€
ć‚¤ćƒ³ćƒ†ć‚°ćƒ¬ćƒ¼ć‚·ćƒ§ćƒ³ćƒ†ć‚¹ćƒˆļ¼‰ć€ć©ć®ć‚ˆć†ćŖę©Ÿčƒ½ćŒęä¾›ć™ć‚‹ć‹ć‚’ć–ć£ćć‚Šēœŗ悁恦ćæć¾ć—ćŸć€‚

é›°å›²ę°—ćÆćŠć‚ˆćć‚ć‹ć£ćŸć®ć§ć€ćć®ć†ć”ć„ćć¤ć‹ć®ę©Ÿčƒ½ć‚’ä½æć£ć¦ćƒ†ć‚¹ćƒˆć«é–¢ć™ć‚‹å‹‰å¼·ć‚’ć—ć¦ć„ććŸć„ć§ć™ć­ć€‚