Class BatchResultManager
- java.lang.Object
-
- com.testomatio.reporter.core.batch.BatchResultManager
-
public class BatchResultManager extends Object
Manages batch processing of test results for efficient API reporting. Collects test results in batches and periodically flushes them to Testomat.io. Provides automatic retry mechanism and graceful shutdown handling.
-
-
Constructor Summary
Constructors Constructor Description BatchResultManager(ApiInterface apiClient, String runUid)Creates batch result manager with configurable settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResult(TestResult result)Adds test result to pending batch for reporting.voidflushPendingResults()Immediately flushes all pending test results to API.voidshutdown()Gracefully shuts down batch result manager.
-
-
-
Constructor Detail
-
BatchResultManager
public BatchResultManager(ApiInterface apiClient, String runUid)
Creates batch result manager with configurable settings. Initializes batch size and flush interval from properties with fallback to defaults. Starts background scheduler for automatic periodic flushing.- Parameters:
apiClient- API client for reporting test resultsrunUid- unique identifier of the test run- Throws:
NumberFormatException- if batch size or flush interval properties are invalid
-
-
Method Detail
-
addResult
public void addResult(TestResult result)
Adds test result to pending batch for reporting. Automatically flushes batch when size limit is reached. Thread-safe operation for concurrent test execution.- Parameters:
result- test result to add to batch
-
flushPendingResults
public void flushPendingResults()
Immediately flushes all pending test results to API. Thread-safe operation that can be called concurrently.
-
shutdown
public void shutdown()
Gracefully shuts down batch result manager. Flushes remaining results, stops scheduler, and reports any failures. Should be called when test execution completes.
-
-