Skip to main content

Posts

Showing posts from December, 2005

My wish for 2006

Well, one of my wishes, anyway... I'd like to see someone take Watir and attach it to a Ruby on Rails back end that would hold test data, test-running instructions, test results, and metadata like requirements or defects linked to particular tests. Picture something like Mercury TestDirector+WinRunner, but with Rails+Watir. Jonathan Kohl agrees with me that it would be possible, but it would take some real effort to prove that such a thing would work. I'm not sure I'm bold enough to start such a project myself.

What part of "$&" don't you understand?

Perl has some awfully handy stuff, even when it's in Ruby. The Pragmatic Programmers start their Regular Expression chapter in the Pickaxe by discussing $& (the last regular expression match), and $', and $` (the strings immediately before and after the last RE match). Awfully convenient stuff, borrowed directly from Perl. At the end of the chapter they apologize: "Having said all this, we have to 'fess up. Andy and Dave normally use the $-variables rather than worrying about MatchData objects. For everyday use, they just end up being more convenient. Sometimes we just can't help being pragmatic." I wrote a little Ruby utility script recently to handle a bookkeeping chore, that does some screen-scraping and Excel-file-reading. About forty lines. $& figured prominently. That's not so offensive, is it?

But it works on *my* machine....

Welcome to the first post. This almost was an article, but the ending was "we threw it all away". And who wants to hear that? Introduction The following code consists of four unit tests for a class called "Range" written in C#. Range accepts two arguments, a begin date and an end date. From that it calculates a range of dates. The unit tests are intended to show whether a particular date is within that range or not. Range dateRange = new Range (DateTime.Now, DateTime.Now.AddDays(3)); Assert.IsFalse(dateRange.Includes(DateTime.Now.AddDays(-1)),"Yesterday should not be in the date range"); Assert.IsTrue(dateRange.Includes(DateTime.Now),"Today should be included in the date range"); Assert.IsTrue(dateRange.Includes(DateTime.Now.AddDays(3)),"The end of the range should exist in the date range"); Assert.IsFalse(dateRange.Includes(DateTime.Now.AddDays(4)),&