GithubHelp home page GithubHelp logo

uzilan / kwik Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jcornaz/kwik

0.0 1.0 0.0 2.92 MB

Property-based testing library for Kotlin

Home Page: https://kwik.readthedocs.io

License: Other

Kotlin 100.00%

kwik's Introduction

Kwik

https://readthedocs.org/projects/kwik/badge/?version=latest https://img.shields.io/badge/kotlin-1.4-informational

Property-based testing library for Kotlin.

Main features:

  • Test-engine agnostic
  • Multiplatform
  • No reflection
  • Configurable built-in generators
  • Easy way to create and combine generators
  • Seeded generation for reproducible results

Planned features:

  • Shrinking

Find more information on https://kwik.readthedocs.io

Status

The project is incubating and its API is subject to changes.

Please give it a try and write a feedback in the issues or discuss on gitter.

For mode details about the future of kwik, here's a roadmap.

How it looks like

class PlusOperatorTest {

    @Test
    fun isCommutative() = forAll { x: Int, y: Int ->
        x + y == y + x
    }

    @Test
    fun isAssociative() = forAll(iterations = 1000) { x: Int, y: Int, z: Int ->
        (x + y) + z == x + (y + z)
    }

    @Test
    fun zeroIsNeutral() = forAll(seed = -4567) { x: Int ->
        x + 0 == x
    }
}

For more information read the usage and look at the available generators

Motivation

Property based testing is great and very powerful. But despite the fact that many good libraries already exist, none of them fully fit my needs.

The known alternatives either:

  • Are bound to a specific test-engine
  • Can only be used when compiling kotlin to Java (and cannot be used in multi-platform projects)
  • Relies on reflection, making the tests slower and make some errors detectable only at runtime
  • Do not allow enough freedom and safety to customize existing generators
  • Force the user to add unwanted dependencies in the classpath

Setup

NOTE: Since version 0.7.0 kwik requires Kotlin 1.4!

Example of setup using gradle.

repositories {
    jcenter()
}

dependencies {
    testCompile("com.github.jcornaz.kwik:kwik-core-jvm:$kwikVersion")
}

Find more detailed information in the setup instructions.

Contribute

See how to contribute

kwik's People

Contributors

jcornaz avatar renovate[bot] avatar aleagnelli avatar alvaroreina avatar kantis avatar renovate-bot avatar ursjoss avatar michellesantos avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.