Download as odp, pdf, or txt
Download as odp, pdf, or txt
You are on page 1of 7

TestDriven Development - Ruby

---------
BDD
Functional testing.

V2solutions Inc.
Bangalore
5th Oct 2010
TDD (Test driven development)

Add/ Update
Expectations

Run and succeed Run


Runand
andfail
fail

Add/ Update
Code(Functionality)
Test::Unit - Ruby UnitTesting Framework.

http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Un
it.html

Require 'test/unit'
class MachineTest < Test::Unit::TestCase
def setup
end
def teardown
end

end
Create a machine, which is a … ,

Tea maker

Can make tea

Add sugar

Alert on overload
Tests

Assertions

Methods

assert assert_block assert_equal assert_in_delta assert_instance_of
assert_kind_of assert_match assert_nil assert_no_match assert_not_equal
assert_not_nil assert_not_same assert_nothing_raised
assert_nothing_thrown assert_operator assert_raise assert_raises
assert_respond_to assert_same assert_send assert_throws build_message
flunk


Runners

require 'test/unit/ui/console/testrunner'
Test::Unit::UI::Console::TestRunner.run(MachineTest)

Or Just require the test file :)

Test suit
To be discussed,

BDD

Rspec

Cucumber

Functional testing in Rails
Thank You :)

shilesh

You might also like