Bloomer Mock

Bloomer mock provides advanced features to generate data in highly controlled way. For most use-cases simple data generation is sufficient, but for complex data generation advanced features are required.

Few advance features that bloomer mock provides are -

  1. Null and Empty Fields

  2. Custom attribute values

  3. Javascript generation

Null and Empty Fields

With Null and Empty percentage parameters you can control number of values to be empty or null for selected attribute.

Null - null are placed for percentage defined in attribute
Empty - Attributes with percentage defined will have empty values

Example 1. Null and Empty Fields
  • Click on more icon for selected attribute

  • In null and empty text let’s define null percentage - 10% and empty percentage - 20%

NullEmptyPercentage
Figure 1. Set Null And Empty Percentage
  • In preview 10 records are shown.
    Out of 10, 1 record will have null value and 2 records will have empty value.

Preview
[
  {},
  {
    "age": 2
  },
  {},
  {
    "age": 4
  },
  {
    "age": 5
  },
  {
    "age": null
  },
  {
    "age": 7
  },
  {
    "age": 8
  },
  {
    "age": 9
  },
  {
    "age": 10
  }
]

In above preview we can see 1 null value and 2 empty values for age attribute.

Custom Attribute Values

User can provide custom list of values for an attribute. Depend on data type different control is given to user. Custom attribute section can be opened by clicking more icon associated with each attribute.

Custom Values - String data type

For string data type user can provide custom list of values. To add values to custom list type values in Override Attributes text box.

Example 2. For city attribute user can provide list of cities.
  1. Click on more icon for the selected attribute

  2. Provide custom values in Override Attributes text box

  3. Click on Save

  4. Preview pane should show the preview that has custom values

Custom Values
Figure 2. Add Custom Values
Tip

Values from Generate AI can be used to populate custom list.

Example 3. For city attribute add list of cities generated by Gen AI
  1. Click on value selection textbox for the selected attribute

  2. Click on robot icon in the top search bar

  3. In search bar type cities in India

  4. Click on Select to select generated values

  5. Above generated values are added to override values section

  6. To go to override values click on more icon

  7. In Override Attributes section add or remove any values from generated list

  8. Click on Save

GenAI: Cities India
Figure 3. Generative AI : Search cities in india
GenAI: Cities India
Figure 4. Add or remove values in AI generated list

Custom Values - Number data type

For number data type one can define minimum value, maximum value and number of decimal digits.

Minimum value should be always less than maximum value, otherwise validation will fail. In case just minimum value is provided then maximum is set to +infinity and similarly if only maximum value is provided then minimum is set to -infinity.

Example 4. For age attribute user can provide range of values.
  • Click on more icon for the selected attribute

  • In custom values section provide minimum value - 10, maximum value - 20 and decimal digits - 3

GenAI: Cities India
Figure 5. Min-Max value for age attribute
  • Click on Save

  • Preview pane should show the preview for age attribute value between 10 - 20.

Preview
[
  {
    "name": "Diego Rivera",
    "age": 10.327
  },
  {
    "name": "Klimt",
    "age": 11.337
  },
  {
    "name": "Diego Rivera",
    "age": 17.576
  },
  {
    "name": "Botticelli",
    "age": 10.077
  },
  {
    "name": "Vettriano",
    "age": 11.652
  },
  {
    "name": "Diego Rivera",
    "age": 10.025
  },
  {
    "name": "Durer",
    "age": 19.844
  },
  {
    "name": "Paul Klee",
    "age": 17.408
  },
  {
    "name": "Titian",
    "age": 16.702
  },
  {
    "name": "Rembrandt",
    "age": 19.535
  }
]

Javascript Generation

Out of all javascript generation is the most advanced feature provided by bloomer mock. Javascript generation allow user to give most flexibility in terms of defining the attribute value.
In javascript generation feature user can use any javascript native functions to define and modify the attribute value.
With javascript user can perform advanced operations like string manipulation, date manipulation, number manipulation etc.

Tip

Use case such as performing UpperCase, LowerCase, Date generation and data modification can be achieved using javascript generation.

There are 2 mode to define or modify output -

  1. Generate list of custom attribute value : In this mode user can define list of values for the attribute. To enable this mode uncheck Apply per row.
    Attribute value will be chosen randomly from the list of value output from the function.

  2. Generate attribute value per row : In this mode user can define function that will be applied to each row value. To enable this mode check Apply per row.
    Function will be applied to each row and output will be generated.
    This mode is helpful in case you want to modify output of existing attribute value such as doing upper case, lower case etc.

Note

To use attribute value from predefined list of attributes use #{} placeholder.
From drop down select attribute that you want to use.

Generate List of custom attribute value

This is default mode for javascript generation. Output of generate function must be list of values which is used as attribute values.

Note

Javascript is executed once and result is stored in cache and used for attribute value.

Generate upper case value of first_name
function generate() {
  return #{name.first_name}
       .map(value => value.toUpperCase());
}

Output :
[
  {
    "name": "ROSALINA"
  },
  {
    "name": "LURLINE"
  },
  {
    "name": "KRYSTLE"
  },
  {
    "name": "LEONARDO"
  },
  {
    "name": "THORA"
  },
  {
    "name": "JOYE"
  },
  {
    "name": "VALERY"
  },
  {
    "name": "RANDY"
  },
  {
    "name": "BERNIE"
  },
  {
    "name": "MELDA"
  }
]
PerRowGeneration
Figure 6. Main Screen : Generate upper case value of name
PerRowGeneration
Figure 7. JS Screen : Generate upper case value of name

Generate or Modify Attribute value per row

To modify or replace selected attribute output value, per row javascript function should be used. Per row function has value as input which is attribute value in output data, you can manipulate the value or replace it using javascript.

Generate upper case value of capital_city
function generate(value) {
  return value.toUpperCase();
}

Output :
[
  {
    "capital_city": "ACCRA"
  },
  {
    "capital_city": "NUKU'ALOFA"
  },
  {
    "capital_city": "PRAGUE"
  },
  {
    "capital_city": "BEIRUT"
  },
  {
    "capital_city": "VIENTIANE"
  },
  {
    "capital_city": "NASSAU"
  },
  {
    "capital_city": "ADDIS ABABA"
  },
  {
    "capital_city": "RABAT"
  },
  {
    "capital_city": "ANKARA"
  },
  {
    "capital_city": "NAIROBI"
  }
]
PerRowGeneration
Figure 8. Main Screen : Generate upper case value of capital_city
PerRowGenerationJs
Figure 9. JS Screen : Generate upper case value of capital_city