realbasic-betas.mbox
[Top] [All Lists]

Re: Unit Testing and Refactoring

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: Unit Testing and Refactoring
From: Daniel Berlinger <daniel at circumtech dot com>
Date: Wed, 30 Oct 2002 23:37:28 -0500
Automatic refactoring request...

> > Yes and it's something we really want to add but it will have to wait until
> > after v5.
> > -- 
> > Geoff Perlman

That's awesome news... as far away as that feels. :)

> My second question was just for curiosity. If you have implemented unit
> testing and don't mind explaining how you went about it can you send me
> a note. Thanks

I'd love to see an RBUnit open source project get started... so I responded to 
the list. If enough folks are interested, I'll happily get a website started to 
support the effort.

That said, I have a simple setup...

I created a window where all the tests reside. The window has a single 
editfield where the pass/fail results from the tests display.

In the Open Event of the test window is a simple method runTests() which lists 
all the tests()

Each test is a method in the test window.

I use a module to hold long strings or xml etc. for certain tests.

In the application class open event is

    if debugBuild =  true then
      testTerminal.show
    end if
    
That way the test run automatically every time I "run" the app, but the tests 
don't run in built apps. Both the module and window are in a single folder, so 
all it takes to produce a production build is pulling that folder out and 
commenting out the code above.

Using this setup I'm able to test anything I've tried to test. If it has a 
downside it is that it feels like I have to write too much code to test some 
simple things... which means to me that I probably need to refactor the tests 
applying extract method...

d.

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>

Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.


<Prev in Thread] Current Thread [Next in Thread>