Class Shard

java.lang.Object
org.citrusframework.sharding.Shard

public final class Shard extends Object
A utility class for implementing sharded test loading and execution, additionally to traditional test loading. It enhances the citrus framework with the ability to divide test cases into shards. Their loading and execution is still managed by the traditional test loaders and executors.

This class is part of the Citrus framework, designed to streamline the process of sharding test cases for efficient and scalable testing.

Configuration happens via environment variables. See ShardingConfiguration for more information.

See Also:
  • Method Details

    • createShard

      public static <T> T[] createShard(T[] testCases)
      Creates a sharded stream from the input array using the default sharding configuration.
      Type Parameters:
      T - The type of elements in the stream.
      Parameters:
      testCases - The input array to be sharded.
      Returns:
      A sharded stream based on the default sharding configuration.
    • createShard

      public static <T> T[] createShard(T[] testCases, ShardingConfiguration shardingConfiguration)
    • createShard

      public static <T> Stream<T> createShard(Stream<T> testCases)
      Creates a sharded stream from the input stream using the default sharding configuration. Note that the initial stream will be terminated!
      Type Parameters:
      T - The type of elements in the stream.
      Parameters:
      testCases - The input stream to be sharded.
      Returns:
      A sharded stream based on the default sharding configuration.
    • createShard

      public static <T> Stream<T> createShard(Stream<T> testCases, ShardingConfiguration shardingConfiguration)
      Creates a sharded stream from the input stream using the provided sharding configuration. Note that the initial stream will be terminated!
      Type Parameters:
      T - The type of elements in the stream.
      Parameters:
      testCases - The input stream to be sharded.
      shardingConfiguration - The configuration for sharding.
      Returns:
      A sharded stream based on the provided sharding configuration.
    • createShard

      public static <T> Stream<T> createShard(Stream<T> testCases, ShardingConfiguration shardingConfiguration, boolean parallel)
      Creates a sharded stream from the input stream using the provided sharding configuration and a flag to determine whether the stream should be parallel. Note that the initial stream will be terminated!
      Type Parameters:
      T - The type of elements in the stream.
      Parameters:
      testCases - The input stream to be sharded.
      shardingConfiguration - The configuration for sharding.
      parallel - A flag indicating whether the resulting stream should be parallel.
      Returns:
      A sharded stream based on the provided sharding configuration.