Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 78d9dfb9cb
Fetching contributors…

Cannot retrieve contributors at this time

executable file 70 lines (51 sloc) 2.228 kb
gsinclair/dfect
===============
Fork by Gavin Sinclair of Suraj N. Kurapati's 'dfect' testing library.
Things I like about dfect: simplicity, minimalism, good design.
Things I want to implement, with progress reports:
* Minimal but useful output with meaningful failure messages
- Completed in most/all cases; see below.
- When asserting equality between two long strings, the _difference_
between them is indicated for easier debugging.
* Colourful output
- Completed in most/all cases.
* (A few) more assertions, like Eq for asserting equality
- The following are implemented (test/unit equivalent in brackets):
+ Eq (assert_equal)
+ N (assert_nil)
+ Mt (assert_match)
- More to come as I need/want them. Not aiming to add everything
under the sun, though!
* Facility for user-added assertions
- No work done on this.
* Easily select the tests you want to run
- No work done on this.
* Easily run the debugger when certain tests are executing
- The global variable $dfect_test is set to the description of the
currently-running test, meaning you can insert a line into your
code like this:
debugger if $dfect_test =~ /generate HTML/
Output
------
Here is a "screenshot" of a test failure in the project I'm working on.
Unfortunately it doesn't show the colour, which makes it much easier to read.
See links [1]-[3] below for true screenshots showing the colour.
FAIL: TopicDocument (resources)
./test/topic_document.rb
53 Eq r[0].category, "F"
54 Eq r[0].filetype, "PDF"
=> 55 Eq r[0].file_re, /^A030.+worksheet/
56 Eq r[0].description, %{
57 A summary of (nearly?) all the skills taught in this topic.
Equality test failed
Was: /^A030.+worksheet.pdf/
Exp: /^A030.+worksheet/
Backtrace
./test/topic_document.rb:55
test/_all.rb:19
[1] http://picasaweb.google.com/lh/photo/WyrF7D7I4sKnSNCz0RlBJw
[2] http://picasaweb.google.com/lh/photo/N8kCnZ3U3wFqKBKKJM9Crg
[3] http://picasaweb.google.com/lh/photo/7r2o1HWCjyEOhjc7o1nluQ
Contact
-------
gsinclair at gmail dot com
Jump to Line
Something went wrong with that request. Please try again.