Skip to content

RAW - RANDOM

Description

The RANDOM validator introduces a 20% chance of throwing a violation for any data item. This validator is designed to simulate random validation failures, which can be useful for testing the robustness of systems or processes against unexpected validation outcomes. It accepts all data types, including strings, numbers, and binary large objects (BLOBs).


Supported Data Types

The RANDOM validator supports all data types, including:

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

Config Location

The configuration for the RANDOM validator is defined within the <rawDPValidator> element of a schema data point. This section is crucial for specifying the logic that the validator will execute to determine if the data item meets the specified criteria.


Config Requirements

For the RANDOM validator, the <config> element is not required. This means that the validator can be applied directly to any data type without the need for additional configuration parameters.


Example Config

Below is an example of a RANDOM raw validator configuration. This validator gives a 20% chance of throwing a violation for the data item named "ITEM".

1
2
3
4
5
<dataPoint name="ITEM" dataType="STRING">
    <rawDPValidators>
        <rawDPValidator name="RANDOM_VIOLATION" execPriority="10" entity="RANDOM"/>
    </rawDPValidators>
</dataPoint>

Example Results

Consider a scenario where the RANDOM validator is applied to a data item named "ITEM" with a value of "Example". Since the RANDOM validator introduces a 20% chance of throwing a violation, there is a 20% probability that the validation will fail for this item, regardless of its value. This randomness can be useful for testing how systems or processes handle unexpected validation outcomes.


Common Mistakes

  • Remember that the RANDOM validator does not require a <config> element, so ensure that the validator is correctly applied to the data item without additional configuration.
  • Verify that the entity attribute of the <rawDPValidator> element is correctly set to "RANDOM" to apply the RANDOM validation logic.
  • Understand that the RANDOM validator's behavior is inherently unpredictable due to its random nature, which is by design for testing purposes.