기본으로 셋팅되는 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"
}
참고 글: