Ruby access to Win Forms application

I am a QA Engineer implementing a Ruby-based test framework to test
the applications in my organization…the issue I have is about 20% of
what we do is Windows Forms (.NET) applications…can I use Win32OLE
for this, or would I need to use something like Ruby .NET or
IronRuby? Basically the idea of the application under test is that it
makes a socket connection to a server, then the server passes messages
to it. When a message is passed of a particular type, a “screen pop”
is generated. So what I want to do in a Ruby test is to:

  1. Set up a mock of the server and establish connection with the
    application.
  2. Send the application a message which should result in a screen
    pop.
  3. Verify the screen pop came up.

Anyway…any advice on this is greatly appreciated. I’ve done some
Ruby work but am a newbie as it pertains to using it to access
Windows.

Jim

Just using the win32 apis with things like FindWindow to check the popup
window is showing?

Jim K. wrote:

I am a QA Engineer implementing a Ruby-based test framework to test
the applications in my organization…the issue I have is about 20% of

what we do is Windows Forms (.NET) applications…

The majority of your tests simply must use .NET. They should run as
close as
possible to the tested code. Every step farther from that code, the
fuzzier
and sloppier the tests get.

In general, there’s always a role for tests that are easy to script. Raw
Ruby, or Ruby+YAML, would allow you to invent graceful DSLs that
simultaneously document and test business rules. Yet that’s not where
you
should start.

  1. Set up a mock of the server and establish connection with the
    application.
  2. Send the application a message which should result in a screen
    pop.
  3. Verify the screen pop came up.

Mock the thing that pops the screen up. You don’t need to test the GUI
itself, because you aren’t going to refactor or upgrade that.
(Hopefully!)
You need tests that cover only your own logic. That logic isn’t going
anywhere if a test simply catches its outputs before those outputs go
into
the real GUI.

assert_xpath, assert_javascript, & assert_ajax
Philip…Thanks for your thoughts…I guess my thought is that since I
am the QA guy, and am not writing the program code (I’d say we do
“moderately rapid but not agile” development), my job is just to
verify that the program works from a user perspective, not to unit-
test the code. So far, I’ve been using Ruby/Watir to drive the
browser and test our admin utility (which is a web application)…and
that’s worked great. The only thing remaining is to be able to
“drive” the win32 client so I can verify it responds appropriately to
messages it gets from the server. I guess my thought is, if I mock up
the client, how do I know the client is working (if I’m not actually
running it)?

On Aug 25, 6:32 pm, Jeremy W. [email protected] wrote:

Just using the win32 apis with things like FindWindow to check the popup
window is showing?

That’s exactly what I’m trying to do…nothing fancy, and I don’t need
code-level/unit tests…since I’m the QA guy and not the developer, I
just want to test the app itself to make sure at the user level, it
works the way it should. So I’d think something like a FindWindow
would work perfect…is that accessible through win32ole? Or
something else?

If your main app is in .NET you may want to try our Ruby Connector. This
is currently in beta and will be more generally availabale soon ( watch
the Blog for news! http://www.sapphiresteel.com/-Blog- )

More info here:
http://www.sapphiresteel.com/The-Ruby-Connector-beta-now
http://www.sapphiresteel.com/From-C-to-Ruby-and-back-again-The
http://www.sapphiresteel.com/Visual-Ruby-One-Small-Step

best wishes
Huw

SapphireSteel Software
http://www.sapphiresteel.com
Ruby P.ming In Visual Studio