본문 바로가기
Tools/intellij

JUnit4 테스트시 오류 Execution failed for task ':test'.

by 바람냄새 2023. 9. 12.

기본으로 셋팅되는 JUnit5 대신 JUnit4를 사용해야 하는 경우 였다.

 

intellij 에서 Junit 테스트 시 아래와 같이 오류 발생.

Execution failed for task ':test'.
> No tests found for given includes: [com.book.jpa.MemberRepositoryTest.testMember](--tests filter)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 682ms
4 actionable tasks: 1 executed, 3 up-to-date

 

아래와 같이 인텔리제이 수정.

Test.java 의 import 수정

import org.junit.jupiter.api.Test;

 

build.gradle 에 dependencies 에 아래 항목 추가

  //JUnit4 추가 
  testImplementation("org.junit.vintage:junit-vintage-engine") {
      exclude group: "org.hamcrest", module: "hamcrest-core"
  }

 

 

 

참고 글:

https://www.inflearn.com/questions/15495/%ED%85%8C%EC%8A%A4%ED%8A%B8-%EB%8F%84%EC%A4%91-%EC%97%90%EB%9F%AC-%EB%B0%9C%EC%83%9D

 

테스트 도중 에러 발생 - 인프런 | 질문 & 답변

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':test'.> No tests found for given includes: [jpabook.jpashop.Mem...

www.inflearn.com