VBA 用户窗体的自动测试 - 工具和/或技术?

发布于 2024-07-13 07:53:15 字数 670 浏览 11 评论 0原文

我希望在一个相当大的 Excel 插件上开始自动回归测试,该插件围绕一个由几个带有标准控件的模态用户窗体组成的 GUI。

主要问题是我研究过的大多数自动化测试工具(Rational Robot、AutomatedQA TestComplete、网络自动化 Automate 等)都不能做到这一点。不完全支持 VBA 控件,因此他们的测试最终会重播鼠标单击和按键,因此实际上不可维护。 理想情况下,我需要一个能够识别 VBA 表单控件的测试工具,因此我可以说“按下此按钮并等待此列表框更改”,而不是“单击 (237, 58) 并等待 500 毫秒”。

我还考虑过将测试自动化作为 VBA 构建到加载项中,但用户的大部分时间都花在与模式对话框交互上,该对话框会停止 VBA 在后台运行,因此这几乎是不可能的。

我的问题-这里是否有人有使用自动化测试工具的经验,该工具

a)识别VBA用户表单控件并可以可靠地与它们交互

b)支持带有条件分支和成功/失败日志记录的测试脚本,而不仅仅是记录和回放?

或者,有谁知道如何解决模式对话框暂停 VBA 执行的问题,以便我可以从 VBA 内驱动加载项?

我花了一段时间浏览 QA 论坛,但没有在那里找到任何内容,因此任何帮助或线索将不胜感激。

谢谢你的帮助,

-马丁

I am looking to start automated regression testing on a fairly large Excel add-in that revolves around a GUI composed of a few modal UserForms with standard controls.

The main problem is that most of the automated testing tools I have looked into (Rational Robot, AutomatedQA TestComplete, Network Automation Automate etc) don't fully support the VBA controls so their tests end up replaying mouse clicks and key presses, so aren't really maintainable. Ideally I need a testing tool that recognises the VBA form controls, so I can say "press this button and wait for this listbox to change" rather than "click at (237, 58) and wait 500 milliseconds".

I also considered building the test automation into the add-in as VBA, but most of the user's time is spent interacting with a modal dialog which stops the VBA running in the background, so that's pretty much out of the question.

My question- does anyone here have any experience with an automated testing tool that

a) recognises VBA user form controls and can reliably interact with them

b) has support for test scripting with conditional branches and success/failure logging, rather than just record and playback?

Alternatively, does anyone know of a way I can get around the problem of modal dialogs pausing VBA execution so I can drive the add-in from within VBA?

I've spent a while looking around QA forums but haven't found anything there, so any help or leads would be appreciated.

Thanks for your help,

-Martin

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

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

发布评论

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

评论(1

雅心素梦 2024-07-20 07:53:15

我不知道有哪个工具可以实现您所说的功能,但是您是否考虑过从不同的方向进行攻击?

我在这里推测有多少逻辑可以被推入“正常”VB/VBA 类中,以便可以对各个方法进行单元测试。 也许这样的类甚至可以公开事件,以便为了测试,您可以用提供必要刺激并收集响应以进行检查的测试工具替换表单。

它不会解决(现在非常轻量级)表单本身与底层类的连接,但它至少会最小化未经测试的区域。

我真的只是在“大声”思考,但你认为这有用吗?

I don't know of a tool that does what you say, but have you thought about attacking from a different direction?

I'm speculating a little here about how much of the logic in the could be pushed down into a "normal" VB/VBA Class in such a way that individual methods could be unit-tested. Perhaps such a Class might expose events, even, so that for testing you could replace the form with a test harness that provided the necessary stimuli and collected the responses for checking.

It wouldn't address the hookup of the (now very lightweight) form itself to the underlying class, but it would at least minimise the untested area.

I'm really just thinking "out loud", but do you think that would work at all?

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