quicktest / 0.3.2
| Short description: | in-lined unit tests | |||||
|---|---|---|---|---|---|---|
| Category: | Library/Test | |||||
| Status: | alpha | |||||
| Created: | 2008-02-26 07:10:16 GMT | |||||
| Last update: | 2008-02-28 15:57:57 GMT | |||||
| Owner: | Greg Weber (Projects of this owner) | |||||
| Homepage: | http://rubyforge.org/projects/quicktest/ | |||||
| Download: | http://rubyforge.org/frs/?group_id=5644 | |||||
| License: | BSD-type | |||||
| Dependency: |
|
|||||
| Description: | begin rdocAuthor and LicenseCopyright © 2008 Greg Weber, gregweber.info Licensed under the MIT license ABOUTQuicktest - A utility for inlining ruby unit tests with the ruby code under test The typical test driven development workflow requires constant switching between the file containg the source code and the the file containg the tests. When creating code, it is much faster to be able to place tests immediately after the code you are writing. After the code has been written, it may be a good idea to move it to another file. Quicktest is designed to support quick tests in a framework agnostic way. Currently, only an rspec testrunner is available, but it is trivial to write one for another testing framework. FEATURESQuicktest uses method tracing to know the method you are testing. By default the output of a failed test will show the object and method name. USAGETo test a method, place another method called ‘quicktest’ immediately after it the quicktest method has one OPTIONAL argument
run with spec -r quicktest file_to_test There is a convenience script so that you can just run quickspec file_to_test NOTES
example: run with bin/quickspec end rdocclass Foo
attr_reader :bar
def initialize
@bar = true
end
def quicktest
it "bar should be initialized to true" do
bar.should == true
end
end
def self.hello arg
"hello" + arg
end
def self.quicktest meth
it "should prepend 'hello' to its argument" do
meth["world"].should == 'hello world' # error - no space 'helloworld'
end
end
end beginRunning quicktest on the sourc of this README file outputs the following: .F 1) ‘Foo hello should prepend ‘hello’ to its argument’ FAILED expected: "hello world",
got: "helloworld" (using ==)
./README:22:in `quicktest’ /home/greg/quicktest/lib/quicktest.rb:65:in `instance_eval’ /home/greg/quicktest/lib/quicktest.rb:65:in `run_tests’ Finished in 0.008338 seconds 2 examples, 1 failure end |
|||||
| Versions: | [0.5.6 (2008-03-12)] [0.4.0 (2008-03-08)] [0.3.2 (2008-02-28)] [0.1.0 (2008-02-26)] | |||||