Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 2.9 KB

comparison.adoc

File metadata and controls

52 lines (43 loc) · 2.9 KB

Comparison with related projects

Before writing KotlinFixture, we originally looked to extend FlexTrade’s KFixture, however, as the core project is Java based we struggled with the type system, and so we started work on KotlinFixture.

Being Java based means Jeasy’s Easy Random and FlexTrade’s KFixture will never be able to understand Kotlin’s nullable types. Currently Marcello Galhardo’s Kotlin.Fixture, which is Kotlin based, doesn’t support nullable types either, although this functionality could be added.

Unlike KotlinFixture, the other libraries have no understanding of Kotlin’s default values which can mean missing an important test scenario.

Only KotlinFixture has built-in support for abstract classes. Kotlin’s sealed classes are abstract so not supported, with only Marcello Galhardo’s Kotlin.Fixture supporting sealed classes but not abstract classes.

For ease of use, a fixture library needs good support for built-in types to reduce the amount of customisation required, whether that is types such as Kotlin’s Pair, Java types such as Currency and Locale or even Java 8s time types. The user should expect them to seamlessly work with no additional configuration.

Needless to say all software has bugs, we have tried hard to ensure we create core types as expected, and hopefully have enough tests to back that up. However, when comparing our library to our competitors we did find various unsupported types, not random, or generated invalid types. For example:

  • FlexTrade’s KFixture does not support Pair, Triple, Currency or Locale.

  • HashMap is not random in any of the competitors.

  • SortedSet and SortedMap generate invalid objects in FlexTrade’s KFixture.

  • Various List types either generate invalid objects or aren’t random in Jeasy’s Easy Random.

  • Marcello Galhardo’s Kotlin.Fixture doesn’t support primitive arrays such as ByteArray and IntArray.

Our comprehensive ComparisonTest contains more details.

If you find any bugs or have any feature requests for more built-in types please create an issue.