Skip to content

CONSOLIDATED - RANDOM

Description

The RANDOM validator is designed for testing purposes, providing a 20% chance of violation for any field. This validator is particularly useful for simulating random validation failures in a controlled environment, helping developers and testers to understand how their systems handle unexpected validation errors. It supports all data types, including BLOBs, making it versatile for various data validation needs.


Config Location

To configure the RANDOM validator, you need to define it within the consDPValidators section of your data point configuration within the schema. This involves specifying the validator name and entity.


Supported Data Types

  • BLOB
  • Json
  • String
  • Boolean
  • Integer
  • Decimal
  • Double

Config Requirements

Config ({}) options are not required for the RANDOM validator. This validator is designed to perform a straightforward check with a 20% chance of violation without the need for additional configuration parameters.


Example Config

Below is an example of how to configure the RANDOM validator in XML format. This example demonstrates a validator that checks if the "QUANTITY" data point has a 20% chance of being violated.

1
2
3
4
5
<dataPoint name="QUANTITY" dataType="INTEGER">
    <consDPValidators>
        <consDPValidator name="VALIDATE_RANDOMLY" entity="RANDOM"/>
    </consDPValidators>
</dataPoint>

Example Result

Upon successful configuration and execution, the RANDOM validator will randomly decide whether to trigger a violation for the "QUANTITY" data point. This behavior is useful for testing how your system handles validation errors in a controlled manner.


Common Mistakes

  • Ensure that the validator name and entity are correctly defined in the configuration to ensure that the validator is correctly identified and applied during the data processing pipeline.
  • Remember that the RANDOM validator does not require any configuration. If you attempt to provide a <config> block, it will be ignored.