GUI Test Automation with Ranorex Studio

Today I got a demo of a tool called Ranorex Studio, a test automation product built using the SharpDevelop IDE. Aside from the IDE, I last played with in the early days of the SharpDevelop project, the most interesting aspect was the Ranorex C# framework with that provides the basis of modeling UI elements in a manner similar to Zombie’s GEM framework. Tests can be written in C#, VB.NET or Iron Python using the framework to build tests. To give you a taste of this kind of “model” binding here is fragment from a typed class that models Windows Calc:

/// <summary>
/// The FormCalculatorAppFolder folder.
/// </summary>
public class FormCalculatorAppFolder : RepoGenBaseFolder
{
    /// <summary>
    /// Creates a new FormCalculator  folder.
    /// </summary>
    public FormCalculatorAppFolder(RepoGenBaseFolder appFolder) :
            base("FormCalculator", "/form[@title='Calculator' or @title='Rechner']", appFolder, 3000, true)
    {
    }
    /// <summary>
    /// The ButtonAsterisk item.
    /// </summary>
    public virtual Ranorex.Button ButtonAsterisk
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("ButtonAsterisk", "button[@text='*']", 5000, null);
        }
    }
    /// <summary>
    /// The Button3 item.
    /// </summary>
    public virtual Ranorex.Button Button3
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("Button3", "button[@text='3']", 5000, null);
        }
    }
    /// <summary>
    /// The ButtonEqual item.
    /// </summary>
    public virtual Ranorex.Button ButtonEqual
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("ButtonEqual", "button[@text='=']", 5000, null);
        }
    }
    /// <summary>
    /// The OutputText item.
    /// </summary>
    public virtual Ranorex.Text OutputText
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Text>("OutputText", "text[@controlid='403']", 5000, null);
        }
    }
    /// <summary>
    /// The ButtonClose item.
    /// </summary>
    public virtual Ranorex.Button ButtonClose
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("ButtonClose", "titlebar/button[@accessiblename='Close' or @accessiblename='Schließen']", 5000, null);
        }
    }
    /// <summary>
    /// The Button7 item.
    /// </summary>
    public virtual Ranorex.Button Button7
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("Button7", "button[@text='7']", 5000, null);
        }
    }
    /// <summary>
    /// The ButtonMinus item.
    /// </summary>
    public virtual Ranorex.Button ButtonMinus
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Button>("ButtonMinus", "button[@text='-']", 5000, null);
        }
    }
    /// <summary>
    /// The Self item.
    /// </summary>
    public virtual Ranorex.Form Self
    {
        get
        {
            return CreateAdapterForPath<Ranorex.Form>("Self", "", 3000, null);
        }
    }
}

Notice in this example methods of class FormCalculatorAppFolder use XPATH regular expressions to “bind” their respective UI element which I think this is an interesting approach with a lot of flexibility. Also notice the idea here is similar to that of strongly typed dataset for data access. The tool provides a set of “adapters” which are used to drive various types of UI at varying degrees of accessibility (WinAPI, .NET, Web, MSAA).

I haven’t had enough time using the tool or framework to draw a conclusion as to the validity of the approach or quality of implementation but I have seen a few unexpected error dialogs which are things that will need to be fixed right away.

Are you familiar with or have you used this tool? If so, what do you think?

If not, what tools are you using for GUI automation?

5 thoughts on “GUI Test Automation with Ranorex Studio

  1. FWIW, those things are XPath expressions, not regular expressions. Anything that implements IXPathNavigable (IIRC – I don’t have docs in front of me right now) can be navigated automatically by the .NET library’s XPath implementation, which is pretty nice. So, it was cheap in terms of implementation effort for those guys to do this, and leverages existing knowledge pretty nicely – form-based UIs do tend to have a relatively-obvious tree-like structure, and XPath can express navigation along all the usual axes, such as siblings, parent/children/arbitrary-depth children, ordinal access, etc.

  2. > what tools are you using for GUI automation?
    I used to use TestComplete 3, but have moved all GUI tests to Delphi. My app uses only a small set of controls, so it wasn’t too difficult to build a GUI test runner. The test scripts have huge business value, that’s why I’d rather not depend on a third party tool to run them. If the tool doesn’t work with your latest IDE, or the latest Windows version you’re stuck.
    Besides, the tests didn’t run all that reliable. Well, they still don’t but now I know who to blame 🙂

  3. Hi Bary,
    Yes, thanks fixed. I kept thinking that during the presentation although the presenter kept saying "regular" expressions, I guess he sold me on it. 🙂 Upon seeing this framework I initially thought of Zombie and although it doesn’t use XPATH for binding has a flexible strategy based the information that can be gleaned from the application under test. Unlike Zombie XPATH is particularly nice because of the flexibility whereas Zombie’s age (it’s ~14 years old now) is apparent. Other tools that came to mind are Selenuim and ArtOfTest’s WebAii Framework which also make use of XPATH though both are geared towards web testing. I agree, applying this technique to GUI testing especially where the details are tucked away in a generated class are particularly interesting. It would be possible to build a similar framework on top of Selenium and it would be nice if there were a tool that could generated typed classes from web pages.
    As a side note, SubSonic comes with a build provider which automatically generates classes for a database and I think it could be interesting to have the same thing for GUI test automation.

  4. Your site looks ugly in IE8 until compatibility is enabled – the font looks raised and shadowed – and hard to read.

Comments are closed.