Iteration#1 : Day 3/10
The day is lost.. after quite a bit of grappling with RubyFit and Fitnesse.. all I get is 2 Exceptions and some command line output captured.. and I don’t see what the problem is. Error reporting has scope and need for improvement.
[I switch OFF the project clock. Overtime.. just this once!!]
Time to hit the forums after lots of fiddling with the paths and what nots.. (Days pass waiting for someone to answer … no answers.)
Let me go over the material that I have again with a fine-comb. First stop Ron’s article. Most of it looks ok.. I’m doing it right. Wait.. the wise ron has worked in small steps.. He has a small wiki table to test something that comes along with the Ruby Fit Server implementation. So if that thing turns out green, I can be assured that Fitnesse is able to talk to my copy of Ruby FitServer. So I copy the table right out of Ron’s article and paste it into my Fitnesse test page..
!define COMMAND_PATTERN {ruby -v -I %p "L:/ruby_home/lib/ruby/gems/1.8/gems/fit-1.1/bin/FitServer.rb"}
!path "L:/Gishu/Ruby/ShowMeTheMoney"
!|eg.ArithmeticFixture|
|x|y|+|-|*|/|
|1|1|2|0|1|1|
!|AcceptanceTests.TestTrackInflows|
|amountReceived|currentBalance()|
|100|100|
|500|600|
|1200|1800|
Save and Click the test button and lets see what happens.. fingers crossed.
I take a crack at it the next day. I scan material on the Ruby FitServer’s home page http://fit.rubyforge.org/basics.html and BAM!
“In RubyFIT, that also is the name of the file containing the fixture, where the camel cased words are lied without capital letters and separated by underscores. Programmers can start creating a file named calculate_discount.rb and writing the skeleton of the CalculateDiscount fixture:”
Both Ron and Cory used one-word fixture names like People and Division… they don’t call em experts for nothing. RubyFit like Rails uses this internal conversion scheme of converting camelCase words to camel_case words
So I quickly go and rename my Ruby File from TestTrackInflows to test_track_inflows.rb
Click Test and now I get an error saying that my method ‘amount_received=’ is undefined. Ahh.. more of the same. Change the method names so that we have…
require 'fit/column_fixture'
module AcceptanceTests
class TestTrackInflows < Fit::ColumnFixture
attr_reader :balance
attr_accessor :amount_received
def initialize
@balance = 0
end
def current_balance
@balance
end
end
end
Re-test and we have red-hot ignition! WooHoo… please excuse me while I do that once again. WOO HOO !!!
It’ll be a while till I glue my application code to the test-table. So we’ll fake out the first result and see if we get a small green.. just to keep our spirits high. Sneaky tweak to the fixture methoddef current_balance
Sure enough!! We have a green. Rollback that temp hack.
#@balance
100
end
Its time.. to do the victory jig.
Update:
Iteration#1 : Day 4/10
I’m penalizing one day to reflect reality. I did spend an awful amount of time trying to get all this running.
No comments:
Post a Comment