Home > database >  JUnit dependency vs Spring boot starter test dependency
JUnit dependency vs Spring boot starter test dependency

Time:05-14

For the testing part of an REST API. Was looking at the dependencies that you can use in spring boot. I saw that there is the JUnit dependency and the Spring boot starter test dependency.

What is the difference between the JUnit dependency and the Spring boot starter test dependency?

CodePudding user response:

The quick answer:

JUnit, all you need to do for Unit testing. Think of the asserts (but only these) and the JUnit test runner.

Spring Boot Starter Test, think everything you need to run tests where a Spring Context is needed. (Anything where you use @SpringBootTest @Autowired)

What more does the Spring Boot Starter provide?

  • Mockito
  • Jsonassert

See the full list of compiled dependencies here.

  • Related