2021年2月6日星期六

Spring batch Job executes before tests

I have a Spring batch job that works but as I work on it, I find that the job runs before my unit tests. When running the maven install from Eclipse/STS, it compiles the code and the executes the job and then runs the tests. It is not a problem once I understood that the job was going to stick records in the in-memory database BEFORE the tests ran so that the tests could not assume a clean database at the start of the first test.

I gather that this happens because the job is defined in a @Configuration file along with its steps and processors.

Is there a way to build the project and run the tests without running the whole job?

https://stackoverflow.com/questions/66084164/spring-batch-job-executes-before-tests February 07, 2021 at 11:03AM

没有评论:

发表评论