spring-projects / spring-projects/spring-batch

How retrieve the Retry/Skipped data for Testing purposes [BATCH-2629]

Open
#976 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-reporter status: waiting-for-triage type: feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.