Faker

General

Category
Free
Tag
Data Generators
License
MIT License
Registered
Dec 14, 2015
Favorites
9
Link
https://github.com/blocoio/faker
See also
Konveyor
Faker
Random Beans
AndroidRandom
RxPeople

Additional

Language
Kotlin
Version
2.0.4 (Jan 8, 2024)
Created
Nov 10, 2015
Updated
Jan 8, 2024
Owner
Bloco (blocoio)
Contributors
Bruno Correia (bffcorreia)
Sérgio Santos (sdsantos)
FilipeA (Filmaluco)
Liliana Faustino (LilianaFaustinoDev)
4
Activity
Badge
Generate
Download
Source code

Generates fake data for testing or populating a development database. Run your tests with realistic data like names, emails, dates, countries...

A Kotlin port of the Faker ruby gem that's suitable to use in Android development. The goal is to reuse their locale data files without changes.

Installing

repositories {
    // ...
    mavenCentral()
}

dependencies {
    implementation 'io.bloco:faker:${fakerVersion}'
}

You can use testImplementation or androidTestImplementation, if you only want to use Faker for testing.

Usage

val faker = Faker()
faker.name.firstName()    // Returns "Aaron"
faker.company.name()      // Returns "Hirthe-Ritchie"

val faker = Faker("nl")
faker.name.firstName()    // Returns "Thijs"

For full list of available options, check the original source. We have tried to keep the operations as close as possible.

You can also check our blog post.

Available components

  • Address
  • App
  • Artist
  • Avatar
  • Book
  • Bool
  • Business
  • Color
  • Commerce
  • Company
  • Date
  • Food
  • Internet
  • Lorem
  • Name
  • Number
  • PhoneNumber
  • Placeholdit
  • SlackEmoji
  • Team
  • Time
  • University

Warnings

  • Currently, we don't support locale specific operations like Address.postcode_by_state or Business.swedish_organisation_number.

Proguard

If you are using R8, the shrinking and obfuscation rules are included automatically.

Otherwise, you will need to add the following options:

-keep class org.yaml.snakeyaml.** { public protected private *; }
-keep class org.yaml.snakeyaml.** { public protected private *; }
-dontwarn org.yaml.snakeyaml.**

Contact

Feedback and contributions are welcome. Feel free to send an email or submit a pull request.