Ranger – contextual data generator

Category
Open source

What is it?

Ranger is a contextual data generator used to make sensible data for integration tests or to play with it in the database.

Ranger is a Java open-source library that allows developers to quickly and in a simple manner define and create a large number of objects whose attributes have randomly selected values from the configured set.

Two main purposes of Ranger are:

  • Create unit and integration test data based on defined rules
  • The data source for Berserker

Ranger can be also used as a data source for a custom tool of your choice.

How does it work?

Ranger builds a tree of dependent value generators based on user configuration (either Java API or YAML configuration). Then it uses that tree to construct a map with generated values. If the type is not specified by the builder or configuration parser, Map<String, Object> is the return type. If the type is specified, the Jackson library is used to convert the map to the specified type. All rules and limitations of Jackson apply here also.

Why use it?

Totally random test data is not so useful:

Random users table

  • It is hard to make it by certain rules
  • It is hard to reason about it
  • It does not reflect production data values nor distribution

What we can do is use a contextual data generator and create users whose attribute values make sense in the domain context. We can also say, for example, that 70% of created users should be females. The table will then look like this:

Context users table

Let’s get started.

Tell us what you’re working on, we’ll answer right away.

Other success stories

See all stories→
Email sentiment analysis
User projects

Email sentiment analysis

Read post →
Churn of business customers
User projects

Churn of business customers

Read post →
FAQ chatbot with back-office
User projects

FAQ chatbot with back-office

Read post →
Search ranking for a large-scale job platform
User projects

Search ranking for a large-scale job platform

Read post →