Test data generation patterns in DTM Data Generator

This article describes the new great feature of DTM Data Generator: a built-in pattern language. All data generators work fine while you need to create standard data without complex relationships or dependencies. DTM Data Generator can recognize and use master-detail relationships and a few kinds of check constraints. However, a complex internal value structure requires manual definition in the data generation rule.

The built-in pattern language is a new variation of the mask fill method that is well known to all users of the product. In most cases, old masks are back-compatible with the new engine. To use the new feature, just select the "Pattern" fill method from the drop-down menu in the rule editor.

The main goal of this article is to provide a few use cases and examples for the new pattern-based data generation language. There are two groups of examples: one value and with value-to-value dependencies. It is impossible to generate all the mentioned samples without the new engine.

DTM Data Generator: by pattern fill method for data generation

Random date between one and two years after today.

$$($Today()+365+$Rint(0,356))
This example shows usage of the following features: expression $$ and two built-in functions ("Today" and "RInt").

Value with Internal Structure

Sequence of optional '+' or '-' symbol, random number between 100 and 500, ':' symbol and random number less 1000, ':' symbol and copy of the first random number.
[<+|->]$Rint(100,500):$Rint(,1000):#
You can see optional part of the pattern [], list of values <>, reference to block(#) and "Rint" built-in function in this example.

Realistic E-mail Address

[$Lib(MaleFirstNames).]$Lib(LastNames)\@$Lib(Companies,Domain)
This example demonstrates value library usage and reserved symbol '@' quotation by '\' sign.

Column-to-Column Dependencies

Table has 3 columns F1, F2 and F3. Columns F2 must be equal F1 or greater than for 1 or 2. The last column F3 must me sum of F1 and F2.
Pattern for F2: $$(@'F1'+$Rint(0,2))
Pattern for F3: $$(@'F1'+@'F2')
'@' sing in these expressions means link to another column value. Other parts of both patterns were used before.

Previous Line Reference

In the same table F2 must be equal difference between previous column value and F1 value.
$$(@@'F2'-@'F1')
'@@' refers to previous row value. Other parts are clear, we guess.

See Also