public class StepResultCollectionUtils
extends java.lang.Object
Some utilities for when dealing with a collection of StepResult's. One of the most
notable is getFailedResult(Collection) which is an easy way to know if a set of test
steps completed without error.
| Constructor and Description |
|---|
StepResultCollectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<StepResult> |
getAllFailedResults(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures)
Looks through collection of futures looking for any
StepResult's that are in a failure
state. |
static StepResult |
getFailedResult(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures)
Looks through collection of futures looking for any
StepResult's that are in a failure
state. |
static double |
getRunTimeAverage(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures,
java.util.concurrent.TimeUnit timeUnit)
Calculates the average runtime per test step.
|
static java.util.Map<java.lang.Double,StepResult> |
getRunTimePercentiles(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures,
double... percentiles)
Sort through results to get step run time percentiles.
|
public static StepResult getFailedResult(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures) throws java.lang.InterruptedException
StepResult's that are in a failure
state. Once it finds the first one it returns it. If this was a parallel step, it is
possible there are additional failures not returned (it just returns the first failure it
finds). This call blocks until all the test steps have completed, and if none are in a
failure state, it will return null.futures - Future collection to iterate over and inspectnull if no failures occurredjava.lang.InterruptedException - Thrown if the thread is interrupted while waiting for StepResultpublic static java.util.List<StepResult> getAllFailedResults(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures) throws java.lang.InterruptedException
StepResult's that are in a failure
state. Unlike getFailedResult(Collection), which stops searching after it finds the
first failure, this will find ALL failed results. Thus ensuring that every test case has
finished before returning.futures - Future collection to iterate over and inspectjava.lang.InterruptedException - Thrown if the thread is interrupted while waiting for StepResultpublic static double getRunTimeAverage(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
futures - Future collection to iterate over and inspecttimeUnit - Time unit that the resulting time should be returned injava.lang.InterruptedException - Thrown if the thread is interrupted while waiting for StepResultpublic static java.util.Map<java.lang.Double,StepResult> getRunTimePercentiles(java.util.Collection<? extends java.util.concurrent.Future<? extends StepResult>> futures, double... percentiles) throws java.lang.InterruptedException
futures - Future collection to iterate over and inspectpercentiles - Percentile points requested, must be provided, must be between 0 and 100 (inclusive)java.lang.InterruptedException - Thrown if thread is interrupted while waiting for results to complete