일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- xargs
- find
- netsh
- Windows
- maVen
- bash
- lsof
- grep
- GIT
- JavaScript
- Source
- 줄바꿈 문자
- vscode
- 단축키
- tomcat
- resource
- import
- port
- Quartz
- Mac
- web.xml
- ssh
- Eclipse
- 네트워크
- Windows 10
- plugin
- IntelliJ
- VirtualBox
- context
- profile
- Today
- Total
develog
[spring boot] layer unit test 본문
Controller
@WebMvcTest(MemberController.class)
public class MemberControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private MemberService memberService;
}
Service
@ExtendWith(MockitoExtension.class)
public class MemberServiceTest {
@InjectMock
private MemberService memberService;
@Mock
private MemberRepository MemberRepository;
}
Repository
@DataJpaTest
public class MemberRepositoryTest {
@Autowired
private MemberRepository MemberRepository;
}
https://blog.devgenius.io/spring-boot-deep-dive-on-unit-testing-92bbdf549594
Controller, Service, and Repository Layer Unit Testing using JUnit and Mockito
“The principal objective of software testing is to give confidence in the software.” — Anonymous.
blog.devgenius.io
https://medium.com/@SlackBeck/mock-object%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B0%80-85159754b2ac
Mock Object란 무엇인가?
다른 누군가로부터 휴대 전화 서비스(CellphoneService) 기능을 제공 받아 이를 사용한 휴대 전화 문자 발신기(CellphoneMmsSender)를 프로그래밍 한다고 생각해 보자.
medium.com
https://martinfowler.com/testing/
Testing Guide
Testing should be an integral part of programming, with automated tests providing confidence of correctness.
martinfowler.com
https://testing.jabberstory.net/
Testing
원문은 http://martinfowler.com/articles/mocksArentStubs.html 모의객체는 스텁이 아니다(Mocks Aren't Stubs) Martin Fowler The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Mos
testing.jabberstory.net