Article Preview
Buy Now
FEATURE
PostMortem: RBUnit
Unit Testing for REALbasic
Issue: 5.6 (September/October 2007)
Author: Paul Lefebvre
Author Bio: Paul Lefebvre is the President of LogicalVue Software, Inc. and founder of RBDevZone, the free community for professional REALbasic developers.
Article Description: No description available.
Article Length (in bytes): 8,437
Starting Page Number: 11
Article Number: 5607
Related Web Link(s):
http://www.logicalvue.com/
Excerpt of article text...
It all began in early 2004. I was working with Visual Studio 2003 and learning about unit testing. And I liked it. A lot. In the .NET world there are lots of unit testing frameworks to choose from. I used both nUnit and csUnit. Both of these unit test frameworks included a "test runner" UI that showed test results visually. I preferred the csUnit test runner (see Figure 1).
During this same time I was also spending a lot of time with REALbasic as I was developing SQLVue 3.0. I thought it would be useful to have a unit testing framework for REALbasic, but after searching for a while was unable to find one. So I decided to create one. I based RBUnit on csUnit and its test runner.
Developing RBUnit 1.0
It turns out that creating a unit testing framework in REALbasic is not as easy as it is in some other languages because REALbasic does not have reflection (see sidebar). Without reflection, it is not possible for the unit testing framework to determine what the test methods are. So for RBUnit 1.0, I used a rather inelegant method of having the user call their test method manually with a parameter to specify the method name so that it could be displayed in the UI. It was a bit awkward as you can see here:
TestAssertNotNil(AddTest("TestAssertNotNil"))
I thought the UI was pretty nice, though (see Figure 2). It showed the names of the test methods and made it really easy to visually see which ones passed and which ones failed. In addition, RBUnit also had the ability to track the amount of time spent in the test methods (see Figure 3).
...End of Excerpt. Please purchase the magazine to read the full article.