Why does Intellij IDEA suddenly not recognize tests in test folder anymore?
OK, I fixed it.
In menu, under File, there is an invalidate cache option. That fixed it!
Running a unit test after changing it does not run the updated test in IntelliJ
In Run Configuration, add Build Project so that it picks up latest changes
How do I make IntelliJ IDEA run all the tests in a package including sub packages
The default key combination to run all tests is Ctrl+Shift+F10
IntelliJ does not refresh Spring autoconfigurations in multi-module tests when running all tests
Answering my own question for posterity. This is a partial answer that assumes that all your modules share the same root package. In my case, all the modules share a.b.c
where the first module's package is a.b.c.first
, the second module is a.b.c.second
and so on. If you have a better solution I'll happily change the accepted answer.
The problem, as suspected, is how you define the test configuration. Since this is a multi-module project, and I want all the tests to run, there are two ways of defining it:
The problematic way: Defining a pattern on the entire project. This solution is described in this StackOverflow answer.
Running this configuration will cause the problems described in the question - unrelated auto-configurations of dependencies the module doesn't have will start to fail and therefore the tests will fail as well.
The way that works: This way works under the said assumption that all modules share the same package. Create a new Run Configuration as follows:
- Test kind: All in package
- Package: The share root package of all your modules, e.g.
a.b.c
in the example I gave in the beginning of this answer. - Search for tests: In whole project
This will run all your tests with the correct auto-configurations.
Related Topics
Spring Boot Search Data Between Two Dates
Illegal Character When Trying to Compile Java Code
How to Make a Multipart/Form-Data Post Request Using Java
How to Call Methods Simultaneously in Java
Enter Array Without Knowing Its Size
Java: How to Check If Object Is Null
How to Test Code Dependent on Environment Variables Using Junit
How to Check Json in Response Body With Mockmvc
Java Coding Converted to Pseudo Code
Java Socket Api: How to Tell If a Connection Has Been Closed
Null Pointer on an Autowired Bean Which Is Not Mocked by Mockito
Spring Rest - Create Zip File and Send It to the Client
How to Replace Every N-Th Character X from an String
Alternative to Switch Case in Java
How to Set a Description and an Example in Swagger With Swagger Annotations