Article Preview
Buy Now
COLUMN
Unit Testing
Making your builds more reliable with unit testing
Issue: 11.6 (November/December 2013)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 32,039
Starting Page Number: 47
Article Number: 11610
Resource File(s):
project11610.zip Updated: 2013-11-04 12:39:25
Related Link(s): None
Excerpt of article text...
Unit testing is not something I was familiar with until I attended a session on the topic by Paul Lefebvre at a Real World conference a few years ago. The concept intrigued me and I could see the value, but like exercise, just because something is good for you doesn't mean you do it enough. I was therefore excited last spring to hear that the release of Xojo would include unit testing.
Unfortunately, Xojo's unit testing is not built-in to the IDE. Instead, unit testing is a collection of classes that you'll find in the Examples folder (under "Unit Testing"). That's not necessarily a bad thing, but it does mean it's a feature that many will overlook.
The process is made even more awkward by the fact that there are separate classes for different types of projects: desktop, web, and console. (For today's lesson, I'm focusing exclusively on the Desktop project, but the others should be similar.) You also can't just drag in the classes—they're embedded inside the example projects.
It's also a complicated set of classes and the documentation is minimal (a few pages in Chapter 6 of
User Guide: Book 4: Development ). Frankly, I found the explanations baffling, and it took me quite a while just to get the example working because much that you need to know is left out of the instructions. Fortunately, once you figure it out, it really is a quite brilliant and elegant system.But before we get into the details of how to make it work, let's first explore the most important questions: what is unit testing and why should you use it?
What is Unit Testing?
...End of Excerpt. Please purchase the magazine to read the full article.