Files
llm-wiki/raw/official-docs/spring-framework-test-enabledif-jupiter-annotation.md
T

8.5 KiB

title, source_type, url, archive_url, related_branches, related_projects, tags, created
title source_type url archive_url related_branches related_projects tags created
Spring Framework — @EnabledIf / @DisabledIf JUnit Jupiter Annotations official-doc https://docs.spring.io/spring-framework/reference/testing/annotations/integration-junit-jupiter.html
feature-contract-verification-test-suite
ca-skeleton
official-doc
ca-skeleton
testing
spring-framework
api-contract
2026-06-15

Spring Framework — @EnabledIf / @DisabledIf JUnit Jupiter Annotations

Layer: raw/ — Spring Framework 공식 참조 문서의 JUnit Jupiter 통합 어노테이션 (@EnabledIf / @DisabledIf) 원문 발췌·출처 기록. 검증된 요약은 /ingestwiki/concepts/source-summary-template 형식으로 별도 작성.

Parent / 활용 branch (필수)

Branch 이 자료가 정당화하는 결정
raw/branch-notes/feature-contract-verification-test-suite D3: optional adapter contract test 는 adapter enabled env matrix 에서만 실행 (skipped, not failed) — @EnabledIf 가 Spring Environment 의 property placeholder (${adapter.enabled} 등) 를 읽어 true 일 때만 테스트를 실행(SKIPPED 처리)함을 공식 문서가 직접 명시

출처 / Source

왜 저장했는지 / Why archived

feature-contract-verification-test-suite branch 의 D3 결정("optional adapter contract test 는 adapter enabled env matrix 에서만 실행")을 뒷받침하는 공식 근거. Spring TestContext Framework 의 @EnabledIf 가 SpEL 또는 property placeholder 표현식을 평가해 Boolean.TRUE 또는 문자열 "true"(대소문자 무시)일 때만 테스트를 실행하고, 그렇지 않으면 JUnit Jupiter 의 SKIPPED 결과를 반환한다는 것을 공식 문서가 직접 명시한다.

핵심 인용 / Key quotes (verbatim, 3~5문장)

[§@EnabledIf / Purpose] "Signals that an annotated JUnit Jupiter test class or test method is enabled and should be run if the supplied expression evaluates to true."

[§@EnabledIf / Evaluation Rules] "Test is enabled if expression evaluates to Boolean.TRUE or a String equal to true (ignoring case)"

[§@EnabledIf / Supported Expression Types — Property Placeholder] "Property Placeholder (from Spring Environment) @EnabledIf("${smoke.tests.enabled}")"

[§@EnabledIf / Meta-Annotation Example] "expression = \"#{systemProperties['os.name'].toLowerCase().contains('mac')}\", reason = \"Enabled on Mac OS\""

[§@EnabledIf / Important Note] "Since JUnit 5.7, JUnit Jupiter has its own @EnabledIf annotation. Ensure you import from the correct package when using Spring's version."

Claims Extracted / 추출된 주장

이 자료가 직접 말하는 것만 claim 으로 분리한다.

Claim ID Claim (이 자료가 직접 말하는 것) Evidence quote Strength Applies to Does not prove
SPRING-ENABLEDIF-C1 @EnabledIf 는 표현식이 Boolean.TRUE 또는 대소문자 무관 문자열 "true" 로 평가될 때만 해당 JUnit Jupiter 테스트를 실행한다 [§Evaluation Rules] "Test is enabled if expression evaluates to Boolean.TRUE or a String equal to true (ignoring case)" official-vendor-doc Spring TestContext Framework + JUnit Jupiter 조합을 사용하는 모든 Spring 통합 테스트 표현식이 false 일 때 JUnit 이 SKIPPED 를 반환한다는 것을 명시적으로 서술하지는 않음 (JUnit Jupiter 조건부 실행 메커니즘에 따른 암묵적 결과)
SPRING-ENABLEDIF-C2 @EnabledIf 의 표현식에는 SpEL(Spring Expression Language) 또는 Spring Environment 의 property placeholder 를 사용할 수 있다 [§Supported Expression Types] "Property Placeholder (from Spring Environment) @EnabledIf("${smoke.tests.enabled}")" official-vendor-doc Spring Environment 에 등록된 모든 property (application.properties, 시스템 환경변수, 프로파일 등) 특정 property 소스 우선순위(예: 시스템 환경변수 vs application.properties)를 이 페이지에서 정의하지는 않음
SPRING-ENABLEDIF-C3 @EnabledIfexpression, reason 속성을 가지며, reason 은 테스트가 비활성화될 때 보고되는 이유를 담는다 [§Meta-Annotation Example] "expression = \"#{systemProperties['os.name'].toLowerCase().contains('mac')}\", reason = \"Enabled on Mac OS\"" official-vendor-doc Spring @EnabledIf 어노테이션 자체 loadContext 속성의 동작(ApplicationContext 조기 로딩 여부)은 이 인용에서 확인되지 않음
SPRING-ENABLEDIF-C4 Spring 의 @EnabledIf 와 JUnit Jupiter 5.7+ 의 동명 어노테이션이 공존하므로 패키지 임포트를 명시적으로 구분해야 한다 [§Important Note] "Since JUnit 5.7, JUnit Jupiter has its own @EnabledIf annotation. Ensure you import from the correct package when using Spring's version." official-vendor-doc JUnit 5.7 이상 + Spring TestContext Framework 동시 사용 환경 Spring 의 @EnabledIf 패키지 경로(org.springframework.test.context.junit.jupiter) 를 이 인용이 직접 명시하지는 않음
SPRING-ENABLEDIF-C5 @DisabledIf@EnabledIf 의 반대로, 표현식이 Boolean.TRUE 또는 대소문자 무관 "true" 일 때 테스트를 비활성화한다 [§@DisabledIf / Evaluation Rules] "Test is disabled if expression evaluates to Boolean.TRUE or a String equal to true (ignoring case)" official-vendor-doc Spring TestContext Framework + JUnit Jupiter 조합 @EnabledIf + @DisabledIf 를 동일 메서드에 동시 사용할 때의 우선순위는 이 페이지에서 정의하지 않음

