Home > Net >  Is there a correlation between Spring Boot Junit 5 unit tests?
Is there a correlation between Spring Boot Junit 5 unit tests?

Time:02-10

My project has three test packages: post, security, and user.

In the current situation, if you run all the tests at the same time, there is a NoSuchBean error in both the TokenProviderTest and the JwtServiceTest.

but

  1. If you test the security package separately,
  2. In the case of annotating all UserRepositoryTests and testing them in full,
  3. If you change the CustomUserDetailsServiceTest written in Mock to @DataJpaTest and @ComponentScan, it will run normally.

As far as I know in my head, each test class runs without affecting other tests like a separate server, but I have no idea what factors affect each other, so I ask you this question.

I'd appreciate it if you could answer.

CodePudding user response:

  •  Tags:  
  • Related