Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpringRunner dependency Class couldn't be located

I couldn't find which jar will provide me the dependency of SpringRunner.class

I am trying to upgrade my Integration tests to spring-boot 1.4.0

like image 469
Sagar Avatar asked Aug 02 '26 06:08

Sagar


2 Answers

SpringRunner.java is located in the spring-test-4.3.2.RELEASE.jar file.

In order to use it in a Maven or Gradle project, you should declare a dependency on org.springframework.boot:spring-boot-starter-test.

Here are the libraries that org.springframework.boot:spring-boot-starter-test depends on:

+--- org.springframework.boot:spring-boot-starter-test: -> 1.4.0.RELEASE
|    +--- org.springframework.boot:spring-boot-test:1.4.0.RELEASE
|    |    \--- org.springframework.boot:spring-boot:1.4.0.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-test-autoconfigure:1.4.0.RELEASE
|    |    +--- org.springframework.boot:spring-boot-test:1.4.0.RELEASE (*)
|    |    \--- org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE (*)
|    +--- com.jayway.jsonpath:json-path:2.2.0
|    |    +--- net.minidev:json-smart:2.2.1
|    |    |    \--- net.minidev:accessors-smart:1.1
|    |    |         \--- org.ow2.asm:asm:5.0.3
|    |    \--- org.slf4j:slf4j-api:1.7.16 -> 1.7.19
|    +--- junit:junit:4.12
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- org.assertj:assertj-core:2.5.0 -> 2.4.1
|    +--- org.mockito:mockito-core:1.10.19
|    |    +--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    |    \--- org.objenesis:objenesis:2.1 -> 2.2
|    +--- org.hamcrest:hamcrest-core:1.3
|    +--- org.hamcrest:hamcrest-library:1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- org.skyscreamer:jsonassert:1.3.0
|    |    \--- org.json:json:20090211 -> 20140107
|    +--- org.springframework:spring-core:4.3.2.RELEASE
|    \--- org.springframework:spring-test:4.3.2.RELEASE
|         \--- org.springframework:spring-core:4.3.2.RELEASE

SpringRunner.java

like image 163
Behrang Avatar answered Aug 03 '26 22:08

Behrang


Try manually adding this import:

import org.springframework.test.context.junit4.SpringRunner;

like image 33
Mark Mueller Avatar answered Aug 03 '26 21:08

Mark Mueller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!