Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xgouchet/mesmaeker

A Contract Based Testing framework for java / kotlin
https://github.com/xgouchet/mesmaeker

Last synced: 10 days ago
JSON representation

A Contract Based Testing framework for java / kotlin

Awesome Lists containing this project

README

        

# Mesmaeker

> Mesmaeker is a library providing tools for Contract based testing in the JVM

[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)
[![Kotlin 1.1.4-2](https://img.shields.io/badge/Kotlin-1.1.4--2-blue.svg)](http://kotlinlang.org)

I (try to) write a lot of unit tests in my various projects, and use a lot of mocks. The problem with mocks is that they
tend to be totally disconnected from the implementation they represent.

Because a subject's behavior is described by the tests using it, how can we be sure that it does represent how the real
implementation will behave ?

That's how Contract based testing, and Mesmaeker, can help. The basic idea goes like this. Say you have a class A, and a
class B using instances of A. When testing B, instead of using subject instances of A, that will behave to make the tests of
B pass, you're going to use a subject generated by a Contract class. And when you're testing class A, you can use the contract
class to verify that the implementation follows the same contract as the mocks.