0
我有一個運行兩個步驟的單個作業的spring批處理應用程序。我希望能夠單獨測試每一步,而無需運行其他步驟。這可能嗎?我的代碼如下:如何測試Spring Batch中的單個步驟而不運行其他?
@Bean
public Job job() throws Exception {
return jobs.get("job")
.incrementer(new RunIdIncrementer())
.listener(new JobCompletionNotificationListener())
.start(A)
.next(B)
.build();
}
@Test
public void testStepA() {
JobExecution execution = launcher.launchStep("A");
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
}
但是,當我運行上面的測試它本質上啓動並運行我的整個工作從前到後。