Test driven development and VB6
Just as I wrap up things here at work I've been thinking about our legacy VB6 code (used in a retail point of sale application).
A lot of what we do in that code is quite complex and difficult to test, but it definitely needs testing. Up until now we've basically had a single person running test scripts manually for each new release. It's a slow process and quite painful, so it hardly ever gets done.
For our .NET code we've used many of the agile methodologies, such as TDD (test driven development), refactoring and continuous integration. These processes have worked quite well and at times have proven invaluable.
So I thought why not see if we can apply some of these methods to VB6? Well it's not so easy (as you may already know). The problems being that VB6 is a closed box, most of the logic is embedded in the forms, and those forms are not exposed to COM even if you write the application as an ActiveX exe (which we didn't).
I found a few articles one the web - one about using VB6 with NUnit and one on Debugging VB6 Binaries in VB.NET which all seemed promising, but nothing really works for our legacy code.
The problem comes down to the following:
We can't even safely apply refactoring, because refactoring really relies on have a strong set of unit tests you can run after each small change.
Oh well. It was a nice idea while it lasted ;-)
P.S. If you've got some good tips on apply agile methods to VB6 development I'd love to hear them
A lot of what we do in that code is quite complex and difficult to test, but it definitely needs testing. Up until now we've basically had a single person running test scripts manually for each new release. It's a slow process and quite painful, so it hardly ever gets done.
For our .NET code we've used many of the agile methodologies, such as TDD (test driven development), refactoring and continuous integration. These processes have worked quite well and at times have proven invaluable.
So I thought why not see if we can apply some of these methods to VB6? Well it's not so easy (as you may already know). The problems being that VB6 is a closed box, most of the logic is embedded in the forms, and those forms are not exposed to COM even if you write the application as an ActiveX exe (which we didn't).
I found a few articles one the web - one about using VB6 with NUnit and one on Debugging VB6 Binaries in VB.NET which all seemed promising, but nothing really works for our legacy code.
The problem comes down to the following:
- Our code is not very object oriented (VB6 isn't OO in any case). In fact our code is not even very "class oriented".
- Unit testing for VB6 effectively requires that the classes be in an ActiveX EXE or DLL file so that COM can get to them. We don't have any .DLLs and classes are embedded in the application.
- To test form logic you really need to have a model/view/controller environment (or something similar). We don't have this.
We can't even safely apply refactoring, because refactoring really relies on have a strong set of unit tests you can run after each small change.
Oh well. It was a nice idea while it lasted ;-)
P.S. If you've got some good tips on apply agile methods to VB6 development I'd love to hear them