Usage Boundaries / 적용 경계

  • 이 자료가 직접 증명하는 것:
    • SPRING-ENABLEDIF-C1: @EnabledIf 표현식이 Boolean.TRUE 또는 "true"(ignoring case)일 때 해당 테스트를 실행한다는 공식 평가 규칙
    • SPRING-ENABLEDIF-C2: SpEL 및 Spring Environment property placeholder 를 표현식으로 사용할 수 있음 — 환경변수 또는 application.properties 에 의해 테스트 실행 여부를 제어할 수 있음
    • SPRING-ENABLEDIF-C3: reason 속성이 존재하며 비활성화 사유를 기록할 수 있음
    • SPRING-ENABLEDIF-C4: JUnit 5.7 이후 패키지 충돌 가능성이 공식 문서에 명시됨
    • SPRING-ENABLEDIF-C5: @DisabledIf 는 동일 평가 규칙으로 테스트를 비활성화함
  • 이 자료가 증명하지 않는 것:
    • 표현식이 false/null 일 때 JUnit 이 SKIPPED 를 반환한다는 것을 명시적으로 서술하지 않음 (JUnit Jupiter 조건부 실행 API 의 일반 계약에서 파생되는 결과)
    • loadContext 속성의 의미와 ApplicationContext 사전 로딩 동작
    • @EnabledIf 의 정확한 Spring 패키지 경로
    • property placeholder 의 property 소스 우선순위
  • 내 프로젝트에 적용하려면 추가 확인이 필요한 것:
    • ca-skeleton 의 실제 env profile matrix (APP_ADAPTER_X_ENABLED=false 등의 property key) 와 @EnabledIf("${adapter.x.enabled:false}") 패턴의 실제 동작 검증 필요
    • Spring @EnabledIf 의 패키지 임포트 (org.springframework.test.context.junit.jupiter.EnabledIf) vs JUnit Jupiter 의 @EnabledIf (org.junit.jupiter.api.condition.EnabledIf) 충돌 여부 확인

메모 / Notes

  • WebFetch 가 Spring 공식 문서를 요약·재구성한 출력을 반환하였고, 본 파일의 인용은 그 출력에서 발췌. 공식 문서 HTML 원문과의 완전한 바이트 동일성은 보장되지 않음 — /ingest 시 원본 페이지를 재확인 권장.
  • D3 의 "SKIPPED, not failed" 의미는 SPRING-ENABLEDIF-C1 이 직접 지지하지만, JUnit Jupiter 의 조건부 실행 API 가 falseSKIPPED 를 반환한다는 것은 JUnit 공식 문서(@EnabledIf API 계약)로 보강 시 완결됨. 별도 raw source 추가 권장.
  • 추가로 봐야 할 동일 출처 페이지: Spring TestContext Framework 전체 어노테이션 페이지 (특히 loadContext 속성 설명 섹션)
  • 같은 주제 다른 official-doc: JUnit Jupiter @EnabledIf / @DisabledIf 공식 API docs (org.junit.jupiter.api.condition 패키지)
  • 이 자료를 인용한 wiki 요약: (미작성 — /ingestwiki/concepts/ 에 생성 예정)