You have a series of test cases. They cover the same logic with different inputs. In order to get to that logic, there’s some overhead: objects have to be created first. Then there’s more logic needed to evaluate the result. What’s the best way to manage these tests? You want it to be easy to add new tests. You also want it to be clear what part of the test is different in each round and what part is just the common logistics.
It’s very easy to let this blog habit slip through your fingers. You go from, “put something up every weekday”, to “nobody reads this on Friday”, to “I’m tired this mornng”, to “wow, I haven’t posted in a week, and nobody noticed, why post today”. Anyway, here’s a post. Book Status Beta 6 came out last week. I’m now going through the RSpec chapter, which is taking longer than I thought.
Book Status The Shoulda chapter is draft complete, after a slight restructuring to change the emphasis of the chapter, and a lot of syntax changes. My previous version of the chapter was written before Shoulda went in the direction of RSpec compatibility and so there were a lot of syntax changes that needed to be made, particularly to the way you create Shoulda extensions, which used to be much simpler.
And Now A Word The schedule for WindyCityRails 2010 just came out. WindyCityRails is Saturday, Sept, 11 at the Westin Chicago River North. I will be running the PM tutorial session on “Testing in a Legacy Environment”. I am frequently asked how to start testing on a pre-existing code base with no tests. In this session, we’ll start with a made-up “legacy” code base, and discuss techniques for adding tests, and fixing bug, and adding new features in a test-driven way.
Status Back to link posts today. The book is still lurching forward on the legacy chapter. Thanks to those couple of you that asked questions on the forum and made it look a little less lonely over there. Quick Review Quick iPhone 4 impressions, but understand that I haven’t actually, you know, used it yet, just took it home and set it up. The screen sharpness really is notice able.
Book Status Beta 4 should be available this week, or at the latest Monday, apparently we’re working around people’s vacation schedules. It will have two new chapters, and some error fixes and tweaks around the book. Next is on to Beta 5. In status news that shouldn’t interest you much, the end of the quarter meant the end of my first Pragmatic pay period. And apparently Pragmatic pays as soon as possible, rather than waiting 30 or 90 days after the end of the pay cycle.
Book Status And now I turn my lonely eyes to the chapter on testing legacy code. I liked this chapter in the original book, and it’s something I get asked about pretty consistently, so I really want to make it great. Links I’m personally going to spend a lot of time with David Chelimsky’s post about RSpec 2 docs. It’s the best listing I’ve seen so far about changes between RSpec 1 and RSpec 2.
Top Story Thoughtbot talks about their plans for Shoulda moving forward. The big takeaway is that, while the context library will be separated out for use in Test::Unit, both Shoulda style and Shoulda effort will be focused on RSpec integration. I have some complicated thoughts about this one. I’m thrilled that Shoulda is being maintained – it’s a tool I’ve used a lot, and I was starting to get worried. And they should move their open source tool in any direction they want.
iPad Note I keep wanting to write about the iPad, but so, so many other people are writing about it that I’m not sure I have anything to add. More or less at random, I really liked the brief rant Joe Posnanski added in the middle of an otherwise-unrelated blog post, and Charles Stross’ typically complete take. Right now, I just would add that I still use it more than I thought, that the form factor makes more of a difference than I expected (being able to easily walk to show the screen).
Top Story For a while, it looked like the top story was going to be Apple’s new developer Rule 3.3.1, described here by John Gruber. More on that in a second. But the real top story is the news that Twitter has bought Tweetie, intending to rebrand it as Twitter for iPhone, and dropping the price to a low, low, free. Eventually, it will be the core of Twitter for iPad.
Here’s a little RSpec design question. As I’ve probably mentioned in various spots, I don’t naturally take to the RSpec massively-mocked style of testing. However, I’m currently on a Rails project that is using that style – unit tests don’t touch the database, functional tests don’t touch the models. It seems to be working for them, they certainly seem to have stuck with it over the course of this rather complex application.