Repository navigation
Unit testing #5501
|
I was reading the testing documentation and I find that it could be useful if you can give me some advice on how to write unit and integration test of a Spring Batch application. |
Replies: 1 comment 1 reply
|
Hi @NicoPolazzi, in my experience, pure JUnit tests are usually enough for unit tests without needing any test utility from the Spring projects. See also this Spring Boot blog post, which mentions:
Here the emphasis is on Spring components, but I find the same advice applicable to Spring Batch elements as well, such as a custom Regarding integration tests, here is an example that is close enough to how I generally test Spring Batch in real-world Spring Boot applications. The main point is disabling the automated job startup logic of Spring Boot via the
If I recall correctly, the documentation intentionally avoids mentioning Spring Boot, which is why only the Spring Framework's However, nowadays it might be quite rare to use Spring Batch without Spring Boot, but that's just my personal opinion. |
Hi @NicoPolazzi, in my experience, pure JUnit tests are usually enough for unit tests without needing any test utility from the Spring projects. See also this Spring Boot blog post, which mentions: