The Artima Developer Community
Sponsored Link

Agile Buzz Forum
TestPackages

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
TestPackages Posted: Jan 25, 2007 4:20 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: TestPackages
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

Writing new tests for changes made to the RB, I've run into a pattern that i see more and more of, and wanted to fix. At the same time, Runar was wanting a change or two to the navigation helpers of the SUnitToo(ls).

This is out of context, but one of the things I heard that David Heinemeier Hansson is to have said is "you can do it my way or the hard way." Rails basically works much of its best magic when the programmer follows certain conventions and patterns. Follow those rules, and it can automate lots of stuff for you.

SUnitToo(ls) has some simple features that follow along this line. One is that when you have a class such as Foo, and you follow the convention that your "unit" test for the class is called FooTest, SU2 can do some handy things for you. It's smart enough to know that when you have Foo selected, you can hit the "run" button, and it will run the FooTest tests. If you're browsing Foo, you can use the view menu option to "Toggle to/from TestCase" (also done via meta-T). This is very handy because you can quickly bounce back and forth between Foo and FooTest. It actually creates a "view" (or buffer) for each one, so you don't have to lose changes in the one while you work on the other. And it's smart about reusing buffers where it can. It's really very handy. Another thing it can do for you, is make FooTest in the first place. Let's say you have Foo, but not FooTest yet, the class menu has a "Add TestCase" option. It will create FooTest for you.

The changes I added today, add the notion of being aware of a "test package". If a package ends in 'Tests', it is assumed to be a test package. It will infer the package it is testing is one of Original-Tests, OrignalTests, or Original Tests. Knowing this, if you Add TestCase now, and it notes that the containing package for your class to test has an associated test package, it will put the new test class in there.

Another problem i had was with the RBParserTest. It was ParserTest, I renamed it so I could take advantage of the buffer toggling. But it still didn't work. The problem is that the RBParserTest lives in a separate namespace from RBParser, not just a separate package. So I added logic to do the same sort of thing when looking at the relationship between Foo and FooTest. If it can't find it in the local namespace, it'll try and see if there's package associated as above, and then look it up by simple name in that package.

The actual implementation... is another blog.

Read: TestPackages

Topic: Join the Cincom Smalltalk Team Previous Topic   Next Topic Topic: Intel Mac Support

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use