Getting Started¶
Installing¶
Releases¶
Installation is as simple as adding kotlin-faker
dependency to your build configuration file:
Release artifacts are available for download from maven central, and you usually don't need to add any additional repositories information.
Snapshots¶
Snapshot are automatically published on each commit to master. If you want to try out the latest functionality - add the dependency the same way as described above, but change the version to the current snapshot version, and add the sonatype snapshots repository to your repositories block in the build configuration file:
Faker BOM¶
See Kotlin-faker BOM page for details on how to use a Bill-of-Materials to simplify dependency management.
Generating Data¶
Creating a Faker
instance can be done either by creating a class instance directly:
Or by using the Faker DSL (Which also gives you dsl-like access to Faker Configuration.)
Tip
For Java users (1)
- Note the usage of
FunctionalUtil.fromConsumer
method in "functional-java" tab. If this is not used, then an explicit return must be specified at the end of the lambda (See "java" tab instead).
See also Java Interop for more details on using kotlin-faker from Java.
This concludes this short "getting started" guide. Jump to Faker Configuration page to learn how to configure Faker
to generate localized data, ensure deterministic random data generation and other configuration options or just click the next button to go to next wiki page.