3

I'm working on automating GUI tests of a Windows explorer extension. Think something like the TortoiseSVN menu. I'd like to be able to do something like TortoiseSVN->Show Log in the context menu.

I'd prefer a Ruby solution if possible but am willing to be language agnostic.

I found this on the web which is close but doesn't quite do what I want. It seems to only have some non-cascading menu default options and doesn't support shell extensions.

Any suggestions would be greatly appreciated.

peakxu
  • 6,667
  • 1
  • 28
  • 27

2 Answers2

2

Take a look at AutoItX3. I think you might be able to get that to do what you want.

You can interface it with Ruby through OLE:
http://actsasbuffoon.wordpress.com/2008/12/30/introduction-to-autoitx3/

EDIT

I'll just add how I got into the Explorer context menu here, maybe someone can figure out how to get further. I was just playing around a bit trying to see how hard it would be:

require 'win32ole'

shell  = WIN32OLE.new('Shell.Application')
folder = shell.NameSpace("D:\\")
files  = folder.Items
file   = nil

# Search for one specific file "test.rb"
files.each { |f| file = f if f.Name == "test.rb" }

# List all items in the context menu of test.rb
file.Verbs.each { |v| puts v.Name }

# At this point I ran out of ideas and couldn't figure out
# how to traverse into the submenus of the context menu...
Casper
  • 33,403
  • 4
  • 84
  • 79
  • Can you give any examples of interactions with shell extensions in context menus in AutoIt? Say, something like right click on C:\foo.txt and do TortoiseSVN->Show Log (assuming foo.txt is in version control)? Most of the provided examples seem to be GUI creation rather than manipulation. – peakxu Aug 12 '11 at 18:36
  • @peak - Sorry no I don't know how to do it specifically. I played around with just `WIN32OLE` a bit and managed to access items from the context menu, but I was not able to figure out how to get into submenus. – Casper Aug 12 '11 at 20:13
  • Thanks for the link to AutoIt though. It's quite interesting, although I haven't figured it out yet. – peakxu Aug 12 '11 at 22:34
  • @peak - No problem. I'm not quite sure if this is the right approach, but I added the code snippet I was playing with also. – Casper Aug 13 '11 at 00:15
  • This was roughly what I got with the link in my post also. It seems to allow access for commands like Copy but not anything with sub-menus like Send To. Also, some shell extensions like WinRar's works but others like TortoiseSVN doesn't. – peakxu Aug 13 '11 at 00:35
1

You might be interested in this method using Ruby ... via the Ruby gem called win32-autogui. It provides a framework for testing Windows GUI apps. Combine it with Ruby tools RSpec and Cucumber, and it gives you a powerful testing framework.

dodgy_coder
  • 12,407
  • 10
  • 54
  • 67