Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 97 lines (66 sloc) 2.171 kb
f09466b Josep M. Bach rename library to fastest
authored
1 #fastest
0d42568 Josep M. Bach first commit
authored
2
f09466b Josep M. Bach rename library to fastest
authored
3 **fastest** is a testing framework written in [6 lines of code](
66795c3 Josep M. Bach Add note for addons and parallel
authored
4 https://github.com/txus/fastest/blob/master/lib/fastest.rb) (or 473 characters)
f09466b Josep M. Bach rename library to fastest
authored
5 which tries to be performant, with eye-catchy reports and easy to use.
6
7 Originally named **a**, the name was too much for Google so I changed it.
0d42568 Josep M. Bach first commit
authored
8
9 Heavily inspired by Konstantin Haase's [almost-sinatra](
10 http://github.com/rkh/almost-sinatra), its long-term purpose is to become the
11 fastest testing framework available.
12
f09466b Josep M. Bach rename library to fastest
authored
13 In order to contribute to **fastest**, you have to bear in mind that the code
0d42568 Josep M. Bach first commit
authored
14 **must** stay under 7 lines and with **less than 80 chars** per line. There is
15 room for optimization.
16
66795c3 Josep M. Bach Add note for addons and parallel
authored
17 In case more sophisticated behavior was needed, it could be included as an
18 **optionally loadable addon**. An example of this is [fastest/parallel](
19 https://github.com/txus/fastest/blob/master/lib/fastest/parallel.rb), an addon
20 that enables your tests to run in parallel, which means faster.
21
0d42568 Josep M. Bach first commit
authored
22 ##Features
23
24 * Setup / Teardown
25 * Assertions (using the `a` method)
26 * Report tests/assertions/failures
27 * Keep track of lines where failures happened
28
29 ##Install
30
f09466b Josep M. Bach rename library to fastest
authored
31 $ gem install fastest
0d42568 Josep M. Bach first commit
authored
32
33 Or in your Gemfile:
34
f09466b Josep M. Bach rename library to fastest
authored
35 gem 'fastest'
0d42568 Josep M. Bach first commit
authored
36
66795c3 Josep M. Bach Add note for addons and parallel
authored
37 ##Addons
38
39 * Require `fastest/parallel` in your test helper or suite to run your tests
40 in parallel.
41
0d42568 Josep M. Bach first commit
authored
42 ##Usage
43
44 ````ruby
f09466b Josep M. Bach rename library to fastest
authored
45 require 'fastest'
0d42568 Josep M. Bach first commit
authored
46
9c194b6 Josep M. Bach readme
authored
47
f09466b Josep M. Bach rename library to fastest
authored
48 # Every test case must inherit from the A class
0d42568 Josep M. Bach first commit
authored
49 class MyTestCase < A
50 def setup
51 @user = { :some => :object }
52 end
53
54 def test_user_has_property
55 a @user[:some] == :object
56 a !@user[:other]
57 end
58
59 def teardown
60 @user = nil
61 end
62 end
63
64 class MyOtherTestCase < A
65 def setup
66 @foo = [1,2,3]
67 end
68
69 def test_user_has_property
70 a @foo.length == 3
71 a @foo[2] > 934 # Should fail at line 27
72
73 @foo[1] = 99
74
75 a @foo[1] != 2
76 end
77
78 def teardown
79 @bar = :something
80 end
81 end
82 ````
83
84 And voilà:
85
674241a Josep M. Bach fix test count
authored
86 ![a](http://dl.dropbox.com/u/2571594/a_screenshot.png)
0d42568 Josep M. Bach first commit
authored
87
88 ##Disclaimer
89
f09466b Josep M. Bach rename library to fastest
authored
90 **fastest** has no automated tests nor documentation, and I will have to turn
91 down any pull request that contains those, unless the tests are written in
92 **fastest** itself.
0d42568 Josep M. Bach first commit
authored
93
94 ## Copyright
95
96 Copyright (c) 2011 Josep M. Bach. Released under the MIT license.
Something went wrong with that request. Please try again.