views:

726

answers:

3

Hi Guys,

Yea i know i'm way behind times but what i've got here is a antique VB6 editor app which i believe that no one will be upgrading to .NET soon. It uses a couple of third party DLLs tools and as it's still using the good old RichEdit control i basically can raise my own Bug farm with just this tool alone.

So enough is enough and i'm trying to see if i can use TDD so i can start writing unit test for each behavior/feature that i need to fix, so sooner or later i can have a complete regression test suite for this tool. And even in the future if we do upgrade to .NET i think most of the tests that i've written should be helpful in validating the correct behavior and should be upgradable to a .NET version too, i guess.

Some basic Googling send me to this tool call simplyVBunit, but i can't find enough guides,etc to get me started and yes i'm not that proficient with VB6 either :(

  1. So does anyone know of any good tools/resources for me to use TDD for this VB6 app? [Preferably upgradable to .NET later just in case.]
  2. Or i can actually use those unit test framework for .NET, i.e. NUnit, etc via a workaround?
  3. Or is there's an even more awesome way to get this done?

Thanks :)

EDIT:

I've tried messing with vbunit but i found that there's no easy way to add it to an existing app or at least not to my know how. Thus i've found this to play with too, vb-lite-unit and also this comunit. Plus there's some saying that we can use NUnit with vb6 but there's even less resource on that.

+3  A: 

VBUnit worked well for me at a former client on a VB6 project.

Jim Anderson
Thanks for the suggestion, i'm going to try it out :)
melaos
@Jim, is there an easy way to add vbunit an already existing app like the one i've mentioned above? i check the tutorial but to me it seems to that i would have to add pieces of the app bit by bit? thanks.
melaos
@melaos - I'm not sure what you mean. It has been a while since I have used it, but I don't recall any problems adding it to an existing app. If fact, I started with a project with no unit tests.
Jim Anderson
@Jim, i followed the tutorial, i can create a new vbtest project just fine. But when i try to add class the vbtestframework and the fixture to my existing project, i can't get vbrunner to work. It claims iSuite as UDF type and can't find it.
melaos
@melaos I don't know. I never ran into such a problem.
Jim Anderson
@Jim, actually my app consist of a main exe with plenty of 3rd party dll. how do i setup the test in this case? thanks.
melaos
@melaos: Sorry, I don't know. I didn't run into any problems. The only I know to do is to look at the documentation which I am sure you have. Or if you have purchased the licensed version, contact support.
Jim Anderson
+7  A: 
Gutzofter
Mmm, maybe i was too busy looking around for the best TDD tools that i wasn't really paying attention. I'll go back and revisit this tool then. thanks.
melaos
@Gutzofter, actually my app consist of a main exe with plenty of 3rd party dll. how do i setup the test in this case? thanks.
melaos
@melaos, see my updated edit
Gutzofter
+1 I am using it now for weeks, is sometimes buggy but has helped me tremendously.
Dabblernl
@dabblernl - how is it buggy. I've yet to run into any issues. But it would be good to comment it here for other people to have an idea of its weaknesses.
Gutzofter
Bugs I encountered: FixtureTeardown method called after each test. Quitting in the middle of the tests while stepping through the code can lead to ugly error messages, at one time I needed to rebuild the test project to get it to work again.
Dabblernl
+3  A: 

Hi Melaos,

I'm in the situation were we have a huge VB6 application which is on the way to be migrated to .NET. The migrated version is fully unit tested.

The approach we've taken is to unit test the VB6 application from .NET via COM interop. The main advantage we found so far is that VB6 developers end up learning TDD (and all what it implies):

  • Methodology: test first, code afterwards..
  • Architecture: SoC, cohesion, DRY, ...
  • Technology: testing and mocking frameworks, IoC containers...

This solution is improving hugely the code quality of the migrated version as they understand how to architecture things in a way that makes testing easier. Also, there's a potential opportunity to use the same tests on the VB6 and the .NET version.

Not sure if this solution is over-architectured for your problem. You should assess whether or not is applicable or suitable in your situation.

Regards.

Benjamin Arroyo
@Benjamin So what tool did you use to do the unit testing? NUnit?
melaos
I've been using MbUnit for two years now and I'm happy with it. I strongly recomend to use MbUnit 2.4. Wait a little bit more before going to version 3; is still buggy.
Benjamin Arroyo
It sounds possibly over-the-top for melaos but it's useful info for the rest of us - thanks Benjamin
MarkJ
@Benjamin thanks, @MarkJ hehe as long as it's useful, answers away :)
melaos