spring-projects / spring-projects/spring-batch
How retrieve the Retry/Skipped data for Testing purposes [BATCH-2629]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Manuel Jordan opened BATCH-2629 and commented
For Testing purposes I can do the following in peace (in general)
assertThat(jobExecution.getExitStatus().getExitCode(), is("COMPLETED"));
assertThat(jobExecution.getAllFailureExceptions().size(), is(0));
assertThat(jobExecution.getFailureExceptions().size(), is(0));
or
assertThat(jobExecution.getExitStatus().getExitCode(), is("FAILED"));
assertThat(jobExecution.getAllFailureExceptions().size(), is(1));
assertThat(jobExecution.getAllFailureExceptions().get(0).getClass().getSimpleName(),
is(SkipLimitExceededException.class.getSimpleName()));
assertThat(jobExecution.getAllFailureExceptions().get(0).getMessage(),
is("Skip limit of '5' exceeded"));
assertThat(jobExecution.getFailureExceptions().size(), is(0));
Seems the API does not provide a way to extract detailed data about Retry and Skip information.
For example: for the Steps X, Y, Z (for each one or individually) how many retries were applied and for what row, same appreciation for Skip. Same about (Retry and Skip) but through a global report from the Steps X,Y,Z. Of course if the Job has one Step, the global is the same than the individual
The listeners works fine only for report purposes and their methods return void. Not sure if the current API and Spring Batch db schema support it for testing.
Thank you.
Affects: 3.0.6, 3.0.7
Reference URL: https://stackoverflow.com/questions/44574473/spring-batch-how-retrieve-the-skipped-exceptions-for-testing-purposes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the JobExecution API, listener behavior, and Spring Batch database schema mentioned in the issue. Determine whether retry and skip details can be retrieved per step and globally for testing, including counts and affected rows or exceptions; done means the supported API and expected test assertions are clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100