Automated testing of VBA UserForms- tools and/or techniques?
Asked Answered
C

1

7

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

Champ answered 27/1, 2009 at 12:47 Comment(0)
R
2

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?

Risley answered 27/1, 2009 at 13:11 Comment(1)
That isn't a bad idea. I'd like to keep architectural changes minimal, and it would be a lot of coding, but it removes a lot of the pain of dealing with the GUI. We're exploring alternative avenues but might come back to this idea.Champ

© 2022 - 2024 — McMap. All rights reserved.