hmrclt / stub-data-generator

Deterministically produce dummy data for use in stubs

GitHub

Smart Stub Generator (a.k.a. The Font of Infinite Nonsense)

Maven Central

smart-stub-generator is a tool to create data for testing. It is intended for use within HMRC to help the 'stub' services — microservices that mimic the interfaces of production backend systems.

The data the generator produces is intended to be plausible but fake eliminating the need to either manually craft test records or take real records and anonymize them. For example when generating names, the names will look real rather than random strings.

The library is built for use within Scala Play 2.5 application controllers, but can be used as easily on the REPL or backed by a RDBMS.

SBT Project Setup

1. Add the following to build.sbt:

addSbtPlugin("uk.gov.hmrc" %% "stub-data-generator" % "X.X.X")

Documentation

  1. Using ScalaCheck to generate data
  2. Procedurally generating data
  3. Composing data
  4. Enumerations and Patterns
  5. Mutable Data
  6. Simple Usage