Meta

I’ve been continuing my exploration of IronRuby and White for gui testing. I expected to deal with Automation IDs first, but I’ll get back to that. For now I’m tying IronRuby to White, and handling generics.

My install of white is not in the GAC, so I’ll be requireing DLLs from a directory. DLLs are looked for in ruby’s $LOAD_PATH, just like ruby libraries. It’s an array. You’ll notice that White suggests also including an NUnit dll, but I’ve not needed that with RSpec. And, I want to shorten the namespace stuff. So let’s start with white.rb and we’ll add to it later.

So, next we just start using the application. I want to launch my application, conviniently called “sekrit.” I need to find the window titled “Sekrit (version 0.5)”. Then I need to call the C# method win.Get<Button>("Open") but that uses generics that ruby doesn’t have. Using what I learned from a Stack Overflow post how to invoke an overloaded generic method in ironruby, we can work around that in IronRuby 0.5.

Oh, lawdy! Did you see that last line? It ain’t pretty. This is something we’ll be doing a lot of, so let’s wrap that up. I need to add, essentially, a non-generic extention method to wrap the generic call. But, do it with Ruby to extend a .NET class. Back to white.rb for some open class magic.

Okay, one more problem. I talked about RSpec, but that’s because I hacked my install. There’s a known bug in IronRuby 0.5’s implementation of File.expand_path(file_name) that uses the .NET System::IO::Path methods that throws execptions when you try to expand a path with “:8” on the end to help track line numbers. I don’t know yet if it’s been fixed. If not, that may be another post.

So, what’s left? RSpec doesn’t run out of the box. I need to wrap some stuff up so I can say app.open_file("some_file.ext") and other higher level “user action” concepts (those shouldn’t be in white.rb, but sekrit.rb). I need to handle finding controls quickly and easily. I’ll take a look at that this weekend and see what I can find. Especially, since I’ll be hanging with a WPF MVP both this evening at IndyALT.NET and on Saturday.

About Brian Ball

I'm a Software Engineer in Indianapolis. I'm interested in programming languages. I love dynamic languages like Ruby and Perl. I'm exploring functional languages like Haskell, F#, Clojure, and Erlang. I also use the .NET framework and occasionally deal with System Testing.

If you're not careful, you might also see some sketches and other art come up every once in a while.