Skip to content

Multiple Job unit testing with @SpringBatchTest #3699

Closed
@tiparega

Description

@tiparega

Hi all,

From documentation, it seems impossible to unit test a Spring Batch with more than one job, problem is JobLauncherTestUtils autowiring the Job. This can be resolved as in #1237 but, as docs state to use @SpringBatchTest (#889), a default JobLauncherTestUtils bean is created in BatchTestContextCustomizer so, even if you don't use any JobLauncherTestUtils at all, it tries to create one and fails on no single Job bean.

Not sure if this has a simple resolution, may be deleting autowired Job in JobLauncherTestUtils, or allowing some kind of @SpringBatchTest customization, but I think that it could be, at least, mentioned in unit testing docs, so to not use @SpringBatchTest annotation if you have more than one Job bean.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions