Coder Social home page Coder Social logo

jestan / midje Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marick/midje

2.0 2.0 0.0 57.12 MB

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing

License: MIT License

Ruby 1.77% Clojure 98.23%

midje's Introduction

Available via clojars
Current stable version: [midje "1.2.0"]
Development version: [midje "1.3-alpha4"] (includes Clojure 1.3 support)

About Midje

Midje is a test framework for Clojure. I created it to support top-down as well as bottom-up testing, to encourage readable tests, to provide a smooth migration path from clojure.test, to support a balance between abstraction and concreteness, and to be gracious in its treatment of you, my valued guest.

Here's a simple Midje test:

  (fact
     (numerical-reverser 103) => 301)

I call this a "fact" because, in a world without mutability, it just is a fact that the numerical-reverser of 103 is 301. Since I work test-first, I like to think of programming as making false claims about the world of the program, then changing that world to make the claims true.

I use the arrow because I think of tests as examples. When people show snippets of code as examples, they often use an arrow to separate what you type from what you should expect to see.

The object on the right-hand side of the arrow can be a function, in which case the value of the left-hand side is passed to it. So this is also a fact:

 (fact
   (numerical-reverser 103) => odd?)

Midje comes with a selection of predefined checkers that are more useful for testing than odd? is.

Midje's other useful features are described in the user guide. If anything there is unclear, ask in the mailing list. If you like videos of people programming, here's an 8-minute infomercial that concentrates on transitioning from clojure.test. If you like looking straight at code, this heavily annotated example has a bunch. If you want to run that example, you can download it:

  1. Click here.
  2. In a shell, go to the directory your browser unpacked the example into. It should be named examples.
  3. Go to examples/basic/.
  4. Type "./run" or "lein test".
  5. The facts in test/*/core_test.clj will be checked.

You can download everything to get more examples.

Contributors

  • Sean T. Allen
  • Alex Baranosky
  • Phillip Calçado
  • Ben Mabey
  • Brian Marick
  • Bob Martin
  • Sébastien RoccaSerra
  • Wilkes Joiner

midje's People

Contributors

alexbaranosky avatar bmabey avatar jestan avatar marick avatar pcalcado avatar sroccaserra avatar wilkes avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.