Back to skills
extension
Category: Development & EngineeringNo API key required

presentation-tdd

Must be used when implementing Controller, Request/Response DTO classes. When implementing the presentation layer, start with parameter testing from Outside-In TDD. Automatically triggered during "Controller implementation", "API implementation", "endpoint implementation", "Request DTO", "Response DTO" work.

personAuthor: jakexiaohubgithub

프레젠테이션 계층 TDD 지침

TDD 순서

  1. 인수 테스트 (≠실패) → Controller + DTO 구현
  2. API 문서 테스트 → 문서화 완성

특이사항

  • Outside-In TDD: 인수 테스트부터 시작
  • 베이스 클래스: AcceptanceTestBase / ApiDocsTestBase 상속
  • 보안: @WithMockOAuth2User 필수
  • CSRF: POST/PUT/DELETE에 .postProcessors(csrf()) 필수

핵심 규칙

Controller 규칙

  • 하나의 Controller에 하나의 API만 작성
  • 모든 엔드포인트는 /api/로 시작
  • 비즈니스 로직/예외 처리 금지 (Service 책임)

DTO 명명

  • Request: {Find/Save/Modify/Delete}{도메인}Request
  • Response: {Find/Save/Modify/Delete}{도메인}Response
  • record 타입 필수

Controller 명명

  • {Find/Save/Modify/Delete}{도메인}Controller

상세 지침

[필수] 아래 참조 문서를 모두 읽은 후 작업을 시작하세요: