Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

.net - Are there any good TDD tools or resources for VB6?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've had very smooth TDD experience using SimplyVBUnit. I thought the sample the code comes with was pretty self-explanatory.

Your initially loaded form at start-up contains the control. Then in the Form_Load sub you:

 AddTest New TestDifferentAsserts

The TestDifferentAsserts is a vb class. It looks something like this:

Public Sub TestFloatCompareTolerance()
   ' we will use the default tolerance of 0.00001
   Assert.AreEqual 9#, 9.000001, "Should be equal!"

   ' The Expected value must be a Double or Single
   ' for the tolerance to be used in the comparison.
   Assert.AreEqual 9, 9.000001, "This will fail because we didn't use a float for the expected value."
End Sub

In fact tomorrow I'm reloading vb6 on my computer to hack around on my computer with simplyvbunit.

[ADDED EDIT]

This is my project Explorer in VB6:

project explorer

Form1 is where the simplyvbunit control is located.

The source code for this project.

If you have third party controls, who cares. Wrap them with a facade. Then create a stub from the facade.

If you need further help, leave a comment.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...