thisisqubika / fakeit

The Kotlin fake data generator library!
MIT License
536 stars 49 forks source link
android android-library data-faker fakeit inactive-repo kotlin library open-source test-driven-development tests utility utility-library

Fakeit

alt text

This library is a port of the Ruby gem Faker. It generates realistic fake data — like names, emails, dates, countries — for a variety of scenarios, including automated testing and database population.

The library was originally created for Android projects, but it can be used in any Java or Kotlin project.

Download

You can use either Maven:

<dependency>
  <groupId>com.github.moove-it</groupId>
  <artifactId>fakeit</artifactId>
  <version>v0.5</version>
</dependency>

or Gradle:

// In your project's build.gradle
allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

//In your module's build.gradle
dependencies {
  compile 'com.github.moove-it:fakeit:v0.5'
}

Basic Usage

Fakeit can be used in Java and Kotlin applications - no Android context needed!

Run the sample app to check all the available models and generate some random values.

First you need to initialize Fakeit:

// Default locale is en for english data.
Fakeit.init()

// You can also pass a Locale or a String locale to change the language.
// See supported languages below.
Fakeit.init(locale)

Then, you need to import the module into each file where it will be used with:

import com.mooveit.library.Fakeit;

Finally, generate fake data like this:

Fakeit.name().lastName()
Fakeit.business().type()
Fakeit.address().city()
Fakeit.card().name()

Supported Data Models

Supported Languages

Unique Values

You can also use Fakeit to generate unique values:

Fakeit.getUniqueValue()

Questions and Issues

For bug reports and feature requests, use Github issue tracker

Contributing

See the contribution guide.

License

MIT

Fakeit is maintained by © Moove-it