Skip to content

fix: keep reporting when a test parameter cannot be serialized - #157

Open
nelson-q wants to merge 1 commit into
testomatio:1.xfrom
nelson-q:fix/non-serializable-test-parameters
Open

nelson-q wants to merge 1 commit into
testomatio:1.xfrom
nelson-q:fix/non-serializable-test-parameters

Conversation

@nelson-q

Copy link
Copy Markdown

Fixes #156

Problem

A parameterized test whose parameter cannot be serialized by Jackson (a protobuf message, an object with a cyclic getter) fails the whole batch request. TestomatioClient rethrows it as ReportingFailedException, BatchResultManager.sendBatch catches only IOException, and the exception cancels the fixed-rate flush task. From that moment no results are reported until the end of the run, and the final flush in shutdown() fails the same way. The run ends up with a few results, status passed, and no failures.

The same happens on any other error in reportTest / reportTests, including a transient network error, because the client wraps every exception into a RuntimeException.

Changes

  • NativeRequestBodyBuilder: example values are converted with valueToTree; a value that cannot be serialized is reported as String.valueOf(value). Serializable values are reported exactly as before.
  • BatchResultManager.sendBatch: runtime exceptions go through the existing retry / failedResults path instead of escaping the scheduled task.

Tests

  • NativeRequestBodyBuilderTest: a batch with a self-referencing parameter is built, the parameter is reported as a string, other values and other tests of the batch are intact.
  • BatchResultManagerTest: after a ReportingFailedException the next flush still reports results.

Both tests fail on 1.x without the change. mvn test in java-reporter-core: 394 tests pass, Checkstyle is clean. The other modules were not built locally.

🤖 Generated with Claude Code

A parameterized test whose parameter Jackson cannot serialize (a protobuf
message, an object with a cyclic getter) failed the whole batch request.
The client rethrows it as a RuntimeException, sendBatch caught only
IOException, and the exception cancelled the fixed-rate flush task, so no
results were reported for the rest of the run.

- NativeRequestBodyBuilder: example values are converted with valueToTree
  and fall back to String.valueOf when they cannot be serialized
- BatchResultManager: runtime exceptions go through the existing retry and
  failedResults path instead of escaping the scheduled task

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One non-serializable test parameter stops result reporting for the rest of the run (TestNG, 0.19.2)

1 participant