Skip to content

@DirtiesContext is required on every test #759

@Bwvolleyball

Description

@Bwvolleyball

The context

The need for @DirtiesContext on all unit tests using a grpc service created by this starter greatly slows down tests, and doesn't feel like a proper solution as applications scale.

The bug

What's the problem? What's not working? What do you expect to happen.

all @SpringBootTest classes also require @DirtiesContext in order for tests across the application to function propertly.

Is there a stacktrace or a hint in the logs? (very important)
Screenshots work as well, but don't screenshot your logs.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create an application using gRPC services.
  2. Write 2 or more @SpringBootTest classes
  3. Run your project's tests. These test classes will compete and your tests will fail.

Workaround, add @DirtiesContext to each test, but, this greatly slows down execution time of your application tests.

The application's environment

Which versions do you use?

  • Spring (boot):
  • grpc-java:
  • grpc-spring-boot-starter:
  • java: version + architecture (64bit?)
  • Other relevant libraries...

These versions don't really matter - it's a core issue with this library that is seemingly well documented, but there has to be a better way?

Additional context

  • Did it ever work before?

No

  • Do you have a demo?

No, but this issue is seemingly well documented with this project, but @DirtiesContext feels like a workaround instead of a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as expectedenhancementA feature request or improvementhelp wantedRequesting external help

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions