VB6 有什么好的 TDD 工具或资源吗?

发布于 2024-07-13 03:01:43 字数 1044 浏览 3 评论 0原文

是的,我知道我已经落后了,但我这里有一个古老的 VB6 编辑器应用程序,我相信没有人会很快升级到 .NET。 它使用了几个第三方 DLL 工具,并且由于它仍然使用旧的 RichEdit 控件,我基本上可以仅用这个工具来建立我自己的 Bug 农场。

所以够了,我想看看我是否可以使用 TDD,这样我就可以开始为我需要修复的每个行为/功能编写单元测试,所以迟早我可以为这个工具拥有一个完整的回归测试套件。 即使将来我们确实升级到 .NET,我认为我编写的大多数测试都应该有助于验证正确的行为,并且我猜也应该可以升级到 .NET 版本。

一些基本的谷歌搜索将我发送到这个工具调用 simplyVBunit,但我找不到足够的指南等来帮助我开始了,是的,我也不太精通 VB6 :(

  1. 所以有人知道有什么好的吗 我使用 TDD 的工具/资源 对于这个 VB6 应用程序? [最好稍后升级到.NET,以防万一。]
  2. 或者我实际上可以使用这些单元 .NET 的测试框架,即 NUnit, 等等通过解决方法?
  3. 或者还有更厉害的 如何完成这件事?

谢谢:)

编辑:

我尝试过弄乱vbunit,但我发现没有简单的方法可以将其添加到现有的应用程序中,或者至少我不知道如何添加。 因此我发现这个也可以玩, vb-lite-unit 还有这个社区。 另外,有人说我们可以使用 NUnit 与 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

罗罗贝儿 2024-07-20 03:01:43

我使用 SimplyVBUnit 获得了非常流畅的 TDD 体验。 我认为代码附带的示例非常不言自明。

您在启动时最初加载的表单包含该控件。 然后在 Form_Load 子中:

 AddTest New TestDifferentAsserts

TestDifferentAsserts 是一个 vb 类。
它看起来像这样:

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

事实上,明天我将在我的计算机上重新加载 vb6,以便使用 simplevbunit 在我的计算机上进行攻击。

[添加编辑]

这是我在 VB6 中的项目资源管理器:

project explorer

Form1 是simplevbunit 控件所在的位置。

此项目的源代码

如果你有第三方控制,谁在乎呢。 用门面包裹它们。 然后从立面创建一个存根。

如果您需要进一步的帮助,请发表评论。

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.

美人骨 2024-07-20 03:01:43

VBUnit 在我以前的客户的 VB6 项目中工作得很好。

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

放低过去 2024-07-20 03:01:43

我面临的情况是,我们有一个巨大的 VB6 应用程序正在迁移到 .NET。 迁移的版本经过了全面的单元测试。

我们采用的方法是通过 COM 互操作从 .NET 对 VB6 应用程序进行单元测试。 到目前为止,我们发现的主要优点是 VB6 开发人员最终学习 TDD(及其含义):

  • 方法:先测试,然后编码。
  • 架构:SoC、内聚、DRY,...
  • 技术:测试和模拟框架, IoC 容器...

该解决方案极大地提高了迁移版本的代码质量,因为它们了解如何以一种使测试更容易的方式构建事物。 此外,还有可能在 VB6 和 .NET 版本上使用相同的测试。

不确定此解决方案是否针对您的问题进行了过度架构。 您应该评估是否适用或适合您的情况。

问候。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文