Data format validation
Before you can apply specific business rules to a field, you must confirm that the data format is valid.
For example, you cannot test whether an expense lies within allowed limits until you determine that the field contains a valid currency value.
The business requirements of the application specify valid formats for all of the fields that your application is testing. The following examples describe the values of three acceptable currencies as defined by the business requirements for the TravelDocs application.
- $477.82
- 824.83
- 254.40 USD
The Validations actions library includes several actions that test the format of a field, including.
| Library | Action | Description |
|---|---|---|
| Validations | IsFieldCurrency | Returns True if the field is a number and includes a two-digit decimal amount. Returns False otherwise. The action ignores any leading currency symbol (for example, $). |
| Validations | IsFieldDate | Returns True if the field is in one of the supported date formats; returns False otherwise. |
| Validations | IsFieldLengthMax | Returns True if the field contains no more than the specified number of characters; returns False otherwise. |
| Validations | IsFieldLengthMin | Returns True if the field contains at least the specified number of characters; returns False otherwise. |
| Validations | IsFieldPercentAlpha | Returns True if the field contains no numbers or special characters; returns False otherwise. |
| Validations | IsFieldPercentNumeric | Returns True if the field contains no letters or special characters; returns False otherwise. |
For detailed information on these and other actions in the Validations library, select the action on the Actions Library tab and click Display information.