This project was created by a developer from Ukraine. Russia has invaded Ukraine and already killed tens of thousands of civilians, with many more raped or tortured. The death toll keeps climbing. It's a genocide. We need your help. Let's fight back against the Russian regime. Russia has invaded Ukraine and already killed tens of thousands of civilians, with many more raped or tortured. It's a genocide. We need your help. Help Ukraine Now

kotlin-faker: the ultimate fake data generation library for development and testing

Kotlin-faker is a comprehensive data-generation library for the JVM. It is most suitable for development, testing, and data anonymization purposes, and can be used with Kotlin, Java, Android, Scala, and other JVM-based projects. Kotlin-faker provides realistic-looking, fake data generation capabilities in various domains like names, addresses, internet, banking, books, games, and many more.

In fact, kotlin-faker is so good at generating fake data, it almost fooled us into thinking it was real! 🤯 From names that sound like they belong to secret agents🕴️, to addresses where superheroes 🦸‍♂️ and villains 🦹 might live.
Use kotlin-faker during development and testing to ensure your application data looks as if it was real, just like this really fake logo, but not quite so.

Kotlin-faker is a kotlin port of a popular ruby faker gem.

⚠️ P.S. All names, addresses, bank accounts, and other data generated by this library - even those based on real strings - are entirely fictional. All produced data is fake and generated... poorly. The data is completely made up, but the problems that it tries to solve are real. We take no responsibility for any existential crises caused by the eerily convincing fake data. Use with caution! ⚠️

Some of the bits that kotlin-faker gives you are…

…a plethora of real-looking data in various domains:

val faker = Faker()
Names // => Dr. John Abrams Smith
faker.address.streetAddress() // => 474 Kilback Manor
faker.internet.safeEmail() // => chance.marvin@yahoo.test
val faker = CommerceFaker() // => AACCGB21
val faker = BooksFaker() // => Fantasy
Movies and TV
val faker = MoviesFaker()
faker.starWars.characters() // => Darth Vader
val faker = TvShowsFaker()
faker.friends.characters() // => Phoebe Buffay
…and many others
// a total of 213 different data providers

…in 60 locales:

val config = fakerConfig { locale = "nb-NO" }
val faker = Faker(config)
nb_NO -> city // => Høyberg
nb_NO -> person‘s name // => Sofie Ødegård Løken

…“unique data generation”:

val faker = Faker()
Generate unique values within a domain
faker.unique.configuration {
    // enable generation of unique values for address data provider
val countries = List(100) { }
assertEquals(countries.distinct().size, 100)
Generate unique values within a function
val countries = List(100) { }
val cities = List(1000) { }
assertEquals(countries.distinct().size, 100)
assertTrue(cities.distinct().size < 1000)

…cli native app for looking up data generators:

faker-bot lookup name --verbose
#├── address
#│   ├── cityName() // => Port Olinstad
#│   ├── countryByName() // => NR
#│   └── streetName() // => Lance Roads
#├── animal
#│   └── name() // => gnat
#├── app
#│   └── name() // => Bamity
#├── artist
#│   └── names() // => Cezanne
#├── bank
#├── beer
#│   └── name() // => Oaked Arrogant Bastard Ale
# rest of output that matches query

…and more:

val faker = Faker()
Random instance of any class…
class Foo(val a: String)
class Bar(val foo: Foo)

val foo: Foo = faker.randomClass.randomClassInstance()
val bar: Bar = faker.randomClass.randomClassInstance()
…with pre-configured type generation
class Baz(val id: Int, val uuid: UUID, val username: String)

val baz: Baz = faker.randomClass.randomClassInstance {
    // ヽ(^o^)丿 ᕕ(ᐛ)ᕗ Prepend string type parameter values with parameter name!
    typeGenerator<String> { parameterInfo -> "${}_${randomString()}" }
    typeGenerator<UUID> { UUID.fromString("00000000-0000-0000-0000-000000000000") }
    typeGenerator<Int> { faker.random.nextInt(min = 0, max = 9) }
assertEquals(baz.username, "username_X3a8s813dcb")
assertEquals(baz.uuid, UUID.fromString("00000000-0000-0000-0000-000000000000"))
assertTrue( in 0..9)
String templates
faker.string.numerify("foo###bar") // foo123bar
faker.string.letterify("foo???bar", true) // fooXYZbar
faker.string.bothify("foo?##bar", false) // foox42bar
faker.string.regexify("""\d{2}\w""") // 42a
Random numbers, strings, enums, UUIDs, and more…
faker.random.nextInt(intRange = 0..1000)
faker.random.nextLong(bound = 999L)
faker.random.randomString(length = 99)
faker.random.nextEnum( {
    it != TestEnum.SOME // Exclude 'SOME' enum

See the pages under the User Guide section, jump straight to the Getting Started page, or explore the Data Provider API or the Full Core API documentation to learn more.