Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
src
 
 
 
 
 
 
 
 

README.textile

RTFSpec – A Spec-like Testing Framework for Clojure

Tests fulfil two main roles in modern software development:

  • Assert that the code work as specified
  • Document what was specified

Some existing tools for Clojure get the first right but I am not satisfied with how any of them perform in the documentation bit. To solve this problem I present yet another testing framework.

RTFSpec tries to apply the vocabulary defined by RFC-2119 , using the imperatives MUST, MUST NOT, SHOULD and SHOULD NOT. I decided to not use MAY and MAY NOT as tests should be deterministic.

A typical example using RTFSpec looks like this:


(use 'rtfspec)

(spec "List Comprehensions"
      (must "return a list applying the given function"
	    (= (list 11 12 13 14 15)
	       (for [a (list 1 2 3 4 5)] (+ 10 a))))

      (must "include elements that are not matched by the :while clause"
		(empty?
		   (for [a (list 1 2 3 4 5) :when (= a (+ 10 a))] a))))

Running this through ant:

<rtfspec failonerror=“true” fork=“true” dir=“${test.clojure-core.dir}/”>
<classpath>
<path refid=“test.dependencies”/>
</classpath>
</rtfspec>

You have the output:


[rtfspec] ..
[rtfspec]  2 Tests ( 2 Successful 0 Failed 0 Pending 0 Exceptions )

Check the tests included in the source distribution for more info.

TODO

For beta

  • Documentation :)
  • Exception stacktraces are being print in wrong order
  • Nice error messages for malformed facts
  • Some way to expect an exception
  • Asserters and matchers

Nice to have

  • Autospec
  • Code coverage
  • Run tests in parallel
  • More smoke tests, tests for core.clj would be lovely
  • Run functions against a domain

About

A spec framework for Clojure

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.