Testing
In general, testing for Kio based on the same approach as for Beam, so before starting take a look at Beam’s testing documentation.
To create a test for your pipeline it’s needed to add the kio-test
module as a dependency and use ru.chermenin.kio.test.KioPipelineTest
as the base class. This class has already defined context as the kio
property.
Also, there is the following methods to get assertion instances from any collection:
PCollection<T>
Method | Description |
---|---|
that(reason) ↪️ PAssert.IterableAssert<T> | Returns an iterable assert for the elements of the provided collection. Arguments: · reason - optional reason for the assertion |
thatSingleton(reason) ↪️ PAssert.SingletonAssert<T> | Returns a singleton assert for the value of the provided collection, which must be a singleton. Arguments: · reason - optional reason for the assertion |
PCollection<Iterable<T>>
Method | Description |
---|---|
thatSingletonIterable(reason) ↪️ PAssert.IterableAssert<T> | Returns an iterable assert for the value of the provided collection, which must contain a single iterable value. Arguments: · reason - optional reason for the assertion |
PCollection<KV<K, V>>
Method | Description |
---|---|
thatMap(reason) ↪️ PAssert.SingletonAssert<Map<K, V>> | Returns a singleton assert for the value of the provided collection, which must have at most one value per key. Arguments: · reason - optional reason for the assertion |
thatMultiMap(reason) ↪️ PAssert.SingletonAssert<Map<K, Iterable<V>>> | Returns a singleton assert for the value of the provided collection. Arguments: · reason - optional reason for the assertion |