Giter VIP home page Giter VIP logo

moka-props's Introduction

Moka Props

Moka Props is a test tool to perform stateful property-based testing on the Moka cache.

It will randomly generate commands with arguments, run them against the cache implementations and verify the returned values. It is like a superset of QuickCheck, which will not only generate test data, but also generate test cases.

Overview

This tool is still in an early stage of development and missing many test cases. But it will eventually generate commands including the followings:

  • Create a cache with various configurations.
  • Insert an entry with controlled-random key and value.
  • Get an existing or not-existing entry.
  • Invalidate an existing or not-existing entry.
  • Tick cache's internal expiration clock.
  • Pause or resume cache's internal bookkeeping tasks.
  • Swap write log entries in the internal queue to emulate race conditions in concurrent writes.
  • Drop a cache.

This tool uses the following frameworks/libraries and programming languages:

  • PropEr, a property-based testing framework written in Erlang programming language.
  • PropCheck, an Elixir binding for PropEr.
  • Elixir programming language, for writing properties.
  • Rustler, a library for writing Erlang Native Implemented Functions (NIFs) in safe Rust code.
  • Rust programming language, for creating a dynamic-link library containing Moka and its wrapper functions.

Why property-based testing?

Property-based testing helps us create better, more solid tests with little code. It will complement unit test based testing.

Prerequisites

You need a machine running macOS or Linux.

You also need to install the following tools before building this tool:

Testing the properties (Running tests)

Clone this repository:

$ git clone https://github.com/moka-rs/moka-props.git
$ cd moka-props

Get the dependencies for Elixir:

$ mix deps.get

Build and run the tests:

$ mix test

Developing properties

To learn about PropEr, we would recommend the following book:

License

TODO: Write this section and add the license file(s).

  • Moka Props itself might be distributed under either of the MIT license or the Apache-2.0 license.
  • Be aware that PropEr and PropCheck are distributed under the GPL-3.0 license.
    • You might want to run Moka Props, which links to PropEr and PropCheck, only in your development and testing environment.
    • You might want to avoid linking your final product to PropEr and PropCheck.

moka-props's People

Contributors

tatsuya6502 avatar

Watchers

 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.