Код: Выделить всё
tasks.named('test') {
useJUnitPlatform()
}
< /code>
Если я запускаю эту задачу непосредственно из Intellij Idea, тест проходит. Разница в выводе, которую я обнаружил, была < /p>
Запуск из командной строки < /p>
[Test worker] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [MyTest]: MyTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
[Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration MySpringApp for test class MyTest
< /code>
из Idea < /p>
org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [MyTest]: MyTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
[Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration MySpringApp for test class MyTest
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.3.6)
[Test worker] INFO MyTest - Starting MyTest using Java 17.0.13 with PID 92499 (started by --)
[Test worker] INFO MyTest - No active profile set, falling back to 1 default profile: "default"
[Test worker] INFO org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver - Exposing 0 endpoints beneath base path '/actuator'
[Test worker] INFO org.springframework.boot.test.mock.web.SpringBootMockServletContext - Initializing Spring TestDispatcherServlet ''
[Test worker] INFO org.springframework.test.web.servlet.TestDispatcherServlet - Initializing Servlet ''
[Test worker] INFO org.springframework.test.web.servlet.TestDispatcherServlet - Completed initialization in 1 ms
buildmode в Gradle устанавливается на локальный .
Цените любые указатели
Подробнее здесь: https://stackoverflow.com/questions/797 ... herservlet