spring-projects / spring-projects/spring-modulith

Parameters present in `@SpringBootTest` missing in `@ApplicationModuleTest`

Open
#890 2 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Oct 22, 2024.

in: test support meta: waiting for feedback type: improvement
Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

@SpringBootTest (as of Spring Boot 3.4.0 M3) defines additional parameters not present in @ApplicationModuleTest: properties, useMainMethod, and args. I especially miss properties. For example, I use it to tell Flyway that it is okay to clean my database as part of the test lifecycle (spring.flyway.clean-disabled=true). While there are alternative methods to inject additional properties into the environment, for example, @DynamicPropertySource, the advantage of @SpringBootTest is its ease of use and that it is in a place where the properties are easy to find.

As an aside, I think it woul be great if @SpringBootTest and @ApplicationModuleTest could be separated or a separate annotation would be introduced that I could slap onto a normal @SpringBootTest or any other slice test. That would provide me the missing parameters of @SpringBootTest and allow me to use Modulith's testing facilities in any slice test (like @JooqTest).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.