본문 바로가기

스프링

[스프링부트] Junit5 설정 에러 모음

Gradle 설정으로 작성되었습니다.

 

Test 실행 시 Junit4 와 Junit5가 충돌할 때

 

Caused by: org.junit.platform.commons.JUnitException: Failed to parse version of junit:junit: 4.13.2

Junit 5.72 버전 사용 시 @Test ( import org.junit.jupiter.api.Test ) 가 적용이 안되는 에러

> Junit.5.63 버전으로 다운그레이드하면 해결

TestEngine with ID 'junit-vintage' failed to discover tests - JUnitException:

 

TestEngine with ID 'junit-vintage' failed to discover tests - JUnitException: Failed to parse version of junit:junit: 4.13.2

I'm having a very weird issue with my Gradle config and JUnit, I have tried updating to 5.7+ but I'm getting the following exceptions: org/junit/jupiter/api/extension/ScriptEvaluationException jav...

stackoverflow.com

 

org.springframework.beans.factory.support.BeanDefinitionOverrideException:
 Invalid bean definition with name 'localeResolver' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: 
Cannot register bean definition [Root bean: class [null]; 
scope=; 

Junit으로 테스트 시 application.properties 혹은 application.yml 파일에 프로필 구분이 되어 있을 시 

Test 클래스 에 @ActivateProfiles("dev") 을 붙여준다. dev 는 프로필 명이며 자유롭게 설정 가능합니다!

// properties 설정
spring.config.activate.on-profile=dev

// yml 설정
spring:
  profiles: dev

 

 

 

'스프링' 카테고리의 다른 글

스프링 시큐리티 UserDetailsService 설정  (0) 2022.09.28